Skip to content

Commit

Permalink
build: release 1.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Aug 1, 2021
1 parent fbe58e1 commit 7754091
Show file tree
Hide file tree
Showing 12 changed files with 923 additions and 650 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.10.1 (Aug 1, 2021)

- Check if the active item exists to avoid TypeError (#491).
- Compute nav item gutter dynamically (#487).
Expand Down
44 changes: 25 additions & 19 deletions dist/viewer.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.10.0
* Viewer.js v1.10.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2021-06-12T07:57:10.970Z
* Date: 2021-08-01T13:35:49.731Z
*/

'use strict';
Expand Down Expand Up @@ -490,15 +490,15 @@ function forEach(data, callback) {
if (Array.isArray(data) || isNumber(data.length)
/* array-like */
) {
var length = data.length;
var i;
var length = data.length;
var i;

for (i = 0; i < length; i += 1) {
if (callback.call(data, data[i], i, data) === false) {
break;
}
for (i = 0; i < length; i += 1) {
if (callback.call(data, data[i], i, data) === false) {
break;
}
} else if (isObject(data)) {
}
} else if (isObject(data)) {
Object.keys(data).forEach(function (key) {
callback.call(data, data[key], key, data);
});
Expand Down Expand Up @@ -1148,16 +1148,18 @@ var render = {
});
}
},
renderList: function renderList(index) {
var i = index || this.index;
var width = this.items[i].offsetWidth || 30;
var outerWidth = width + 1; // 1 pixel of `margin-left` width
// Place the active item in the center of the screen
renderList: function renderList() {
var index = this.index;
var item = this.items[index];
var next = item.nextElementSibling;
var gutter = parseInt(window.getComputedStyle(next || item).marginLeft, 10);
var offsetWidth = item.offsetWidth;
var outerWidth = offsetWidth + gutter; // Place the active item in the center of the screen

setStyle(this.list, assign({
width: outerWidth * this.length
width: outerWidth * this.length - gutter
}, getTransforms({
translateX: (this.viewerData.width - width) / 2 - outerWidth * i
translateX: (this.viewerData.width - offsetWidth) / 2 - outerWidth * index
})));
},
resetList: function resetList() {
Expand Down Expand Up @@ -1457,7 +1459,7 @@ var handlers = {
removeClass(this.canvas, CLASS_LOADING);
}

image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:absolute;' + 'width:0;';
image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:relative;' + 'width:0;';
this.initImage(function () {
toggleClass(image, CLASS_MOVE, options.movable);
toggleClass(image, CLASS_TRANSITION, options.transition);
Expand Down Expand Up @@ -2014,8 +2016,12 @@ var methods = {
}

var activeItem = this.items[this.index];
removeClass(activeItem, CLASS_ACTIVE);
activeItem.removeAttribute('aria-selected');

if (activeItem) {
removeClass(activeItem, CLASS_ACTIVE);
activeItem.removeAttribute('aria-selected');
}

addClass(item, CLASS_ACTIVE);
item.setAttribute('aria-selected', true);

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.10.0
* Viewer.js v1.10.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2021-06-12T07:57:06.776Z
* Date: 2021-08-01T13:35:44.576Z
*/

.viewer-zoom-in::before,
Expand Down
46 changes: 26 additions & 20 deletions dist/viewer.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.10.0
* Viewer.js v1.10.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2021-06-12T07:57:10.970Z
* Date: 2021-08-01T13:35:49.731Z
*/

function ownKeys(object, enumerableOnly) {
Expand Down Expand Up @@ -488,15 +488,15 @@ function forEach(data, callback) {
if (Array.isArray(data) || isNumber(data.length)
/* array-like */
) {
var length = data.length;
var i;
var length = data.length;
var i;

for (i = 0; i < length; i += 1) {
if (callback.call(data, data[i], i, data) === false) {
break;
}
for (i = 0; i < length; i += 1) {
if (callback.call(data, data[i], i, data) === false) {
break;
}
} else if (isObject(data)) {
}
} else if (isObject(data)) {
Object.keys(data).forEach(function (key) {
callback.call(data, data[key], key, data);
});
Expand Down Expand Up @@ -1146,16 +1146,18 @@ var render = {
});
}
},
renderList: function renderList(index) {
var i = index || this.index;
var width = this.items[i].offsetWidth || 30;
var outerWidth = width + 1; // 1 pixel of `margin-left` width
// Place the active item in the center of the screen
renderList: function renderList() {
var index = this.index;
var item = this.items[index];
var next = item.nextElementSibling;
var gutter = parseInt(window.getComputedStyle(next || item).marginLeft, 10);
var offsetWidth = item.offsetWidth;
var outerWidth = offsetWidth + gutter; // Place the active item in the center of the screen

setStyle(this.list, assign({
width: outerWidth * this.length
width: outerWidth * this.length - gutter
}, getTransforms({
translateX: (this.viewerData.width - width) / 2 - outerWidth * i
translateX: (this.viewerData.width - offsetWidth) / 2 - outerWidth * index
})));
},
resetList: function resetList() {
Expand Down Expand Up @@ -1455,7 +1457,7 @@ var handlers = {
removeClass(this.canvas, CLASS_LOADING);
}

image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:absolute;' + 'width:0;';
image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:relative;' + 'width:0;';
this.initImage(function () {
toggleClass(image, CLASS_MOVE, options.movable);
toggleClass(image, CLASS_TRANSITION, options.transition);
Expand Down Expand Up @@ -2012,8 +2014,12 @@ var methods = {
}

var activeItem = this.items[this.index];
removeClass(activeItem, CLASS_ACTIVE);
activeItem.removeAttribute('aria-selected');

if (activeItem) {
removeClass(activeItem, CLASS_ACTIVE);
activeItem.removeAttribute('aria-selected');
}

addClass(item, CLASS_ACTIVE);
item.setAttribute('aria-selected', true);

Expand Down Expand Up @@ -3512,4 +3518,4 @@ var Viewer = /*#__PURE__*/function () {

assign(Viewer.prototype, render, events, handlers, methods, others);

export default Viewer;
export { Viewer as default };
44 changes: 25 additions & 19 deletions dist/viewer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.10.0
* Viewer.js v1.10.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2021-06-12T07:57:10.970Z
* Date: 2021-08-01T13:35:49.731Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -494,15 +494,15 @@
if (Array.isArray(data) || isNumber(data.length)
/* array-like */
) {
var length = data.length;
var i;
var length = data.length;
var i;

for (i = 0; i < length; i += 1) {
if (callback.call(data, data[i], i, data) === false) {
break;
}
for (i = 0; i < length; i += 1) {
if (callback.call(data, data[i], i, data) === false) {
break;
}
} else if (isObject(data)) {
}
} else if (isObject(data)) {
Object.keys(data).forEach(function (key) {
callback.call(data, data[key], key, data);
});
Expand Down Expand Up @@ -1152,16 +1152,18 @@
});
}
},
renderList: function renderList(index) {
var i = index || this.index;
var width = this.items[i].offsetWidth || 30;
var outerWidth = width + 1; // 1 pixel of `margin-left` width
// Place the active item in the center of the screen
renderList: function renderList() {
var index = this.index;
var item = this.items[index];
var next = item.nextElementSibling;
var gutter = parseInt(window.getComputedStyle(next || item).marginLeft, 10);
var offsetWidth = item.offsetWidth;
var outerWidth = offsetWidth + gutter; // Place the active item in the center of the screen

setStyle(this.list, assign({
width: outerWidth * this.length
width: outerWidth * this.length - gutter
}, getTransforms({
translateX: (this.viewerData.width - width) / 2 - outerWidth * i
translateX: (this.viewerData.width - offsetWidth) / 2 - outerWidth * index
})));
},
resetList: function resetList() {
Expand Down Expand Up @@ -1461,7 +1463,7 @@
removeClass(this.canvas, CLASS_LOADING);
}

image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:absolute;' + 'width:0;';
image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:relative;' + 'width:0;';
this.initImage(function () {
toggleClass(image, CLASS_MOVE, options.movable);
toggleClass(image, CLASS_TRANSITION, options.transition);
Expand Down Expand Up @@ -2018,8 +2020,12 @@
}

var activeItem = this.items[this.index];
removeClass(activeItem, CLASS_ACTIVE);
activeItem.removeAttribute('aria-selected');

if (activeItem) {
removeClass(activeItem, CLASS_ACTIVE);
activeItem.removeAttribute('aria-selected');
}

addClass(item, CLASS_ACTIVE);
item.setAttribute('aria-selected', true);

Expand Down
4 changes: 2 additions & 2 deletions dist/viewer.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/viewer.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/css/viewer.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.10.0
* Viewer.js v1.10.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2021-06-12T07:57:06.776Z
* Date: 2021-08-01T13:35:44.576Z
*/

.viewer-zoom-in::before,
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="container">
<div class="row">
<div class="col-md">
<h1>Viewer.js <small class="h6">v1.10.0</small></h1>
<h1>Viewer.js <small class="h6">v1.10.1</small></h1>
<p class="lead">JavaScript image viewer.</p>
</div>
<div class="col-md">
Expand Down
Loading

0 comments on commit 7754091

Please sign in to comment.