Skip to content

Commit

Permalink
build: release 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Nov 23, 2019
1 parent d7a08cf commit 038aa26
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 157 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.5.0 (Nov 23, 2019)

- Force reflow element in a new way to avoid side effect (#343).
- Add a new option: `slideOnTouch` (#340).
Expand Down
30 changes: 17 additions & 13 deletions dist/viewer.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.4.0
* Viewer.js v1.5.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-26T07:09:40.792Z
* Date: 2019-11-23T05:10:26.193Z
*/

'use strict';
Expand Down Expand Up @@ -80,13 +80,13 @@ function _objectSpread2(target) {
var source = arguments[i] != null ? arguments[i] : {};

if (i % 2) {
ownKeys(source, true).forEach(function (key) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
Expand Down Expand Up @@ -224,7 +224,7 @@ var DEFAULTS = {
zoomable: true,

/**
* Enable to zoom the image by dragging touch.
* Enable to zoom the current image by dragging on the touch screen.
* @type {boolean}
*/
zoomOnTouch: true,
Expand All @@ -235,6 +235,12 @@ var DEFAULTS = {
*/
zoomOnWheel: true,

/**
* Enable to slide to the next or previous image by swiping on the touch screen.
* @type {boolean}
*/
slideOnTouch: true,

/**
* Indicate if toggle the image size between its natural size
* and initial size when double click on the image or not.
Expand Down Expand Up @@ -845,7 +851,7 @@ function getTransforms(_ref) {
* @param {string} url - The target url.
* @example
* // picture.jpg
* getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
* @returns {string} A string contains the image name.
*/

Expand Down Expand Up @@ -1535,9 +1541,9 @@ var handlers = {

var action = options.movable ? ACTION_MOVE : false;

if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
if (options.zoomOnTouch && options.zoomable && Object.keys(pointers).length > 1) {
action = ACTION_ZOOM;
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
} else if (options.slideOnTouch && (event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
action = ACTION_SWITCH;
}

Expand Down Expand Up @@ -1743,9 +1749,8 @@ var methods = {
}
};
addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
// eslint-disable-next-line

viewer.offsetWidth;
viewer.initialOffsetWidth = viewer.offsetWidth;
addListener(viewer, EVENT_TRANSITION_END, shown, {
once: true
});
Expand Down Expand Up @@ -2454,9 +2459,8 @@ var methods = {
addClass(tooltipBox, CLASS_SHOW);
addClass(tooltipBox, CLASS_FADE);
addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
// eslint-disable-next-line

tooltipBox.offsetWidth;
tooltipBox.initialOffsetWidth = tooltipBox.offsetWidth;
addClass(tooltipBox, CLASS_IN);
} else {
addClass(tooltipBox, CLASS_SHOW);
Expand Down Expand Up @@ -2538,7 +2542,7 @@ var methods = {
var img = item.querySelector('img');
var image = images[i];

if (image) {
if (image && img) {
if (image.src !== img.src) {
indexes.push(i);
}
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.4.0
* Viewer.js v1.5.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-26T07:09:34.435Z
* Date: 2019-11-23T05:10:21.757Z
*/

.viewer-zoom-in::before,
Expand Down
30 changes: 17 additions & 13 deletions dist/viewer.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.4.0
* Viewer.js v1.5.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-26T07:09:40.792Z
* Date: 2019-11-23T05:10:26.193Z
*/

function _typeof(obj) {
Expand Down Expand Up @@ -78,13 +78,13 @@ function _objectSpread2(target) {
var source = arguments[i] != null ? arguments[i] : {};

if (i % 2) {
ownKeys(source, true).forEach(function (key) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
Expand Down Expand Up @@ -222,7 +222,7 @@ var DEFAULTS = {
zoomable: true,

/**
* Enable to zoom the image by dragging touch.
* Enable to zoom the current image by dragging on the touch screen.
* @type {boolean}
*/
zoomOnTouch: true,
Expand All @@ -233,6 +233,12 @@ var DEFAULTS = {
*/
zoomOnWheel: true,

/**
* Enable to slide to the next or previous image by swiping on the touch screen.
* @type {boolean}
*/
slideOnTouch: true,

/**
* Indicate if toggle the image size between its natural size
* and initial size when double click on the image or not.
Expand Down Expand Up @@ -843,7 +849,7 @@ function getTransforms(_ref) {
* @param {string} url - The target url.
* @example
* // picture.jpg
* getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
* @returns {string} A string contains the image name.
*/

Expand Down Expand Up @@ -1533,9 +1539,9 @@ var handlers = {

var action = options.movable ? ACTION_MOVE : false;

if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
if (options.zoomOnTouch && options.zoomable && Object.keys(pointers).length > 1) {
action = ACTION_ZOOM;
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
} else if (options.slideOnTouch && (event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
action = ACTION_SWITCH;
}

Expand Down Expand Up @@ -1741,9 +1747,8 @@ var methods = {
}
};
addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
// eslint-disable-next-line

viewer.offsetWidth;
viewer.initialOffsetWidth = viewer.offsetWidth;
addListener(viewer, EVENT_TRANSITION_END, shown, {
once: true
});
Expand Down Expand Up @@ -2452,9 +2457,8 @@ var methods = {
addClass(tooltipBox, CLASS_SHOW);
addClass(tooltipBox, CLASS_FADE);
addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
// eslint-disable-next-line

tooltipBox.offsetWidth;
tooltipBox.initialOffsetWidth = tooltipBox.offsetWidth;
addClass(tooltipBox, CLASS_IN);
} else {
addClass(tooltipBox, CLASS_SHOW);
Expand Down Expand Up @@ -2536,7 +2540,7 @@ var methods = {
var img = item.querySelector('img');
var image = images[i];

if (image) {
if (image && img) {
if (image.src !== img.src) {
indexes.push(i);
}
Expand Down
30 changes: 17 additions & 13 deletions dist/viewer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.4.0
* Viewer.js v1.5.0
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-10-26T07:09:40.792Z
* Date: 2019-11-23T05:10:26.193Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -84,13 +84,13 @@
var source = arguments[i] != null ? arguments[i] : {};

if (i % 2) {
ownKeys(source, true).forEach(function (key) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
Expand Down Expand Up @@ -228,7 +228,7 @@
zoomable: true,

/**
* Enable to zoom the image by dragging touch.
* Enable to zoom the current image by dragging on the touch screen.
* @type {boolean}
*/
zoomOnTouch: true,
Expand All @@ -239,6 +239,12 @@
*/
zoomOnWheel: true,

/**
* Enable to slide to the next or previous image by swiping on the touch screen.
* @type {boolean}
*/
slideOnTouch: true,

/**
* Indicate if toggle the image size between its natural size
* and initial size when double click on the image or not.
Expand Down Expand Up @@ -849,7 +855,7 @@
* @param {string} url - The target url.
* @example
* // picture.jpg
* getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
* @returns {string} A string contains the image name.
*/

Expand Down Expand Up @@ -1539,9 +1545,9 @@

var action = options.movable ? ACTION_MOVE : false;

if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
if (options.zoomOnTouch && options.zoomable && Object.keys(pointers).length > 1) {
action = ACTION_ZOOM;
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
} else if (options.slideOnTouch && (event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
action = ACTION_SWITCH;
}

Expand Down Expand Up @@ -1747,9 +1753,8 @@
}
};
addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
// eslint-disable-next-line

viewer.offsetWidth;
viewer.initialOffsetWidth = viewer.offsetWidth;
addListener(viewer, EVENT_TRANSITION_END, shown, {
once: true
});
Expand Down Expand Up @@ -2458,9 +2463,8 @@
addClass(tooltipBox, CLASS_SHOW);
addClass(tooltipBox, CLASS_FADE);
addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
// eslint-disable-next-line

tooltipBox.offsetWidth;
tooltipBox.initialOffsetWidth = tooltipBox.offsetWidth;
addClass(tooltipBox, CLASS_IN);
} else {
addClass(tooltipBox, CLASS_SHOW);
Expand Down Expand Up @@ -2542,7 +2546,7 @@
var img = item.querySelector('img');
var image = images[i];

if (image) {
if (image && img) {
if (image.src !== img.src) {
indexes.push(i);
}
Expand Down
Loading

0 comments on commit 038aa26

Please sign in to comment.