Skip to content

Commit 038aa26

Browse files
committed
build: release 1.5.0
1 parent d7a08cf commit 038aa26

File tree

12 files changed

+82
-157
lines changed

12 files changed

+82
-157
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## next
3+
## 1.5.0 (Nov 23, 2019)
44

55
- Force reflow element in a new way to avoid side effect (#343).
66
- Add a new option: `slideOnTouch` (#340).

dist/viewer.common.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* Viewer.js v1.4.0
2+
* Viewer.js v1.5.0
33
* https://fengyuanchen.github.io/viewerjs
44
*
55
* Copyright 2015-present Chen Fengyuan
66
* Released under the MIT license
77
*
8-
* Date: 2019-10-26T07:09:40.792Z
8+
* Date: 2019-11-23T05:10:26.193Z
99
*/
1010

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

8282
if (i % 2) {
83-
ownKeys(source, true).forEach(function (key) {
83+
ownKeys(Object(source), true).forEach(function (key) {
8484
_defineProperty(target, key, source[key]);
8585
});
8686
} else if (Object.getOwnPropertyDescriptors) {
8787
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8888
} else {
89-
ownKeys(source).forEach(function (key) {
89+
ownKeys(Object(source)).forEach(function (key) {
9090
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
9191
});
9292
}
@@ -224,7 +224,7 @@ var DEFAULTS = {
224224
zoomable: true,
225225

226226
/**
227-
* Enable to zoom the image by dragging touch.
227+
* Enable to zoom the current image by dragging on the touch screen.
228228
* @type {boolean}
229229
*/
230230
zoomOnTouch: true,
@@ -235,6 +235,12 @@ var DEFAULTS = {
235235
*/
236236
zoomOnWheel: true,
237237

238+
/**
239+
* Enable to slide to the next or previous image by swiping on the touch screen.
240+
* @type {boolean}
241+
*/
242+
slideOnTouch: true,
243+
238244
/**
239245
* Indicate if toggle the image size between its natural size
240246
* and initial size when double click on the image or not.
@@ -845,7 +851,7 @@ function getTransforms(_ref) {
845851
* @param {string} url - The target url.
846852
* @example
847853
* // picture.jpg
848-
* getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
854+
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
849855
* @returns {string} A string contains the image name.
850856
*/
851857

@@ -1535,9 +1541,9 @@ var handlers = {
15351541

15361542
var action = options.movable ? ACTION_MOVE : false;
15371543

1538-
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
1544+
if (options.zoomOnTouch && options.zoomable && Object.keys(pointers).length > 1) {
15391545
action = ACTION_ZOOM;
1540-
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
1546+
} else if (options.slideOnTouch && (event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
15411547
action = ACTION_SWITCH;
15421548
}
15431549

@@ -1743,9 +1749,8 @@ var methods = {
17431749
}
17441750
};
17451751
addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
1746-
// eslint-disable-next-line
17471752

1748-
viewer.offsetWidth;
1753+
viewer.initialOffsetWidth = viewer.offsetWidth;
17491754
addListener(viewer, EVENT_TRANSITION_END, shown, {
17501755
once: true
17511756
});
@@ -2454,9 +2459,8 @@ var methods = {
24542459
addClass(tooltipBox, CLASS_SHOW);
24552460
addClass(tooltipBox, CLASS_FADE);
24562461
addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
2457-
// eslint-disable-next-line
24582462

2459-
tooltipBox.offsetWidth;
2463+
tooltipBox.initialOffsetWidth = tooltipBox.offsetWidth;
24602464
addClass(tooltipBox, CLASS_IN);
24612465
} else {
24622466
addClass(tooltipBox, CLASS_SHOW);
@@ -2538,7 +2542,7 @@ var methods = {
25382542
var img = item.querySelector('img');
25392543
var image = images[i];
25402544

2541-
if (image) {
2545+
if (image && img) {
25422546
if (image.src !== img.src) {
25432547
indexes.push(i);
25442548
}

dist/viewer.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* Viewer.js v1.4.0
2+
* Viewer.js v1.5.0
33
* https://fengyuanchen.github.io/viewerjs
44
*
55
* Copyright 2015-present Chen Fengyuan
66
* Released under the MIT license
77
*
8-
* Date: 2019-10-26T07:09:34.435Z
8+
* Date: 2019-11-23T05:10:21.757Z
99
*/
1010

1111
.viewer-zoom-in::before,

dist/viewer.esm.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* Viewer.js v1.4.0
2+
* Viewer.js v1.5.0
33
* https://fengyuanchen.github.io/viewerjs
44
*
55
* Copyright 2015-present Chen Fengyuan
66
* Released under the MIT license
77
*
8-
* Date: 2019-10-26T07:09:40.792Z
8+
* Date: 2019-11-23T05:10:26.193Z
99
*/
1010

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

8080
if (i % 2) {
81-
ownKeys(source, true).forEach(function (key) {
81+
ownKeys(Object(source), true).forEach(function (key) {
8282
_defineProperty(target, key, source[key]);
8383
});
8484
} else if (Object.getOwnPropertyDescriptors) {
8585
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8686
} else {
87-
ownKeys(source).forEach(function (key) {
87+
ownKeys(Object(source)).forEach(function (key) {
8888
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8989
});
9090
}
@@ -222,7 +222,7 @@ var DEFAULTS = {
222222
zoomable: true,
223223

224224
/**
225-
* Enable to zoom the image by dragging touch.
225+
* Enable to zoom the current image by dragging on the touch screen.
226226
* @type {boolean}
227227
*/
228228
zoomOnTouch: true,
@@ -233,6 +233,12 @@ var DEFAULTS = {
233233
*/
234234
zoomOnWheel: true,
235235

236+
/**
237+
* Enable to slide to the next or previous image by swiping on the touch screen.
238+
* @type {boolean}
239+
*/
240+
slideOnTouch: true,
241+
236242
/**
237243
* Indicate if toggle the image size between its natural size
238244
* and initial size when double click on the image or not.
@@ -843,7 +849,7 @@ function getTransforms(_ref) {
843849
* @param {string} url - The target url.
844850
* @example
845851
* // picture.jpg
846-
* getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
852+
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
847853
* @returns {string} A string contains the image name.
848854
*/
849855

@@ -1533,9 +1539,9 @@ var handlers = {
15331539

15341540
var action = options.movable ? ACTION_MOVE : false;
15351541

1536-
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
1542+
if (options.zoomOnTouch && options.zoomable && Object.keys(pointers).length > 1) {
15371543
action = ACTION_ZOOM;
1538-
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
1544+
} else if (options.slideOnTouch && (event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
15391545
action = ACTION_SWITCH;
15401546
}
15411547

@@ -1741,9 +1747,8 @@ var methods = {
17411747
}
17421748
};
17431749
addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
1744-
// eslint-disable-next-line
17451750

1746-
viewer.offsetWidth;
1751+
viewer.initialOffsetWidth = viewer.offsetWidth;
17471752
addListener(viewer, EVENT_TRANSITION_END, shown, {
17481753
once: true
17491754
});
@@ -2452,9 +2457,8 @@ var methods = {
24522457
addClass(tooltipBox, CLASS_SHOW);
24532458
addClass(tooltipBox, CLASS_FADE);
24542459
addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
2455-
// eslint-disable-next-line
24562460

2457-
tooltipBox.offsetWidth;
2461+
tooltipBox.initialOffsetWidth = tooltipBox.offsetWidth;
24582462
addClass(tooltipBox, CLASS_IN);
24592463
} else {
24602464
addClass(tooltipBox, CLASS_SHOW);
@@ -2536,7 +2540,7 @@ var methods = {
25362540
var img = item.querySelector('img');
25372541
var image = images[i];
25382542

2539-
if (image) {
2543+
if (image && img) {
25402544
if (image.src !== img.src) {
25412545
indexes.push(i);
25422546
}

dist/viewer.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* Viewer.js v1.4.0
2+
* Viewer.js v1.5.0
33
* https://fengyuanchen.github.io/viewerjs
44
*
55
* Copyright 2015-present Chen Fengyuan
66
* Released under the MIT license
77
*
8-
* Date: 2019-10-26T07:09:40.792Z
8+
* Date: 2019-11-23T05:10:26.193Z
99
*/
1010

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

8686
if (i % 2) {
87-
ownKeys(source, true).forEach(function (key) {
87+
ownKeys(Object(source), true).forEach(function (key) {
8888
_defineProperty(target, key, source[key]);
8989
});
9090
} else if (Object.getOwnPropertyDescriptors) {
9191
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
9292
} else {
93-
ownKeys(source).forEach(function (key) {
93+
ownKeys(Object(source)).forEach(function (key) {
9494
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
9595
});
9696
}
@@ -228,7 +228,7 @@
228228
zoomable: true,
229229

230230
/**
231-
* Enable to zoom the image by dragging touch.
231+
* Enable to zoom the current image by dragging on the touch screen.
232232
* @type {boolean}
233233
*/
234234
zoomOnTouch: true,
@@ -239,6 +239,12 @@
239239
*/
240240
zoomOnWheel: true,
241241

242+
/**
243+
* Enable to slide to the next or previous image by swiping on the touch screen.
244+
* @type {boolean}
245+
*/
246+
slideOnTouch: true,
247+
242248
/**
243249
* Indicate if toggle the image size between its natural size
244250
* and initial size when double click on the image or not.
@@ -849,7 +855,7 @@
849855
* @param {string} url - The target url.
850856
* @example
851857
* // picture.jpg
852-
* getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
858+
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
853859
* @returns {string} A string contains the image name.
854860
*/
855861

@@ -1539,9 +1545,9 @@
15391545

15401546
var action = options.movable ? ACTION_MOVE : false;
15411547

1542-
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
1548+
if (options.zoomOnTouch && options.zoomable && Object.keys(pointers).length > 1) {
15431549
action = ACTION_ZOOM;
1544-
} else if ((event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
1550+
} else if (options.slideOnTouch && (event.pointerType === 'touch' || event.type === 'touchstart') && this.isSwitchable()) {
15451551
action = ACTION_SWITCH;
15461552
}
15471553

@@ -1747,9 +1753,8 @@
17471753
}
17481754
};
17491755
addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
1750-
// eslint-disable-next-line
17511756

1752-
viewer.offsetWidth;
1757+
viewer.initialOffsetWidth = viewer.offsetWidth;
17531758
addListener(viewer, EVENT_TRANSITION_END, shown, {
17541759
once: true
17551760
});
@@ -2458,9 +2463,8 @@
24582463
addClass(tooltipBox, CLASS_SHOW);
24592464
addClass(tooltipBox, CLASS_FADE);
24602465
addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
2461-
// eslint-disable-next-line
24622466

2463-
tooltipBox.offsetWidth;
2467+
tooltipBox.initialOffsetWidth = tooltipBox.offsetWidth;
24642468
addClass(tooltipBox, CLASS_IN);
24652469
} else {
24662470
addClass(tooltipBox, CLASS_SHOW);
@@ -2542,7 +2546,7 @@
25422546
var img = item.querySelector('img');
25432547
var image = images[i];
25442548

2545-
if (image) {
2549+
if (image && img) {
25462550
if (image.src !== img.src) {
25472551
indexes.push(i);
25482552
}

0 commit comments

Comments
 (0)