|
@@ -175,7 +175,7 @@
|
|
|
|
|
|
//var BUTTONS = ['zoom-in', 'zoom-out', 'one-to-one', 'reset', 'prev', 'play', 'next', 'rotate-left', 'rotate-right', 'flip-horizontal', 'flip-vertical'];
|
|
|
//plays
|
|
|
- var BUTTONS = [ 'one-to-ones','enlarge','zoom-ins', 'zoom-outs', 'prevs', 'nexts',];
|
|
|
+ var BUTTONS = [ 'one-to-ones','one-to-ones2','enlarge','zoom-ins', 'zoom-outs', 'prevs', 'nexts',];
|
|
|
|
|
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
|
return typeof obj;
|
|
@@ -1002,7 +1002,6 @@
|
|
|
var viewerHeight = Math.max(viewerData.height - footerHeight, footerHeight);
|
|
|
var oldImageData = this.imageData || {};
|
|
|
var sizingImage = void 0;
|
|
|
-
|
|
|
this.imageInitializing = {
|
|
|
abort: function abort() {
|
|
|
sizingImage.onload = null;
|
|
@@ -1014,6 +1013,7 @@
|
|
|
var width = viewerWidth;
|
|
|
var height = viewerHeight;
|
|
|
|
|
|
+
|
|
|
_this2.imageInitializing = false;
|
|
|
|
|
|
if (viewerHeight * aspectRatio > viewerWidth) {
|
|
@@ -1149,6 +1149,7 @@
|
|
|
imageData = this.imageData;
|
|
|
|
|
|
var action = getData(target, 'action');
|
|
|
+
|
|
|
switch (action) {
|
|
|
case 'mix':
|
|
|
if (this.played) {
|
|
@@ -1191,6 +1192,7 @@
|
|
|
break;
|
|
|
|
|
|
case 'one-to-ones':
|
|
|
+ case 'one-to-ones2':
|
|
|
this.normal();
|
|
|
break;
|
|
|
|
|
@@ -1199,6 +1201,9 @@
|
|
|
this.toggle();
|
|
|
break;
|
|
|
|
|
|
+ case 'toolbar':
|
|
|
+ break;
|
|
|
+
|
|
|
//case 'rotate-left':
|
|
|
// this.rotate(-90);
|
|
|
// break;
|
|
@@ -1220,6 +1225,16 @@
|
|
|
this.stop();
|
|
|
return;
|
|
|
}
|
|
|
+ if (target.className ==""
|
|
|
+ ||target.className =="viewer-toolbar"
|
|
|
+ ||target.className =="viewer-footer"
|
|
|
+ ||target.className =="viewer-title")
|
|
|
+ {
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
this.hide();
|
|
|
}
|
|
|
},
|
|
@@ -1438,7 +1453,11 @@
|
|
|
if (action === ACTION_MOVE && options.transition && hasClass(image, CLASS_TRANSITION)) {
|
|
|
removeClass(image, CLASS_TRANSITION);
|
|
|
}
|
|
|
+ if (Object.keys(pointers).length > 1|| action===ACTION_SWITCH) {
|
|
|
|
|
|
+ }else if ((e.pointerType === 'touch' || e.type === 'touchmove') && this.isSwitchable2()) {
|
|
|
+ this.action = ACTION_SWITCH;
|
|
|
+ }
|
|
|
this.change(e);
|
|
|
},
|
|
|
pointerup: function pointerup(e) {
|
|
@@ -1463,6 +1482,7 @@
|
|
|
}
|
|
|
|
|
|
this.action = false;
|
|
|
+
|
|
|
},
|
|
|
resize: function resize() {
|
|
|
var _this2 = this;
|
|
@@ -1757,31 +1777,23 @@
|
|
|
|
|
|
// Center current item
|
|
|
this.renderList();
|
|
|
-
|
|
|
// Clear title
|
|
|
// title.innerHTML = '';
|
|
|
title.textContent = (_this.index+1)+'/'+options.totalCount;
|
|
|
+ if (this.dealOriginal.indexOf(url)>-1)
|
|
|
+ {
|
|
|
+ this.toolbar.querySelector(".viewer-one-to-ones2").style.display='block';
|
|
|
+ this.toolbar.querySelector(".viewer-one-to-ones").style.display='none';
|
|
|
+ }else {
|
|
|
+ this.toolbar.querySelector(".viewer-one-to-ones").style.display='block';
|
|
|
+ this.toolbar.querySelector(".viewer-one-to-ones2").style.display='none';
|
|
|
+ }
|
|
|
// Generate title after viewed
|
|
|
var onViewed = function onViewed() {
|
|
|
// var imageData = _this.imageData;
|
|
|
image.style.display='block';
|
|
|
// title.textContent = alt + ' (' + imageData.naturalWidth + ' \xD7 ' + imageData.naturalHeight + ')';
|
|
|
-
|
|
|
};
|
|
|
-
|
|
|
- var icon_url='url('+document.getElementById("icon_url").innerHTML + ')';
|
|
|
- if (this.dealOriginal.indexOf(url)>-1)
|
|
|
- {
|
|
|
- icon_url=icon_url + ' -530px -12px no-repeat';
|
|
|
- this.toolbar.querySelector(".viewer-one-to-ones").style.background=icon_url;
|
|
|
- }else {
|
|
|
- icon_url=icon_url + ' -471px -12px no-repeat';
|
|
|
- this.toolbar.querySelector(".viewer-one-to-ones").style.background=icon_url;
|
|
|
-
|
|
|
- }
|
|
|
- this.toolbar.querySelector(".viewer-one-to-ones").style.transform='scale(0.7)';
|
|
|
-
|
|
|
-
|
|
|
var onLoad = void 0;
|
|
|
addListener(element, EVENT_VIEWED, onViewed, {
|
|
|
once: true
|
|
@@ -1828,7 +1840,6 @@
|
|
|
return this;
|
|
|
},
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* View the previous image
|
|
|
* @param {boolean} [loop=false] - Indicate if view the last one
|
|
@@ -1842,8 +1853,11 @@
|
|
|
|
|
|
if (index < 0) {
|
|
|
index = loop ? this.length - 1 : 0;
|
|
|
+ swal("当前是第一个", {
|
|
|
+ buttons: false,
|
|
|
+ timer: 3000,
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
this.view(index);
|
|
|
return this;
|
|
|
},
|
|
@@ -1861,6 +1875,10 @@
|
|
|
var maxIndex =options.totalCount-1; //this.length - 1;
|
|
|
var index = this.index + 1;
|
|
|
if (index > maxIndex) {
|
|
|
+ swal("当前是最后一个", {
|
|
|
+ buttons: false,
|
|
|
+ timer: 3000,
|
|
|
+ });
|
|
|
index = loop ? 0 : maxIndex;
|
|
|
}else {
|
|
|
if (index>=this.length - 1)
|
|
@@ -2662,6 +2680,7 @@
|
|
|
}
|
|
|
},
|
|
|
change: function change(e) {
|
|
|
+
|
|
|
var options = this.options,
|
|
|
pointers = this.pointers;
|
|
|
|
|
@@ -2693,9 +2712,7 @@
|
|
|
this.next(options.loop);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
break;
|
|
|
-
|
|
|
default:
|
|
|
}
|
|
|
|
|
@@ -2708,9 +2725,37 @@
|
|
|
isSwitchable: function isSwitchable() {
|
|
|
var imageData = this.imageData,
|
|
|
viewerData = this.viewerData;
|
|
|
-
|
|
|
-
|
|
|
- return this.length > 1 && imageData.left >= 0 && imageData.top >= 0 && imageData.width <= viewerData.width && imageData.height <= viewerData.height;
|
|
|
+ return this.length > 1&&imageData.width <= viewerData.width && imageData.height <= viewerData.height;
|
|
|
+ },
|
|
|
+ isSwitchable2: function isSwitchable2() {
|
|
|
+ var imageData = this.imageData,
|
|
|
+ image = this.image,
|
|
|
+ viewerData = this.viewerData;
|
|
|
+ // return this.length > 1&& imageData.left >= 0&& imageData.top >= 0 && imageData.width <= viewerData.width && imageData.height <= viewerData.height;
|
|
|
+ if (this.length <= 1)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (imageData.width <= viewerData.width&&imageData.height <= viewerData.height)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ var marginLeft=parseInt(image.style.marginLeft);
|
|
|
+ var nextWidth=parseInt(viewerData.width/3);
|
|
|
+ if (marginLeft>0)
|
|
|
+ {
|
|
|
+ if (marginLeft>nextWidth)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }else if (marginLeft<0)
|
|
|
+ {
|
|
|
+ if (parseInt(viewerData.width)-(parseInt(image.style.width)+marginLeft)>nextWidth)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -2919,7 +2964,6 @@
|
|
|
var zoomButtons = BUTTONS.slice(0, 3);
|
|
|
var rotateButtons = BUTTONS.slice(7, 9);
|
|
|
var scaleButtons = BUTTONS.slice(9);
|
|
|
-
|
|
|
if (!custom) {
|
|
|
addClass(toolbar, getResponsiveClass(options.toolbar));
|
|
|
}
|