Skip to content

Commit

Permalink
build: release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Oct 26, 2019
1 parent 2963090 commit 3cc3708
Show file tree
Hide file tree
Showing 13 changed files with 719 additions and 665 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## next
## 1.4.0 (Oct 26, 2019)

- Add two new options: `zoomOnTouch` and `zoomOnWheel`(#329).

Expand Down
52 changes: 33 additions & 19 deletions dist/viewer.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.3.7
* Viewer.js v1.4.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-02T09:29:13.426Z
* Date: 2019-10-26T07:09:40.792Z
*/

'use strict';
Expand Down Expand Up @@ -205,23 +205,35 @@ var DEFAULTS = {
*/
movable: true,

/**
* Enable to rotate the image.
* @type {boolean}
*/
rotatable: true,

/**
* Enable to scale the image.
* @type {boolean}
*/
scalable: true,

/**
* Enable to zoom the image.
* @type {boolean}
*/
zoomable: true,

/**
* Enable to rotate the image.
* Enable to zoom the image by dragging touch.
* @type {boolean}
*/
rotatable: true,
zoomOnTouch: true,

/**
* Enable to scale the image.
* Enable to zoom the image by wheeling mouse.
* @type {boolean}
*/
scalable: true,
zoomOnWheel: true,

/**
* Indicate if toggle the image size between its natural size
Expand Down Expand Up @@ -1206,17 +1218,20 @@ var events = {
canvas = this.canvas;
var document = this.element.ownerDocument;
addListener(viewer, EVENT_CLICK, this.onClick = this.click.bind(this));
addListener(viewer, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
passive: false,
capture: true
});
addListener(viewer, EVENT_DRAG_START, this.onDragStart = this.dragstart.bind(this));
addListener(canvas, EVENT_POINTER_DOWN, this.onPointerDown = this.pointerdown.bind(this));
addListener(document, EVENT_POINTER_MOVE, this.onPointerMove = this.pointermove.bind(this));
addListener(document, EVENT_POINTER_UP, this.onPointerUp = this.pointerup.bind(this));
addListener(document, EVENT_KEY_DOWN, this.onKeyDown = this.keydown.bind(this));
addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));

if (options.zoomable && options.zoomOnWheel) {
addListener(viewer, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
passive: false,
capture: true
});
}

if (options.toggleOnDblclick) {
addListener(canvas, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));
}
Expand All @@ -1227,17 +1242,20 @@ var events = {
canvas = this.canvas;
var document = this.element.ownerDocument;
removeListener(viewer, EVENT_CLICK, this.onClick);
removeListener(viewer, EVENT_WHEEL, this.onWheel, {
passive: false,
capture: true
});
removeListener(viewer, EVENT_DRAG_START, this.onDragStart);
removeListener(canvas, EVENT_POINTER_DOWN, this.onPointerDown);
removeListener(document, EVENT_POINTER_MOVE, this.onPointerMove);
removeListener(document, EVENT_POINTER_UP, this.onPointerUp);
removeListener(document, EVENT_KEY_DOWN, this.onKeyDown);
removeListener(window, EVENT_RESIZE, this.onResize);

if (options.zoomable && options.zoomOnWheel) {
removeListener(viewer, EVENT_WHEEL, this.onWheel, {
passive: false,
capture: true
});
}

if (options.toggleOnDblclick) {
removeListener(canvas, EVENT_DBLCLICK, this.onDblclick);
}
Expand Down Expand Up @@ -1484,8 +1502,6 @@ var handlers = {
}

break;

default:
}
},
dragstart: function dragstart(event) {
Expand Down Expand Up @@ -1519,7 +1535,7 @@ var handlers = {

var action = options.movable ? ACTION_MOVE : false;

if (Object.keys(pointers).length > 1) {
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
action = ACTION_ZOOM;
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
action = ACTION_SWITCH;
Expand Down Expand Up @@ -2748,8 +2764,6 @@ var others = {

break;
}

default:
} // Override


Expand Down
4 changes: 2 additions & 2 deletions dist/viewer.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.3.7
* Viewer.js v1.4.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-02T09:29:07.561Z
* Date: 2019-10-26T07:09:34.435Z
*/

.viewer-zoom-in::before,
Expand Down
52 changes: 33 additions & 19 deletions dist/viewer.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.3.7
* Viewer.js v1.4.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-02T09:29:13.426Z
* Date: 2019-10-26T07:09:40.792Z
*/

function _typeof(obj) {
Expand Down Expand Up @@ -203,23 +203,35 @@ var DEFAULTS = {
*/
movable: true,

/**
* Enable to rotate the image.
* @type {boolean}
*/
rotatable: true,

/**
* Enable to scale the image.
* @type {boolean}
*/
scalable: true,

/**
* Enable to zoom the image.
* @type {boolean}
*/
zoomable: true,

/**
* Enable to rotate the image.
* Enable to zoom the image by dragging touch.
* @type {boolean}
*/
rotatable: true,
zoomOnTouch: true,

/**
* Enable to scale the image.
* Enable to zoom the image by wheeling mouse.
* @type {boolean}
*/
scalable: true,
zoomOnWheel: true,

/**
* Indicate if toggle the image size between its natural size
Expand Down Expand Up @@ -1204,17 +1216,20 @@ var events = {
canvas = this.canvas;
var document = this.element.ownerDocument;
addListener(viewer, EVENT_CLICK, this.onClick = this.click.bind(this));
addListener(viewer, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
passive: false,
capture: true
});
addListener(viewer, EVENT_DRAG_START, this.onDragStart = this.dragstart.bind(this));
addListener(canvas, EVENT_POINTER_DOWN, this.onPointerDown = this.pointerdown.bind(this));
addListener(document, EVENT_POINTER_MOVE, this.onPointerMove = this.pointermove.bind(this));
addListener(document, EVENT_POINTER_UP, this.onPointerUp = this.pointerup.bind(this));
addListener(document, EVENT_KEY_DOWN, this.onKeyDown = this.keydown.bind(this));
addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));

if (options.zoomable && options.zoomOnWheel) {
addListener(viewer, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
passive: false,
capture: true
});
}

if (options.toggleOnDblclick) {
addListener(canvas, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));
}
Expand All @@ -1225,17 +1240,20 @@ var events = {
canvas = this.canvas;
var document = this.element.ownerDocument;
removeListener(viewer, EVENT_CLICK, this.onClick);
removeListener(viewer, EVENT_WHEEL, this.onWheel, {
passive: false,
capture: true
});
removeListener(viewer, EVENT_DRAG_START, this.onDragStart);
removeListener(canvas, EVENT_POINTER_DOWN, this.onPointerDown);
removeListener(document, EVENT_POINTER_MOVE, this.onPointerMove);
removeListener(document, EVENT_POINTER_UP, this.onPointerUp);
removeListener(document, EVENT_KEY_DOWN, this.onKeyDown);
removeListener(window, EVENT_RESIZE, this.onResize);

if (options.zoomable && options.zoomOnWheel) {
removeListener(viewer, EVENT_WHEEL, this.onWheel, {
passive: false,
capture: true
});
}

if (options.toggleOnDblclick) {
removeListener(canvas, EVENT_DBLCLICK, this.onDblclick);
}
Expand Down Expand Up @@ -1482,8 +1500,6 @@ var handlers = {
}

break;

default:
}
},
dragstart: function dragstart(event) {
Expand Down Expand Up @@ -1517,7 +1533,7 @@ var handlers = {

var action = options.movable ? ACTION_MOVE : false;

if (Object.keys(pointers).length > 1) {
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
action = ACTION_ZOOM;
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
action = ACTION_SWITCH;
Expand Down Expand Up @@ -2746,8 +2762,6 @@ var others = {

break;
}

default:
} // Override


Expand Down
Loading

0 comments on commit 3cc3708

Please sign in to comment.