@shijiu/jsview-vue 2.2.35 → 2.2.201
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/BrowserApic.vue.mjs +4 -3
- package/bin/browser/BrowserApic2.vue.mjs +4 -3
- package/bin/browser/BrowserApicLib.mjs +10 -3
- package/bin/browser/BrowserJsvFragShaderView.vue.mjs +63 -0
- package/bin/browser/BrowserQrcode.vue.mjs +3 -1
- package/bin/browser/BrowserTextureAnim.vue.mjs +7 -6
- package/bin/jsview-vue.mjs +2990 -1146
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +8 -6
- package/bin/types/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +10 -12
- package/bin/types/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +3 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +3 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +2 -2
- package/bin/types/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/Slide.d.ts +21 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +1 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +2 -8
- package/bin/types/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +1 -1
- package/bin/types/JsViewEngineWidget/WidgetCommon.d.ts +9 -3
- package/bin/types/JsViewEngineWidget/index.d.ts +10 -1
- package/bin/types/JsViewVueTools/ConstSymbol.d.ts +2 -0
- package/bin/types/JsViewVueTools/ForgeConstDefine.d.ts +11 -0
- package/bin/types/JsViewVueTools/JsvFederationTools.d.ts +16 -0
- package/bin/types/JsViewVueTools/JsvPerformance.d.ts +5 -0
- package/bin/types/JsViewVueTools/JsvPreDownloader.d.ts +33 -0
- package/bin/types/JsViewVueTools/JsvRuntimeBridge.d.ts +113 -57
- package/bin/types/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +11 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +45 -1
- package/bin/types/JsViewVueTools/JsvTextureStore/Texture.d.ts +8 -0
- package/bin/types/JsViewVueTools/index.d.ts +19 -11
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +2 -1
- package/bin/types/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +70 -0
- package/bin/types/JsViewVueWidget/JsvClipDiv/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +104 -0
- package/bin/types/JsViewVueWidget/JsvDriftScope/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +91 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorState.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +15 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +71 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +97 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +62 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +4 -1
- package/bin/types/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +66 -28
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +236 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +153 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +12 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +3 -0
- package/bin/types/JsViewVueWidget/JsvTextBox.vue.d.ts +3 -3
- package/bin/types/JsViewVueWidget/index.d.ts +4 -0
- package/package.json +1 -1
- package/tools/config/rollup.config.mjs +1 -0
- package/utils/JsViewEngineWidget/JsvFocus/{JsvFocusManager.js → JsvFocusManager.ts} +12 -12
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.ts +20 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +27 -10
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +52 -11
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +686 -480
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +13 -1
- package/utils/JsViewEngineWidget/MetroWidget/Slide.ts +56 -0
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +59 -10
- package/utils/JsViewEngineWidget/MetroWidget/TokenGenerator.ts +10 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +20 -10
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +27 -3
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +25 -35
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +7 -0
- package/utils/JsViewEngineWidget/WidgetCommon.ts +20 -7
- package/utils/JsViewEngineWidget/{index.js → index.ts} +1 -1
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +21 -2
- package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +13 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +470 -338
- package/utils/JsViewVueTools/ConstSymbol.ts +3 -0
- package/utils/JsViewVueTools/ForgeConstDefine.ts +11 -0
- package/utils/JsViewVueTools/JsvPreDownloader.ts +3 -3
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +172 -50
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +62 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +42 -8
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +15 -1
- package/utils/JsViewVueTools/index.js +19 -17
- package/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue +8 -8
- package/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue +3 -3
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +7 -8
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +3 -3
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.js +5 -1
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js +8 -3
- package/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue +42 -0
- package/utils/JsViewVueWidget/JsvClipDiv/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +5 -1
- package/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue +82 -0
- package/utils/JsViewVueWidget/JsvDriftScope/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue +48 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +145 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/index.js +18 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +156 -55
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.ts +4 -4
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +6 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +43 -9
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +33 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +69 -8
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +60 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.ts +120 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +7 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +6 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +121 -68
- package/utils/JsViewVueWidget/JsvNinePatch.vue +17 -2
- package/utils/JsViewVueWidget/JsvPosterImage.vue +22 -9
- package/utils/JsViewVueWidget/JsvQrcode/BrowserQrcode.vue +6 -2
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +518 -0
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +468 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.ts +9 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.ts +24 -0
- package/utils/JsViewVueWidget/JsvScrollBox/index.ts +3 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +12 -4
- package/utils/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue +9 -6
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -0
- package/utils/JsViewVueWidget/index.js +4 -0
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.js +0 -19
|
@@ -12,10 +12,14 @@ export class TextureBase {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
protected addToStore() {
|
|
15
|
-
this.storeName =
|
|
15
|
+
this.storeName = this.getStoreName();
|
|
16
16
|
sStore.addToStore(this.storeName, this);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
protected getStoreName() {
|
|
20
|
+
return `${this.baseName}-${this.textureRef?.GetTextureId()}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
/**
|
|
20
24
|
* commit
|
|
21
25
|
* 完成绘制设置,出发制作目标texture
|
|
@@ -27,6 +31,16 @@ export class TextureBase {
|
|
|
27
31
|
return this.storeName;
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
/**
|
|
35
|
+
* getTextureRef
|
|
36
|
+
* 内部接口,获取内联的Forge.ImageTexture的句柄
|
|
37
|
+
*
|
|
38
|
+
* @return {String} BaseName-textureId 格式的名字,用于 jsvtexturestore:// 的访问链接
|
|
39
|
+
*/
|
|
40
|
+
public getTextureRef(): any {
|
|
41
|
+
return this.textureRef;
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
public recycle() {
|
|
31
45
|
// 释放native端的texture实体
|
|
32
46
|
let textureRef = sStore.removeFromStore(this.storeName);
|
|
@@ -5,22 +5,24 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export * from "./JsvHashHistory";
|
|
8
|
-
export * from "./JsvDynamicCssStyle
|
|
9
|
-
export * from "./JsvDynamicKeyFrames
|
|
10
|
-
export * from "./JsvRuntimeBridge
|
|
8
|
+
export * from "./JsvDynamicCssStyle";
|
|
9
|
+
export * from "./JsvDynamicKeyFrames";
|
|
10
|
+
export * from "./JsvRuntimeBridge";
|
|
11
11
|
export * from "./NinePatchHelper";
|
|
12
12
|
export * from "./TypeCheckAndSet";
|
|
13
|
-
export * from "./JsvRefTaker
|
|
14
|
-
export * from "./JsvStyleClass
|
|
15
|
-
export * from "./JsvStyleSheetsDeclarer
|
|
16
|
-
export * from "./DebugContentShellJBridge
|
|
17
|
-
export * from "./DebugTool
|
|
18
|
-
export * from "./JsvImpactTracer
|
|
19
|
-
export * from "./JsvTextTools
|
|
20
|
-
export * from "./JsvPreDownloader
|
|
21
|
-
export { default as DefaultKeyCodeMap } from "./DefaultKeyMap
|
|
22
|
-
export * from "./JsvDemoTester
|
|
23
|
-
export * from "./JsvPerformance
|
|
24
|
-
export * from "./JsvTextureStore/JsvTextureStore
|
|
25
|
-
export * from "./JsvTextureDefines
|
|
26
|
-
export * from "./JsvFederationTools
|
|
13
|
+
export * from "./JsvRefTaker";
|
|
14
|
+
export * from "./JsvStyleClass";
|
|
15
|
+
export * from "./JsvStyleSheetsDeclarer";
|
|
16
|
+
export * from "./DebugContentShellJBridge";
|
|
17
|
+
export * from "./DebugTool";
|
|
18
|
+
export * from "./JsvImpactTracer";
|
|
19
|
+
export * from "./JsvTextTools";
|
|
20
|
+
export * from "./JsvPreDownloader"
|
|
21
|
+
export { default as DefaultKeyCodeMap } from "./DefaultKeyMap";
|
|
22
|
+
export * from "./JsvDemoTester"
|
|
23
|
+
export * from "./JsvPerformance"
|
|
24
|
+
export * from "./JsvTextureStore/JsvTextureStore"
|
|
25
|
+
export * from "./JsvTextureDefines"
|
|
26
|
+
export * from "./JsvFederationTools"
|
|
27
|
+
export * from "./ConstSymbol"
|
|
28
|
+
export * from "./ForgeConstDefine"
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
|
-
import {
|
|
10
|
-
Viewer,
|
|
11
|
-
WebpData,
|
|
12
|
-
GifData
|
|
13
|
-
} from "../JsvBrowserApicLib/BrowserApicLib";
|
|
9
|
+
import { Viewer, WebpData, GifData } from "../JsvBrowserApicLib/BrowserApicLib";
|
|
14
10
|
import { LoopType } from "../JsvCommonLoopToolBase";
|
|
15
11
|
import { onMounted, shallowRef } from "vue";
|
|
16
12
|
|
|
13
|
+
const renderDocument = window.JsvCode.Dom.RenderDocument
|
|
14
|
+
? window.JsvCode.Dom.RenderDocument
|
|
15
|
+
: window.JsvCode.Dom.BrowserDocument;
|
|
16
|
+
|
|
17
17
|
const loadImage = (url) => {
|
|
18
18
|
return new Promise((resolve, reject) => {
|
|
19
19
|
let xhr = new XMLHttpRequest();
|
|
@@ -81,15 +81,15 @@ const play = () => {
|
|
|
81
81
|
viewer?.play(props.loopType, props.loopInfo);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
const stop = () => {
|
|
85
|
-
viewer?.stop();
|
|
84
|
+
const stop = (frameCount = -1) => {
|
|
85
|
+
viewer?.stop(frameCount);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
onMounted(() => {
|
|
89
89
|
let domLayoutView = canvasProxyRef.value.jsvGetProxyView();
|
|
90
90
|
domLayoutView.RegisterOnProxyReady(() => {
|
|
91
91
|
// 制作canvas
|
|
92
|
-
let canvas =
|
|
92
|
+
let canvas = renderDocument.createElement("canvas");
|
|
93
93
|
canvas.style.width = props.style.width + "px";
|
|
94
94
|
canvas.style.height = props.style.height + "px";
|
|
95
95
|
domLayoutView.HtmlGetElement().appendChild(canvas);
|
|
@@ -79,12 +79,12 @@ export default {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
stop() {
|
|
82
|
+
stop(frameCount = -1) {
|
|
83
83
|
if (this.$refs.element) {
|
|
84
84
|
let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
|
|
85
85
|
ForgeHandles.TextureManager
|
|
86
86
|
);
|
|
87
|
-
mainViewTexture.DispatchCommand(Forge.NativeConstant.APIC_STOP, "");
|
|
87
|
+
mainViewTexture.DispatchCommand(Forge.NativeConstant.APIC_STOP, `{"TF":${frameCount}}`);
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
},
|
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
beforeUnmount() {
|
|
105
|
-
this.stop();
|
|
105
|
+
this.stop(0);
|
|
106
106
|
if (this.$refs.element) {
|
|
107
107
|
let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
|
|
108
108
|
ForgeHandles.TextureManager
|
|
@@ -6,15 +6,14 @@
|
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
|
-
import {
|
|
10
|
-
Viewer,
|
|
11
|
-
WebpData,
|
|
12
|
-
GifData
|
|
13
|
-
} from "../JsvBrowserApicLib/BrowserApicLib";
|
|
9
|
+
import { Viewer, WebpData, GifData } from "../JsvBrowserApicLib/BrowserApicLib";
|
|
14
10
|
import { LoopType } from "../JsvCommonLoopToolBase.js";
|
|
15
11
|
import { onMounted, shallowRef } from "vue";
|
|
16
12
|
|
|
17
13
|
let waitForPlayInfo = null;
|
|
14
|
+
const renderDocument = window.JsvCode.Dom.RenderDocument
|
|
15
|
+
? window.JsvCode.Dom.RenderDocument
|
|
16
|
+
: window.JsvCode.Dom.BrowserDocument;
|
|
18
17
|
|
|
19
18
|
const loadImage = (url) => {
|
|
20
19
|
return new Promise((resolve, reject) => {
|
|
@@ -71,7 +70,7 @@ onMounted(() => {
|
|
|
71
70
|
let domLayoutView = canvasProxyRef.value.jsvGetProxyView();
|
|
72
71
|
domLayoutView.RegisterOnProxyReady(() => {
|
|
73
72
|
// 制作canvas
|
|
74
|
-
let canvas =
|
|
73
|
+
let canvas = renderDocument.createElement("canvas");
|
|
75
74
|
canvas.style.width = props.style.width + "px";
|
|
76
75
|
canvas.style.height = props.style.height + "px";
|
|
77
76
|
domLayoutView.HtmlGetElement().appendChild(canvas);
|
|
@@ -105,8 +104,8 @@ defineExpose({
|
|
|
105
104
|
waitForPlayInfo = args;
|
|
106
105
|
viewer?.play(...args);
|
|
107
106
|
},
|
|
108
|
-
stop: () => {
|
|
109
|
-
viewer?.stop();
|
|
107
|
+
stop: (frameCount = -1) => {
|
|
108
|
+
viewer?.stop(frameCount);
|
|
110
109
|
},
|
|
111
110
|
});
|
|
112
111
|
</script>
|
|
@@ -88,12 +88,12 @@ export default {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
|
-
stop() {
|
|
91
|
+
stop(frameCount = -1) {
|
|
92
92
|
if (this.$refs.element) {
|
|
93
93
|
let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
|
|
94
94
|
ForgeHandles.TextureManager
|
|
95
95
|
);
|
|
96
|
-
mainViewTexture.DispatchCommand(Forge.NativeConstant.APIC_STOP, "");
|
|
96
|
+
mainViewTexture.DispatchCommand(Forge.NativeConstant.APIC_STOP, `{"TF":${frameCount}}`);
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
},
|
|
@@ -108,7 +108,7 @@ export default {
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
beforeUnmount() {
|
|
111
|
-
this.stop();
|
|
111
|
+
this.stop(0);
|
|
112
112
|
if (this.$refs.element) {
|
|
113
113
|
let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
|
|
114
114
|
ForgeHandles.TextureManager
|
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
const renderDocument = window.JsvCode.Dom.RenderDocument
|
|
10
|
+
? window.JsvCode.Dom.RenderDocument
|
|
11
|
+
: window.JsvCode.Dom.BrowserDocument;
|
|
12
|
+
|
|
9
13
|
class ApicDataBase {
|
|
10
14
|
constructor(arrayBuffer) {
|
|
11
15
|
this.LoopCount = 0;
|
|
12
16
|
this.FrameCount = 0;
|
|
13
17
|
this.Width = 0;
|
|
14
18
|
this.Height = 0;
|
|
15
|
-
this._Canvas =
|
|
19
|
+
this._Canvas = renderDocument.createElement("canvas");
|
|
16
20
|
this._Context = this._Canvas.getContext("2d");
|
|
17
21
|
this._DecodedData = null;
|
|
18
22
|
this.decode(arrayBuffer);
|
|
@@ -23,7 +23,7 @@ class Viewer {
|
|
|
23
23
|
this._Listener = listener;
|
|
24
24
|
this._TimeoutId = -1;
|
|
25
25
|
this._EndState = ApicEndState.LAST_FRAME;
|
|
26
|
-
|
|
26
|
+
this._CurrentIndex = -1;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
_createLoopTool(loop_type, loop_info) {
|
|
@@ -59,8 +59,12 @@ class Viewer {
|
|
|
59
59
|
this._LoopTool.setApicInfo(this._ApicData.FrameCount, this._ApicData.LoopCount);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
stop() {
|
|
62
|
+
stop(frameCount = -1) {
|
|
63
63
|
clearTimeout(this._TimeoutId);
|
|
64
|
+
if (frameCount >= 0 && this._CurrentIndex !== frameCount) {
|
|
65
|
+
this._CurrentIndex = frameCount;
|
|
66
|
+
this.renderFrame(frameCount)
|
|
67
|
+
}
|
|
64
68
|
if (this._Listener?.onend) {
|
|
65
69
|
this._Listener.onend();
|
|
66
70
|
}
|
|
@@ -88,7 +92,8 @@ class Viewer {
|
|
|
88
92
|
|
|
89
93
|
renderLoop() {
|
|
90
94
|
if (this._LoopTool.hasNext()) {
|
|
91
|
-
|
|
95
|
+
this._CurrentIndex = this._LoopTool.next()
|
|
96
|
+
let duration = this.renderFrame(this._CurrentIndex);
|
|
92
97
|
this._TimeoutId = setTimeout(() => {
|
|
93
98
|
this.renderLoop();
|
|
94
99
|
}, duration);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【模块 export 内容】
|
|
3
|
+
* JsvClipDiv: Vue高阶组件,overhidden:true的div,附带有其他clip设定能力
|
|
4
|
+
* props说明:
|
|
5
|
+
style: {Object} (必选, 响应式) 同div的style, 提供top, left, width, height, transition, transform信息,
|
|
6
|
+
但目前不支持borderRaduis
|
|
7
|
+
*
|
|
8
|
+
* expose函数说明:
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div v-bind="rMergedDivProps">
|
|
14
|
+
<slot />
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { shallowRef, watchEffect, defineProps, withDefaults } from "vue";
|
|
20
|
+
|
|
21
|
+
const rProps = withDefaults(
|
|
22
|
+
defineProps<{
|
|
23
|
+
style: object;
|
|
24
|
+
}>(),
|
|
25
|
+
{}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// 响应式变量
|
|
29
|
+
let rMergedDivProps = shallowRef({});
|
|
30
|
+
|
|
31
|
+
watchEffect(() => {
|
|
32
|
+
let divStyle = {
|
|
33
|
+
...rProps.style,
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
};
|
|
36
|
+
rMergedDivProps.value = {
|
|
37
|
+
style: divStyle,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// TODO: 未来补充补充其他 data-jsv-vw-xxxx 设置
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as JsvClipDiv } from "./JsvClipDiv.vue"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
<script setup>
|
|
76
76
|
import JsvLine from "../JsvLine/index";
|
|
77
77
|
import { createTexture } from "./ArcLineManager";
|
|
78
|
-
import { shallowRef } from "vue";
|
|
78
|
+
import { shallowRef, onBeforeUnmount } from "vue";
|
|
79
79
|
const props = defineProps({
|
|
80
80
|
startPos: {
|
|
81
81
|
type: Object,
|
|
@@ -349,6 +349,10 @@ if (props.radius) {
|
|
|
349
349
|
? InflectionPoint.y + startPos3Extra
|
|
350
350
|
: props.endPos.y;
|
|
351
351
|
}
|
|
352
|
+
|
|
353
|
+
onBeforeUnmount(() => {
|
|
354
|
+
myLineTexture.UnRef()
|
|
355
|
+
})
|
|
352
356
|
</script>
|
|
353
357
|
|
|
354
358
|
<style scoped></style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【模块 export 内容】
|
|
3
|
+
* JsvDriftScope: Vue高阶组件,放大镜或者望远镜效果, 分为 frame 区域和 scene 区域,frame是游离的ClipView, scene是被Clip部分
|
|
4
|
+
* props说明:
|
|
5
|
+
top {Number} (可选, 响应式)组件的top, 不填写时默认值为0
|
|
6
|
+
left {Number} (可选, 响应式)组件的left, 不填写时默认值为0
|
|
7
|
+
frameStyle: {Object} (可选, 响应式) 透视(裁剪)区域外框的style, 此层次无色透明,但是决定Frame层的变化, 支持以下属性
|
|
8
|
+
{top, left, width, height, transition, animation, transform, transformOrigin}
|
|
9
|
+
scopeStyle: {Object} (必选, 响应式) 透视(裁剪)区域的div的尺寸style, 会叠加frameStyle已经做的形变, 支持以下属性
|
|
10
|
+
{width, height, transition, animation, transform, transformOrigin}
|
|
11
|
+
做动画时,frameStyle负责位置变化,scope则主要负责尺寸变化
|
|
12
|
+
*
|
|
13
|
+
* template说明:
|
|
14
|
+
Frame 透视窗(裁剪层)的外框的装饰层
|
|
15
|
+
Scene 被透视的内容
|
|
16
|
+
* expose函数说明:
|
|
17
|
+
*
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div
|
|
22
|
+
:style="{
|
|
23
|
+
top: rProps.top,
|
|
24
|
+
left: rProps.left,
|
|
25
|
+
}"
|
|
26
|
+
>
|
|
27
|
+
<div :style="rMergedFrameStyle" data-jsv-vw-mask-drift="true">
|
|
28
|
+
<!-- clip div -->
|
|
29
|
+
<jsv-clip-div :style="rProps.scopeStyle">
|
|
30
|
+
<!-- scene层, 坐标不跟随clip div, 只从属于主div -->
|
|
31
|
+
<div data-jsv-vw-mask-dock="true">
|
|
32
|
+
<slot name="Scene" />
|
|
33
|
+
</div>
|
|
34
|
+
</jsv-clip-div>
|
|
35
|
+
<!-- frame层, 坐标跟随clip div -->
|
|
36
|
+
<slot name="Frame" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { shallowRef, watchEffect, defineProps, withDefaults } from "vue";
|
|
43
|
+
import JsvClipDiv from "../JsvClipDiv/JsvClipDiv.vue";
|
|
44
|
+
|
|
45
|
+
interface FrameStyleDefine {
|
|
46
|
+
top?: number;
|
|
47
|
+
left?: number;
|
|
48
|
+
width?: number;
|
|
49
|
+
height?: number;
|
|
50
|
+
transition?: string;
|
|
51
|
+
animation?: string;
|
|
52
|
+
transform?: string;
|
|
53
|
+
transformOrigin?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface ScopeStyleDefine {
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
transition?: string;
|
|
60
|
+
animation?: string;
|
|
61
|
+
transform?: string;
|
|
62
|
+
transformOrigin?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const rProps = withDefaults(
|
|
66
|
+
defineProps<{
|
|
67
|
+
top?: number;
|
|
68
|
+
left?: number;
|
|
69
|
+
frameStyle?: Object; // FrameStyleDefine
|
|
70
|
+
scopeStyle: Object; // ScopeStyleDefine
|
|
71
|
+
}>(),
|
|
72
|
+
{ top: 0, left: 0 }
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const rMergedFrameStyle = shallowRef({});
|
|
76
|
+
|
|
77
|
+
watchEffect(() => {
|
|
78
|
+
rMergedFrameStyle.value = {
|
|
79
|
+
...rProps.frameStyle,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as JsvDriftScope } from "./JsvDriftScope.vue"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
style: {
|
|
4
|
+
type: Object,
|
|
5
|
+
required: true,
|
|
6
|
+
},
|
|
7
|
+
duration: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: -1,
|
|
10
|
+
},
|
|
11
|
+
autoplay: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
shaderStr: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
// [{ name: string, value: number }]
|
|
20
|
+
uniforms: {
|
|
21
|
+
type: Array,
|
|
22
|
+
},
|
|
23
|
+
// [{ name: string, type: number, resource: object/string }]
|
|
24
|
+
textures: {
|
|
25
|
+
type: Array,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
defineExpose({
|
|
30
|
+
startAnim: () => {},
|
|
31
|
+
stopAnim: () => {},
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
<template>
|
|
35
|
+
<div :style="{
|
|
36
|
+
left: style.left,
|
|
37
|
+
top: style.top,
|
|
38
|
+
width: style.width,
|
|
39
|
+
height: style.height,
|
|
40
|
+
backgroundColor: '#00000077',
|
|
41
|
+
fontSize: 50,
|
|
42
|
+
color: '#ffffff',
|
|
43
|
+
textAlign: 'center',
|
|
44
|
+
lineHeight: style.height,
|
|
45
|
+
}">
|
|
46
|
+
浏览器端未支持JsvFragShaderView
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
[模块 export 内容]
|
|
3
|
+
JsvFragShaderView:自定义Fragment shader的组件
|
|
4
|
+
props说明:
|
|
5
|
+
style {Object} (必填)left, top, width, height
|
|
6
|
+
shaderStr {String} (必填)shader的函数体
|
|
7
|
+
duration {int} 动画时长
|
|
8
|
+
autoplay {boolean} 自动播放
|
|
9
|
+
uniforms {Array} uniform参数, [{ name: string, value: number }]
|
|
10
|
+
textures {Array} texture参数, [{ name: string, resource: string }]
|
|
11
|
+
methods:
|
|
12
|
+
startAnim
|
|
13
|
+
@description 开始动画
|
|
14
|
+
@params {int} duration: 动画时长, 默认为props.duration
|
|
15
|
+
stopAnim
|
|
16
|
+
@description 停止动画
|
|
17
|
+
shader函数体说明:
|
|
18
|
+
参考网站: https://www.shadertoy.com
|
|
19
|
+
主函数:
|
|
20
|
+
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
|
21
|
+
@params {vec4} fragColor: 输出的片元颜色
|
|
22
|
+
@params {vec2} fragCoord: 片元坐标, 左下角为原点, 往右为x正, 往上为y正
|
|
23
|
+
注意事项:
|
|
24
|
+
* 盒子端使用OpenGL ES 2.0版本, 而网站 https://www.shadertoy.com 上使用WebGL, glsl支持的函数和操作符有区别.
|
|
25
|
+
* 由于坐标系的差异, texture()采样函数需要替换为jsvTexture2D()
|
|
26
|
+
* 盒子端的精度有限, 可能会出现精度导致的计算错误
|
|
27
|
+
|
|
28
|
+
-->
|
|
29
|
+
<script setup>
|
|
30
|
+
import { onMounted, onBeforeUnmount } from "vue";
|
|
31
|
+
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
|
|
32
|
+
import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
|
|
33
|
+
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
style: {
|
|
36
|
+
type: Object,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
duration: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: -1,
|
|
42
|
+
},
|
|
43
|
+
autoplay: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
shaderStr: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: true,
|
|
50
|
+
},
|
|
51
|
+
// [{ name: string, value: number }]
|
|
52
|
+
uniforms: {
|
|
53
|
+
type: Array,
|
|
54
|
+
},
|
|
55
|
+
// [{ name: string, type: number, resource: string }]
|
|
56
|
+
textures: {
|
|
57
|
+
type: Array,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//uniforms
|
|
62
|
+
let uniformList = [];
|
|
63
|
+
if (props.uniforms) {
|
|
64
|
+
for (let item of props.uniforms) {
|
|
65
|
+
uniformList.push({
|
|
66
|
+
name: item.name,
|
|
67
|
+
type: 1,
|
|
68
|
+
value: item.value,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//prepare texture
|
|
74
|
+
let textureList = [];
|
|
75
|
+
if (props.textures) {
|
|
76
|
+
const texture_manager = ForgeHandles.TextureManager;
|
|
77
|
+
for (let item of props.textures) {
|
|
78
|
+
if (typeof item.resource == "string") {
|
|
79
|
+
let image_url = item.resource;
|
|
80
|
+
if (item.resource && item.resource.trim().indexOf("url(") === 0) {
|
|
81
|
+
image_url = new window.JsView.Dom.UrlRef(image_url).href;
|
|
82
|
+
}
|
|
83
|
+
const texture = texture_manager.GetImage2(
|
|
84
|
+
image_url,
|
|
85
|
+
false,
|
|
86
|
+
null,
|
|
87
|
+
"RGB_8888",
|
|
88
|
+
null
|
|
89
|
+
);
|
|
90
|
+
textureList.push({
|
|
91
|
+
name: item.name,
|
|
92
|
+
id: texture.TexId,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const fragShaderView = new Forge.FragShaderView();
|
|
99
|
+
fragShaderView.SetShaderInfo(
|
|
100
|
+
props.shaderStr,
|
|
101
|
+
uniformList,
|
|
102
|
+
textureList,
|
|
103
|
+
(state, detail) => {
|
|
104
|
+
console.log("haha", state, detail);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
let viewId = Forge.sViewStore.add(new Forge.ViewInfo(fragShaderView, ""));
|
|
108
|
+
|
|
109
|
+
const { left, top, width, height } = props.style;
|
|
110
|
+
|
|
111
|
+
const startAnim = (d) => {
|
|
112
|
+
let duration = typeof d == "number" ? d : props.duration;
|
|
113
|
+
if (duration > 0) {
|
|
114
|
+
let shaderAnimation = new Forge.ShaderAnimation(duration, null);
|
|
115
|
+
fragShaderView.StartAnimation(shaderAnimation);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const stopAnim = () => {
|
|
120
|
+
fragShaderView?.StopAnimation();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
onMounted(() => {
|
|
124
|
+
if (props.autoplay) {
|
|
125
|
+
startAnim(props.duration);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
onBeforeUnmount(() => {
|
|
130
|
+
if (viewId != -1) {
|
|
131
|
+
Forge.sViewStore.remove(viewId);
|
|
132
|
+
viewId = -1;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
defineExpose({
|
|
136
|
+
startAnim,
|
|
137
|
+
stopAnim,
|
|
138
|
+
});
|
|
139
|
+
</script>
|
|
140
|
+
<template>
|
|
141
|
+
<div
|
|
142
|
+
:style="{ left, top, width, height }"
|
|
143
|
+
:data-jsv-vw-innerview="viewId"
|
|
144
|
+
></div>
|
|
145
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-13 15:12:45
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2021-11-22 14:24:36
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
//! 考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
|
|
9
|
+
import * as JsvFragShaderView from "./JsvFragShaderView.vue";
|
|
10
|
+
|
|
11
|
+
let _JsvFragShaderView;
|
|
12
|
+
if (window.JsView) {
|
|
13
|
+
_JsvFragShaderView = JsvFragShaderView.default;
|
|
14
|
+
} else {
|
|
15
|
+
const BrowserJsvFragShaderView = await import("./BrowserJsvFragShaderView.vue");
|
|
16
|
+
_JsvFragShaderView = BrowserJsvFragShaderView.default;
|
|
17
|
+
}
|
|
18
|
+
export default _JsvFragShaderView;
|