emacroh5lib 1.0.46 → 1.0.47
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
@@ -227,36 +227,55 @@
|
|
227
227
|
|
228
228
|
// Reset zoom action
|
229
229
|
resetZoom(adaptive = true) {
|
230
|
-
|
230
|
+
const image = this.image;
|
231
|
+
|
232
|
+
let { width, height } = image;
|
233
|
+
if (adaptive) {
|
234
|
+
let rate = 1
|
235
|
+
if (width > height) {
|
236
|
+
rate = width / document.body.clientWidth
|
237
|
+
} else {
|
238
|
+
rate = height / document.body.clientHeight
|
239
|
+
}
|
240
|
+
width = width / rate
|
241
|
+
height = height / rate
|
242
|
+
}
|
231
243
|
|
232
|
-
|
233
|
-
|
244
|
+
this.setStyleByName(image, "width", `${width}px`);
|
245
|
+
this.setStyleByName(image, "height", `${height}px`);
|
234
246
|
|
235
|
-
|
247
|
+
this.listDataCache[this.index].width = `${width}px`;
|
248
|
+
this.listDataCache[this.index].height = `${height}px`;
|
236
249
|
|
237
|
-
imageObject.src = this.list[this.index];
|
238
250
|
|
239
|
-
const $this = this
|
240
|
-
imageObject.onload = () => {
|
241
251
|
|
242
|
-
let { width, height } = imageObject;
|
243
|
-
if (adaptive) {
|
244
|
-
let rate = 1
|
245
|
-
if (width > height) {
|
246
|
-
rate = width / document.body.clientWidth
|
247
|
-
} else {
|
248
|
-
rate = height / document.body.clientHeight
|
249
|
-
}
|
250
|
-
width = width / rate
|
251
|
-
height = height / rate
|
252
|
-
}
|
253
252
|
|
254
|
-
$this.setStyleByName(image, "width", `${width}px`);
|
255
|
-
$this.setStyleByName(image, "height", `${height}px`);
|
256
253
|
|
257
|
-
|
258
|
-
|
259
|
-
|
254
|
+
|
255
|
+
// const imageObject = new Image();
|
256
|
+
// imageObject.src = this.list[this.index];
|
257
|
+
// const $this = this
|
258
|
+
// imageObject.onload = () => {
|
259
|
+
|
260
|
+
// let { width, height } = imageObject;
|
261
|
+
// if (adaptive) {
|
262
|
+
// let rate = 1
|
263
|
+
// if (width > height) {
|
264
|
+
// rate = width / document.body.clientWidth
|
265
|
+
// } else {
|
266
|
+
// rate = height / document.body.clientHeight
|
267
|
+
// }
|
268
|
+
// width = width / rate
|
269
|
+
// height = height / rate
|
270
|
+
// }
|
271
|
+
|
272
|
+
// $this.setStyleByName(image, "width", `${width}px`);
|
273
|
+
// $this.setStyleByName(image, "height", `${height}px`);
|
274
|
+
|
275
|
+
// $this.listDataCache[this.index].width = `${width}px`;
|
276
|
+
// $this.listDataCache[this.index].height = `${height}px`;
|
277
|
+
// }
|
278
|
+
|
260
279
|
},
|
261
280
|
|
262
281
|
// Reset all action
|