emacroh5lib 1.0.39 → 1.0.42
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/dist/emacroh5lib.min.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -4
- package/src/views/ImageViewer/index.vue +35 -12
- package/src/views/TestView/index.vue +14 -12
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -4,11 +4,12 @@ import { EMacro } from "./utilities/File";
|
|
4
4
|
|
5
5
|
import FileViewer from './views/FileViewer/index.vue'
|
6
6
|
import ImageViewer from './views/ImageViewer/index.vue'
|
7
|
+
import VideoViewer from './views/VideoViewer/index.vue'
|
7
8
|
import DragResizeView from './views/DragResizeView/index.vue'
|
8
9
|
import DragView from './views/Draw/index.vue'
|
9
10
|
import MessageBoxTest from "@/components/MessageBoxTest";
|
10
11
|
|
11
|
-
const components = [FileViewer, ImageViewer, DragResizeView];
|
12
|
+
const components = [FileViewer, ImageViewer, VideoViewer, DragResizeView];
|
12
13
|
|
13
14
|
const install = (Vue: any) => {
|
14
15
|
if ((install as any).installed) return;
|
@@ -23,12 +24,12 @@ if (typeof window !== 'undefined' && (window as any).Vue) {
|
|
23
24
|
install((window as any).Vue);
|
24
25
|
}
|
25
26
|
|
26
|
-
|
27
|
+
|
27
28
|
// import HelloWorld from "@/components/HelloWorld.vue";
|
28
29
|
// import HelloWorld from "@/components/index";
|
29
30
|
|
30
|
-
|
31
|
+
|
31
32
|
|
32
33
|
|
33
34
|
export default {}
|
34
|
-
export { EMacro,FileViewer, ImageViewer, DragResizeView }
|
35
|
+
export { EMacro, FileViewer, ImageViewer, VideoViewer, DragResizeView }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="duo-viewer" v-if="show" ref="duoViewer" @click="clickAgent">
|
3
3
|
<div class="duo-viewer-mask">
|
4
|
-
<img ref="duoViewerImage" :src="realSrc" :alt="alt" class="duo-viewer-mask__image"/>
|
4
|
+
<img ref="duoViewerImage" :src="realSrc" :alt="alt" class="duo-viewer-mask__image" />
|
5
5
|
</div>
|
6
6
|
<div class="duo-viewer-footer">
|
7
7
|
<div class="duo-viewer-footer__title">{{ realName }}</div>
|
@@ -178,7 +178,7 @@
|
|
178
178
|
|
179
179
|
$this.image = $this.$refs["duoViewerImage"];
|
180
180
|
$this.initDrag();
|
181
|
-
this.$emit("loadComplete");
|
181
|
+
$this.$emit("loadComplete");
|
182
182
|
const { width, height } = $this.listDataCache[index];
|
183
183
|
$this.setStyleByName($this.image, "width", width);
|
184
184
|
$this.setStyleByName($this.image, "height", height);
|
@@ -191,13 +191,17 @@
|
|
191
191
|
const { width, height } = $this.listDataCache[index];
|
192
192
|
$this.setStyleByName($this.image, "width", width);
|
193
193
|
$this.setStyleByName($this.image, "height", height);
|
194
|
+
|
195
|
+
setTimeout(() => {
|
196
|
+
$this.resetZoom();
|
197
|
+
}, 100);
|
194
198
|
})
|
195
199
|
|
196
200
|
},
|
197
201
|
// Reset position
|
198
202
|
resetPosition() {
|
199
|
-
let image = this.image
|
200
|
-
|
203
|
+
let image = this.image;
|
204
|
+
let oldTransform = this.getCurrentTransform(image);
|
201
205
|
|
202
206
|
this.setStyleByName(image, "top", "50%");
|
203
207
|
this.setStyleByName(image, "left", "50%");
|
@@ -219,13 +223,26 @@
|
|
219
223
|
},
|
220
224
|
|
221
225
|
// Reset zoom action
|
222
|
-
resetZoom() {
|
226
|
+
resetZoom(adaptive = true) {
|
223
227
|
let image = this.image;
|
224
228
|
const imageObject = new Image();
|
225
229
|
|
226
230
|
imageObject.src = this.list[this.index];
|
227
231
|
|
228
|
-
|
232
|
+
let { width, height } = imageObject;
|
233
|
+
|
234
|
+
if (adaptive) {
|
235
|
+
let rate = 1
|
236
|
+
if (width > height) {
|
237
|
+
rate = width / document.body.clientWidth
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
rate = height / document.body.clientHeight
|
241
|
+
}
|
242
|
+
|
243
|
+
width = width / rate
|
244
|
+
height = height / rate
|
245
|
+
}
|
229
246
|
|
230
247
|
this.setStyleByName(image, "width", `${width}px`);
|
231
248
|
this.setStyleByName(image, "height", `${height}px`);
|
@@ -310,11 +327,17 @@
|
|
310
327
|
}
|
311
328
|
this.judgeThumbnailListMove(lastIndex, this.index);
|
312
329
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
330
|
+
setTimeout(() => {
|
331
|
+
|
332
|
+
this.setStyleByName(this.image, "width", this.currentData.width);
|
333
|
+
this.setStyleByName(this.image, "height", this.currentData.height);
|
334
|
+
this.setStyleByName(this.image, "left", this.currentData.left);
|
335
|
+
this.setStyleByName(this.image, "top", this.currentData.top);
|
336
|
+
this.setTransform(this.image, this.currentData.transform);
|
337
|
+
|
338
|
+
this.resetZoom();
|
339
|
+
this.resetPosition();
|
340
|
+
}, 100);
|
318
341
|
},
|
319
342
|
// To judge thumbnail list move
|
320
343
|
judgeThumbnailListMove(lastIndex, index) {
|
@@ -524,7 +547,7 @@
|
|
524
547
|
this.zoom("out");
|
525
548
|
break;
|
526
549
|
case "one-to-one":
|
527
|
-
this.resetZoom();
|
550
|
+
this.resetZoom(false);
|
528
551
|
break;
|
529
552
|
case "prev":
|
530
553
|
this.switchAction("prev");
|
@@ -68,16 +68,18 @@ export default class TestView extends Vue {
|
|
68
68
|
|
69
69
|
public currentIndex: Number = 0; // 打开图片查看器时,需要定位到的图片的索引
|
70
70
|
public srcList: Array<String> = [
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
"
|
79
|
-
"http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001
|
80
|
-
"http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\
|
71
|
+
"http://121.228.113.68:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
|
72
|
+
"http://121.228.113.68:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\060 广西电子商务公共服务平台大数据中心.png",
|
73
|
+
"https://scpic.chinaz.net/files/pic/pic9/202203/apic39703.jpg",
|
74
|
+
"https://scpic.chinaz.net/files/pic/pic9/202005/zzpic24899.jpg",
|
75
|
+
"https://scpic.chinaz.net/files/pic/pic9/202109/bpic24244.jpg",
|
76
|
+
"https://scpic.chinaz.net/files/pic/pic9/202110/hpic4529.jpg",
|
77
|
+
"https://scpic.chinaz.net/files/pic/pic9/201912/zzpic22106.jpg",
|
78
|
+
"https://scpic.chinaz.net/files/pic/pic9/202202/apic38580.jpg",
|
79
|
+
// "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4",
|
80
|
+
// "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\ker.mp4",
|
81
|
+
// "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\video2.mp4",
|
82
|
+
// "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
|
81
83
|
] // 图片查看器数据集
|
82
84
|
|
83
85
|
public src: String = "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4"
|
@@ -89,8 +91,8 @@ export default class TestView extends Vue {
|
|
89
91
|
public listHeight = 0;
|
90
92
|
|
91
93
|
public handleOpen() {
|
92
|
-
|
93
|
-
this.showVideoViewer = true;
|
94
|
+
this.showViewer = true;
|
95
|
+
// this.showVideoViewer = true;
|
94
96
|
}
|
95
97
|
public openCallback() { } // 打开时的回调
|
96
98
|
public closeCallback() { } // 关闭时的回调
|