@shijiu/jsview-vue 2.2.426-test.0 → 2.3.151-test.0
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/bin/browser/BrowserAudio.vue.mjs +4 -1
- package/bin/jsview-vue-common.mjs +1 -1
- package/bin/jsview-vue.mjs +9771 -7511
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +21 -1
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +8 -1
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +10 -7
- package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
- package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
- package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
- package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
- package/bin/types/utils/JsViewVueTools/ForgeHandles.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +43 -1
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +3 -3
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.d.ts +7 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +15 -2
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +2 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +4 -0
- package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
- package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
- package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
- package/bin/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +11 -0
- package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
- package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +2 -1
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
- package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
- package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
- package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +72 -0
- package/bin/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +26 -0
- package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
- package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +112 -0
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +142 -0
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +3 -1
- package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +4 -3
- package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/index.d.ts +4 -1
- package/package.json +1 -1
- package/utils/JsViewEngineWidget/CheckType.js +3 -3
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +27 -1
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
- package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
- package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +97 -13
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +876 -412
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +43 -2
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +38 -26
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +144 -73
- package/utils/JsViewEngineWidget/WidgetCommon.ts +12 -0
- package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +4 -0
- package/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue +13 -13
- package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
- package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
- package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
- package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +50 -32
- package/utils/JsViewVueTools/FeatureActive.ts +2 -1
- package/utils/JsViewVueTools/ForgeHandles.ts +5 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +109 -4
- package/utils/JsViewVueTools/JsvTextTools.ts +3 -1
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +15 -12
- package/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.ts +36 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +24 -3
- package/utils/JsViewVueTools/JsvTextureStore/Store.ts +33 -21
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +56 -41
- package/utils/JsViewVueTools/index.js +0 -1
- package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
- package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
- package/utils/JsViewVueWidget/JsvDashPath.vue +150 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +153 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
- package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +26 -22
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
- package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +1 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
- package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -2
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue +108 -0
- package/utils/JsViewVueWidget/JsvSoundPool.js +75 -12
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
- package/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue +543 -0
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +3 -3
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue +644 -0
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +56 -50
- package/utils/JsViewVueWidget/index.js +4 -1
- package/bin/browser/BrowserApic.vue.mjs +0 -114
- package/bin/browser/BrowserApic2.vue.mjs +0 -108
- package/bin/browser/BrowserApicLib.mjs +0 -431
- package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
- package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
|
@@ -84,6 +84,11 @@ const TexAlignAnchor = {
|
|
|
84
84
|
};
|
|
85
85
|
export { TexAlignAnchor };
|
|
86
86
|
|
|
87
|
+
const STATE_IDLE = 0;
|
|
88
|
+
const STATE_RUNNING = 1;
|
|
89
|
+
const STATE_PAUSED = 2;
|
|
90
|
+
const STATE_END = 3;
|
|
91
|
+
|
|
87
92
|
export default {
|
|
88
93
|
props: {
|
|
89
94
|
src: String,
|
|
@@ -125,10 +130,15 @@ export default {
|
|
|
125
130
|
},
|
|
126
131
|
deep: true,
|
|
127
132
|
},
|
|
133
|
+
transform: {
|
|
134
|
+
handler(newValue, oldValue) {
|
|
135
|
+
this.innerView.ResetTextureCssTransform(newValue, this.transformOrigin);
|
|
136
|
+
},
|
|
137
|
+
},
|
|
128
138
|
},
|
|
129
139
|
setup() {
|
|
130
140
|
return {
|
|
131
|
-
|
|
141
|
+
runningState: STATE_IDLE, // 0:未开始, 1:运行中, 2:暂停, 3:正常结束
|
|
132
142
|
innerViewId: -1,
|
|
133
143
|
};
|
|
134
144
|
},
|
|
@@ -244,8 +254,11 @@ export default {
|
|
|
244
254
|
return new Forge.LayoutView(texture_set);
|
|
245
255
|
},
|
|
246
256
|
|
|
247
|
-
_onAnimationEnd() {
|
|
248
|
-
|
|
257
|
+
_onAnimationEnd(normal_end) {
|
|
258
|
+
if (normal_end) {
|
|
259
|
+
this.runningState = STATE_END;
|
|
260
|
+
}
|
|
261
|
+
this.onAnimationEnd?.(normal_end);
|
|
249
262
|
},
|
|
250
263
|
|
|
251
264
|
_updateTexCoord() {
|
|
@@ -273,9 +286,35 @@ export default {
|
|
|
273
286
|
}
|
|
274
287
|
},
|
|
275
288
|
|
|
276
|
-
|
|
277
|
-
if (
|
|
278
|
-
|
|
289
|
+
_buildAnimation(a) {
|
|
290
|
+
if (a) {
|
|
291
|
+
let anim = new Forge.CssKeyframeAnimation(
|
|
292
|
+
"@keyframes texAnimDef" + a,
|
|
293
|
+
this.duration,
|
|
294
|
+
Forge.Easing.str2Easing(this.easing),
|
|
295
|
+
1,
|
|
296
|
+
1
|
|
297
|
+
);
|
|
298
|
+
anim.EnableDelay(this.delay).SetRepeat(this.repeat);
|
|
299
|
+
anim.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
|
|
300
|
+
anim.SetAnimationListener(
|
|
301
|
+
new Forge.AnimationListener(null, this._onAnimationEnd, null)
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
return anim;
|
|
305
|
+
} else {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
start(customAnim) {
|
|
311
|
+
if (this.innerView) {
|
|
312
|
+
const a = customAnim ?? this.animation;
|
|
313
|
+
let anim = this._buildAnimation(a);
|
|
314
|
+
if (anim) {
|
|
315
|
+
this.runningState = STATE_RUNNING;
|
|
316
|
+
this.innerView.StartTextureAnimation(anim);
|
|
317
|
+
}
|
|
279
318
|
}
|
|
280
319
|
},
|
|
281
320
|
|
|
@@ -311,9 +350,9 @@ export default {
|
|
|
311
350
|
);
|
|
312
351
|
// 1.1 兼容border转为decorate
|
|
313
352
|
let decorate = this.$props.decorate;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
353
|
+
if (this.$props.borderRadius) {
|
|
354
|
+
decorate = this._readRadius(this.$props.borderRadius);
|
|
355
|
+
}
|
|
317
356
|
|
|
318
357
|
// 2.创建view
|
|
319
358
|
this.innerView = this._createForgeView(view_texture, decorate);
|
|
@@ -326,26 +365,7 @@ export default {
|
|
|
326
365
|
}
|
|
327
366
|
this._updateTexCoord();
|
|
328
367
|
|
|
329
|
-
// 4
|
|
330
|
-
if (this.animation) {
|
|
331
|
-
this.forgeAnimation = new Forge.CssKeyframeAnimation(
|
|
332
|
-
"@keyframes texAnimDef" + this.animation,
|
|
333
|
-
this.duration,
|
|
334
|
-
null,
|
|
335
|
-
1,
|
|
336
|
-
1
|
|
337
|
-
);
|
|
338
|
-
this.forgeAnimation.EnableDelay(this.delay).SetRepeat(this.repeat);
|
|
339
|
-
this.forgeAnimation.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
|
|
340
|
-
this.forgeAnimation.SetAnimationListener(
|
|
341
|
-
new Forge.AnimationListener(null, this._onAnimationEnd, null)
|
|
342
|
-
);
|
|
343
|
-
} else {
|
|
344
|
-
this.forgeAnimation = null;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// 5. inner view标准处理
|
|
348
|
-
|
|
368
|
+
// 4. inner view标准处理
|
|
349
369
|
this.innerViewId = Forge.sViewStore.add(new Forge.ViewInfo(this.innerView));
|
|
350
370
|
},
|
|
351
371
|
beforeUnmount() {
|
|
@@ -360,33 +380,19 @@ export default {
|
|
|
360
380
|
}
|
|
361
381
|
},
|
|
362
382
|
activated() {
|
|
363
|
-
if (this.innerView) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
this.duration,
|
|
368
|
-
null,
|
|
369
|
-
1,
|
|
370
|
-
1
|
|
371
|
-
);
|
|
372
|
-
this.forgeAnimation.EnableDelay(this.delay).SetRepeat(this.repeat);
|
|
373
|
-
this.forgeAnimation.Enable(
|
|
374
|
-
Forge.AnimationEnable.ReleaseAfterEndCallback
|
|
375
|
-
);
|
|
376
|
-
this.forgeAnimation.SetAnimationListener(
|
|
377
|
-
new Forge.AnimationListener(null, this._onAnimationEnd, null)
|
|
378
|
-
);
|
|
379
|
-
this.innerView.StartTextureAnimation(this.forgeAnimation);
|
|
380
|
-
} else {
|
|
381
|
-
this.forgeAnimation = null;
|
|
382
|
-
}
|
|
383
|
+
if (this.innerView && this.runningState == STATE_PAUSED) {
|
|
384
|
+
// 动画未正常结束,重新开始动画
|
|
385
|
+
let anim = this._buildAnimation(this.animation);
|
|
386
|
+
this.innerView.StartTextureAnimation(anim); // pause状态,一定有值
|
|
383
387
|
}
|
|
384
388
|
},
|
|
385
389
|
deactivated() {
|
|
386
390
|
if (this.innerView) {
|
|
387
391
|
this.innerView.StopTextureAnimation();
|
|
392
|
+
if (this.runningState == STATE_RUNNING) {
|
|
393
|
+
this.runningState = STATE_PAUSED;
|
|
394
|
+
}
|
|
388
395
|
}
|
|
389
|
-
this.forgeAnimation = null;
|
|
390
396
|
},
|
|
391
397
|
};
|
|
392
398
|
</script>
|
|
@@ -20,7 +20,7 @@ export {
|
|
|
20
20
|
export { default as JsvQrcode } from "./JsvQrcode/JsvQrcode.vue";
|
|
21
21
|
export { default as JsvSpray } from "./JsvSpray/JsvSpray.vue"
|
|
22
22
|
export * from "./JsvSpriteAnim";
|
|
23
|
-
export {
|
|
23
|
+
export { JsvSwiper, JsvSwiper2, JsvSmoothSwiper } from "./JsvSwiper";
|
|
24
24
|
export { default as JsvSwiper3D } from "./JsvSwiper3D";
|
|
25
25
|
export { default as JsvTextureAnim, TexAlignAnchor, DECORATE_NINEPATCH_ALPHA_MIX, DECORATE_BORDER_RADIUS } from "./JsvTextureAnim";
|
|
26
26
|
export { default as JsvVisibleSensor } from "./JsvVisibleSensor";
|
|
@@ -63,3 +63,6 @@ export * from "./JsvClipDiv"
|
|
|
63
63
|
export * from "./JsvDriftScope"
|
|
64
64
|
export { default as JsvTouchModeSwitcher } from "./JsvTouchModeSwitcher.vue"
|
|
65
65
|
export { default as JsvDragBox } from "./JsvDragBox/JsvDragBox.vue"
|
|
66
|
+
export { default as Jsv3dDiv } from "./Jsv3dDiv.vue";
|
|
67
|
+
export { default as Jsv3dStage } from "./Jsv3dStage.vue";
|
|
68
|
+
export { default as JsvDashPath } from "./JsvDashPath.vue";
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { shallowRef, onMounted, openBlock, createElementBlock, normalizeStyle } from 'vue';
|
|
2
|
-
import { W as WebpData, G as GifData, V as Viewer } from './BrowserApicLib.mjs';
|
|
3
|
-
import { L as LoopType } from '../jsview-vue-common.mjs';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
+ @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue}
|
|
7
|
-
*/
|
|
8
|
-
const _sfc_main = {
|
|
9
|
-
__name: "BrowserApic",
|
|
10
|
-
props: {
|
|
11
|
-
src: String,
|
|
12
|
-
style: Object,
|
|
13
|
-
autoPlay: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: true
|
|
16
|
-
},
|
|
17
|
-
loopType: {
|
|
18
|
-
type: Number,
|
|
19
|
-
default: LoopType.LOOP_DEFAULT
|
|
20
|
-
},
|
|
21
|
-
loopInfo: {
|
|
22
|
-
type: Array,
|
|
23
|
-
default: () => [[-1, -1, -1]]
|
|
24
|
-
},
|
|
25
|
-
onStart: Function,
|
|
26
|
-
onEnd: Function,
|
|
27
|
-
onLoad: Function
|
|
28
|
-
},
|
|
29
|
-
setup(__props, { expose }) {
|
|
30
|
-
const props = __props;
|
|
31
|
-
const renderDocument = window.JsvCode.Dom.RenderDocument ? window.JsvCode.Dom.RenderDocument : window.JsvCode.Dom.BrowserDocument;
|
|
32
|
-
const loadImage = (url) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
let xhr = new XMLHttpRequest();
|
|
35
|
-
xhr.open("GET", url);
|
|
36
|
-
xhr.responseType = "arraybuffer";
|
|
37
|
-
xhr.onreadystatechange = () => {
|
|
38
|
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
39
|
-
if (xhr.status == 200) {
|
|
40
|
-
let apic_data;
|
|
41
|
-
if (url.indexOf(".webp") > 0) {
|
|
42
|
-
apic_data = new WebpData(xhr.response);
|
|
43
|
-
resolve(apic_data);
|
|
44
|
-
} else if (url.indexOf(".gif") > 0) {
|
|
45
|
-
apic_data = new GifData(xhr.response);
|
|
46
|
-
resolve(apic_data);
|
|
47
|
-
} else {
|
|
48
|
-
reject("unsupport file " + url);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
reject("get image data failed. " + url + " " + xhr.status);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
xhr.send();
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
const getUrl = (base_url) => {
|
|
59
|
-
let url_trim = base_url.trim();
|
|
60
|
-
if (url_trim.indexOf("http") === 0) {
|
|
61
|
-
return url_trim;
|
|
62
|
-
} else if (url_trim.indexOf("url") === 0) {
|
|
63
|
-
let index_1 = url_trim.indexOf("(");
|
|
64
|
-
let index_2 = url_trim.indexOf(")");
|
|
65
|
-
return url_trim.substring(index_1 + 1, index_2);
|
|
66
|
-
} else {
|
|
67
|
-
return url_trim;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
let viewer = null;
|
|
71
|
-
let canvasProxyRef = shallowRef(null);
|
|
72
|
-
const play = () => {
|
|
73
|
-
viewer?.play(props.loopType, props.loopInfo);
|
|
74
|
-
};
|
|
75
|
-
const stop = (frameCount = -1) => {
|
|
76
|
-
viewer?.stop(frameCount);
|
|
77
|
-
};
|
|
78
|
-
onMounted(() => {
|
|
79
|
-
let domLayoutView = canvasProxyRef.value.jsvGetProxyView();
|
|
80
|
-
domLayoutView.RegisterOnProxyReady(() => {
|
|
81
|
-
let canvas = renderDocument.createElement("canvas");
|
|
82
|
-
canvas.style.width = props.style.width + "px";
|
|
83
|
-
canvas.style.height = props.style.height + "px";
|
|
84
|
-
domLayoutView.HtmlGetElement().appendChild(canvas);
|
|
85
|
-
loadImage(getUrl(props.src)).then((data) => {
|
|
86
|
-
let listener = {
|
|
87
|
-
onstart: props.onStart,
|
|
88
|
-
onend: props.onEnd
|
|
89
|
-
};
|
|
90
|
-
viewer = new Viewer(data, canvas, listener);
|
|
91
|
-
if (props.onLoad) {
|
|
92
|
-
props.onLoad();
|
|
93
|
-
}
|
|
94
|
-
if (props.autoPlay) {
|
|
95
|
-
play();
|
|
96
|
-
}
|
|
97
|
-
}).catch((err) => console.error(err));
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
expose({
|
|
101
|
-
play,
|
|
102
|
-
stop
|
|
103
|
-
});
|
|
104
|
-
return (_ctx, _cache) => {
|
|
105
|
-
return openBlock(), createElementBlock("div", {
|
|
106
|
-
ref_key: "canvasProxyRef",
|
|
107
|
-
ref: canvasProxyRef,
|
|
108
|
-
style: normalizeStyle(props.style)
|
|
109
|
-
}, null, 4);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export { _sfc_main as default };
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { shallowRef, onMounted, openBlock, createElementBlock, normalizeStyle } from 'vue';
|
|
2
|
-
import { W as WebpData, G as GifData, V as Viewer } from './BrowserApicLib.mjs';
|
|
3
|
-
import { L as LoopType } from '../jsview-vue-common.mjs';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
+ @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue}
|
|
7
|
-
*/
|
|
8
|
-
const _sfc_main = {
|
|
9
|
-
__name: "BrowserApic2",
|
|
10
|
-
props: {
|
|
11
|
-
src: String,
|
|
12
|
-
style: Object,
|
|
13
|
-
onStart: Function,
|
|
14
|
-
onEnd: Function,
|
|
15
|
-
onLoad: Function
|
|
16
|
-
},
|
|
17
|
-
setup(__props, { expose }) {
|
|
18
|
-
const props = __props;
|
|
19
|
-
let waitForPlayInfo = null;
|
|
20
|
-
const renderDocument = window.JsvCode.Dom.RenderDocument ? window.JsvCode.Dom.RenderDocument : window.JsvCode.Dom.BrowserDocument;
|
|
21
|
-
const loadImage = (url) => {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
let xhr = new XMLHttpRequest();
|
|
24
|
-
xhr.open("GET", url);
|
|
25
|
-
xhr.responseType = "arraybuffer";
|
|
26
|
-
xhr.onreadystatechange = () => {
|
|
27
|
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
28
|
-
if (xhr.status == 200) {
|
|
29
|
-
let apic_data;
|
|
30
|
-
if (url.indexOf(".webp") > 0) {
|
|
31
|
-
apic_data = new WebpData(xhr.response);
|
|
32
|
-
resolve(apic_data);
|
|
33
|
-
} else if (url.indexOf(".gif") > 0) {
|
|
34
|
-
apic_data = new GifData(xhr.response);
|
|
35
|
-
resolve(apic_data);
|
|
36
|
-
} else {
|
|
37
|
-
reject("unsupport file " + url);
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
reject("get image data failed. " + url + " " + xhr.status);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
xhr.send();
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
const getUrl = (base_url) => {
|
|
48
|
-
let url_trim = base_url.trim();
|
|
49
|
-
if (url_trim.indexOf("http") === 0) {
|
|
50
|
-
return url_trim;
|
|
51
|
-
} else if (url_trim.indexOf("url") === 0) {
|
|
52
|
-
let index_1 = url_trim.indexOf("(");
|
|
53
|
-
let index_2 = url_trim.indexOf(")");
|
|
54
|
-
return url_trim.substring(index_1 + 1, index_2);
|
|
55
|
-
} else {
|
|
56
|
-
return url_trim;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
let viewer = null;
|
|
60
|
-
let canvasProxyRef = shallowRef(null);
|
|
61
|
-
onMounted(() => {
|
|
62
|
-
let domLayoutView = canvasProxyRef.value.jsvGetProxyView();
|
|
63
|
-
domLayoutView.RegisterOnProxyReady(() => {
|
|
64
|
-
let canvas = renderDocument.createElement("canvas");
|
|
65
|
-
canvas.style.width = props.style.width + "px";
|
|
66
|
-
canvas.style.height = props.style.height + "px";
|
|
67
|
-
domLayoutView.HtmlGetElement().appendChild(canvas);
|
|
68
|
-
loadImage(getUrl(props.src)).then((data) => {
|
|
69
|
-
let listener = {
|
|
70
|
-
onstart: props.onStart,
|
|
71
|
-
onend: props.onEnd
|
|
72
|
-
};
|
|
73
|
-
viewer = new Viewer(data, canvas, listener);
|
|
74
|
-
if (props.onLoad) {
|
|
75
|
-
props.onLoad();
|
|
76
|
-
}
|
|
77
|
-
if (waitForPlayInfo) {
|
|
78
|
-
viewer.play(...waitForPlayInfo);
|
|
79
|
-
waitForPlayInfo = null;
|
|
80
|
-
}
|
|
81
|
-
}).catch((err) => console.error(err));
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
expose({
|
|
85
|
-
show: (frameIndex = 0) => {
|
|
86
|
-
if (!isNaN(frameIndex)) {
|
|
87
|
-
viewer?.play(LoopType.LOOP_SINGLE, [[0, frameIndex, 0]]);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
play: (...args) => {
|
|
91
|
-
waitForPlayInfo = args;
|
|
92
|
-
viewer?.play(...args);
|
|
93
|
-
},
|
|
94
|
-
stop: (frameCount = -1) => {
|
|
95
|
-
viewer?.stop(frameCount);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
return (_ctx, _cache) => {
|
|
99
|
-
return openBlock(), createElementBlock("div", {
|
|
100
|
-
ref_key: "canvasProxyRef",
|
|
101
|
-
ref: canvasProxyRef,
|
|
102
|
-
style: normalizeStyle(props.style)
|
|
103
|
-
}, null, 4);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export { _sfc_main as default };
|