emacroh5lib 1.0.54 → 1.0.57

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emacroh5lib",
3
- "version": "1.0.54",
3
+ "version": "1.0.57",
4
4
  "description": "EMacro前端组件库",
5
5
  "main": "dist/emacroh5lib.min.js",
6
6
  "scripts": {
@@ -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
@@ -196,8 +200,11 @@
196
200
  this.setStyleByName(this.image, "height", height);
197
201
 
198
202
  setTimeout(() => {
199
- this.resetZoom();
200
- }, 100);
203
+ this.resetZoom(false);
204
+ setTimeout(() => {
205
+ this.resetZoom();
206
+ }, 200);
207
+ }, 0);
201
208
  })
202
209
 
203
210
  },
@@ -414,21 +421,23 @@
414
421
  // Zoom action
415
422
  zoom(type) {
416
423
  let image = this.image;
424
+
417
425
  let w = +this.getStyleByName(image, "width").split("px")[0];
418
426
  let h = +this.getStyleByName(image, "height").split("px")[0];
419
427
 
420
428
  if (h <= 20 && type === "out") return;
421
429
 
422
430
  if (type === "out") {
423
- this.setStyleByName(image, "width", `${w * (1 - this.shrink)}px`);
424
- this.setStyleByName(image, "height", `${h * (1 - this.shrink)}px`);
431
+ this.setStyleByName(image, "width", `${w * this._shrink}px`);
432
+ this.setStyleByName(image, "height", `${h * this._shrink}px`);
425
433
  } else {
426
- this.setStyleByName(image, "width", `${w * (1 + this.enlarge)}px`);
427
- this.setStyleByName(image, "height", `${h * (1 + this.enlarge)}px`);
434
+ this.setStyleByName(image, "width", `${w * this._enlarge}px`);
435
+ this.setStyleByName(image, "height", `${h * this._enlarge}px`);
436
+ }
437
+ if (this.currentData) {
438
+ this.currentData.width = this.getStyleByName(this.image, "width");
439
+ this.currentData.height = this.getStyleByName(this.image, "height");
428
440
  }
429
-
430
- this.currentData.width = this.getStyleByName(this.image, "width");
431
- this.currentData.height = this.getStyleByName(this.image, "height");
432
441
  },
433
442
 
434
443
  // FullScreen action