emacroh5lib 1.0.55 → 1.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -54,7 +54,9 @@
|
|
54
54
|
viewerSrc: "",
|
55
55
|
image: null,
|
56
56
|
listDataCache: [],
|
57
|
-
index: 0
|
57
|
+
index: 0,
|
58
|
+
_shrink: 0.4,
|
59
|
+
_enlarge: 0.6,
|
58
60
|
};
|
59
61
|
},
|
60
62
|
props: {
|
@@ -124,6 +126,8 @@
|
|
124
126
|
},
|
125
127
|
},
|
126
128
|
mounted() {
|
129
|
+
this._shrink = 1 - this.shrink
|
130
|
+
this._enlarge = 1 + this.enlarge
|
127
131
|
},
|
128
132
|
methods: {
|
129
133
|
// Global init
|
@@ -185,6 +189,11 @@
|
|
185
189
|
const { width, height } = this.listDataCache[index];
|
186
190
|
this.setStyleByName(this.image, "width", width);
|
187
191
|
this.setStyleByName(this.image, "height", height);
|
192
|
+
|
193
|
+
setTimeout(() => {
|
194
|
+
this.resetZoom();
|
195
|
+
this.resetPosition();
|
196
|
+
}, 100);
|
188
197
|
})
|
189
198
|
|
190
199
|
Promise.race(promises).then((data) => {
|
@@ -195,9 +204,10 @@
|
|
195
204
|
this.setStyleByName(this.image, "width", width);
|
196
205
|
this.setStyleByName(this.image, "height", height);
|
197
206
|
|
198
|
-
setTimeout(() => {
|
199
|
-
|
200
|
-
|
207
|
+
// setTimeout(() => {
|
208
|
+
// this.resetZoom();
|
209
|
+
// this.resetPosition();
|
210
|
+
// }, 100);
|
201
211
|
})
|
202
212
|
|
203
213
|
},
|
@@ -272,8 +282,10 @@
|
|
272
282
|
$this.setStyleByName(image, "width", `${width}px`);
|
273
283
|
$this.setStyleByName(image, "height", `${height}px`);
|
274
284
|
|
275
|
-
this.listDataCache[this.index]
|
276
|
-
|
285
|
+
if (this.listDataCache[this.index]) {
|
286
|
+
this.listDataCache[this.index].width = `${width}px`;
|
287
|
+
this.listDataCache[this.index].height = `${height}px`;
|
288
|
+
}
|
277
289
|
}
|
278
290
|
|
279
291
|
},
|
@@ -415,30 +427,22 @@
|
|
415
427
|
zoom(type) {
|
416
428
|
let image = this.image;
|
417
429
|
|
418
|
-
console.log("报错1", image);
|
419
430
|
let w = +this.getStyleByName(image, "width").split("px")[0];
|
420
431
|
let h = +this.getStyleByName(image, "height").split("px")[0];
|
421
432
|
|
422
433
|
if (h <= 20 && type === "out") return;
|
423
434
|
|
424
435
|
if (type === "out") {
|
425
|
-
|
426
|
-
this.setStyleByName(image, "
|
427
|
-
this.setStyleByName(image, "height", `${h * (1 - this.shrink)}px`);
|
428
|
-
console.log("报错3");
|
436
|
+
this.setStyleByName(image, "width", `${w * this._shrink}px`);
|
437
|
+
this.setStyleByName(image, "height", `${h * this._shrink}px`);
|
429
438
|
} else {
|
430
|
-
|
431
|
-
this.setStyleByName(image, "
|
432
|
-
|
433
|
-
|
439
|
+
this.setStyleByName(image, "width", `${w * this._enlarge}px`);
|
440
|
+
this.setStyleByName(image, "height", `${h * this._enlarge}px`);
|
441
|
+
}
|
442
|
+
if (this.currentData) {
|
443
|
+
this.currentData.width = this.getStyleByName(this.image, "width");
|
444
|
+
this.currentData.height = this.getStyleByName(this.image, "height");
|
434
445
|
}
|
435
|
-
|
436
|
-
console.log("报错6", this.currentData);
|
437
|
-
console.log("报错7", image);
|
438
|
-
console.log("报错8", this.image);
|
439
|
-
|
440
|
-
this.currentData.width = this.getStyleByName(this.image, "width");
|
441
|
-
this.currentData.height = this.getStyleByName(this.image, "height");
|
442
446
|
},
|
443
447
|
|
444
448
|
// FullScreen action
|