emacroh5lib 1.0.53 → 1.0.56

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.53",
3
+ "version": "1.0.56",
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
@@ -356,29 +360,17 @@
356
360
 
357
361
  setTimeout(() => {
358
362
 
359
- let data = {
360
- transform: {
361
- scaleX: "1",
362
- skewY: "0",
363
- translateX: "-50%",
364
- translateY: "-50%",
365
- rotate: "0deg",
366
- },
367
- left: "50%",
368
- top: "50%",
369
- width: `${imageObject.width}px`,
370
- height: `${imageObject.height}px`,
371
- };
372
- if (this.currentData != null && this.currentData.width != null && this.currentData.height != null &&
373
- this.currentData.left != null && this.currentData.top != null && this.currentData.transform != null) {
374
- data = this.currentData
375
- }
363
+ try {
364
+ const data = this.currentData
376
365
 
377
- this.setStyleByName(this.image, "width", data.width);
378
- this.setStyleByName(this.image, "height", data.height);
379
- this.setStyleByName(this.image, "left", data.left);
380
- this.setStyleByName(this.image, "top", data.top);
381
- this.setTransform(this.image, data.transform);
366
+ this.setStyleByName(this.image, "width", data.width);
367
+ this.setStyleByName(this.image, "height", data.height);
368
+ this.setStyleByName(this.image, "left", data.left);
369
+ this.setStyleByName(this.image, "top", data.top);
370
+ this.setTransform(this.image, data.transform);
371
+ } catch (error) {
372
+ console.log("switchAction", error, this.currentData);
373
+ }
382
374
 
383
375
  this.resetZoom();
384
376
  this.resetPosition();
@@ -426,21 +418,29 @@
426
418
  // Zoom action
427
419
  zoom(type) {
428
420
  let image = this.image;
421
+
429
422
  let w = +this.getStyleByName(image, "width").split("px")[0];
430
423
  let h = +this.getStyleByName(image, "height").split("px")[0];
431
424
 
432
425
  if (h <= 20 && type === "out") return;
433
426
 
434
427
  if (type === "out") {
435
- this.setStyleByName(image, "width", `${w * (1 - this.shrink)}px`);
436
- this.setStyleByName(image, "height", `${h * (1 - this.shrink)}px`);
428
+ this.setStyleByName(image, "width", `${w * this._shrink}px`);
429
+ this.setStyleByName(image, "height", `${h * this._shrink}px`);
437
430
  } else {
438
- this.setStyleByName(image, "width", `${w * (1 + this.enlarge)}px`);
439
- this.setStyleByName(image, "height", `${h * (1 + this.enlarge)}px`);
431
+ this.setStyleByName(image, "width", `${w * this._enlarge}px`);
432
+ this.setStyleByName(image, "height", `${h * this._enlarge}px`);
433
+ }
434
+
435
+ // console.log("报错6", this.currentData);
436
+ // console.log("报错7", image);
437
+ // console.log("报错8", this.image);
438
+
439
+ if (this.currentData) {
440
+ this.currentData.width = this.getStyleByName(this.image, "width");
441
+ this.currentData.height = this.getStyleByName(this.image, "height");
440
442
  }
441
443
 
442
- this.currentData.width = this.getStyleByName(this.image, "width");
443
- this.currentData.height = this.getStyleByName(this.image, "height");
444
444
  },
445
445
 
446
446
  // FullScreen action