@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
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* @prop {Array} uniforms uniform参数, [{ name: string, value: number }]
|
|
13
13
|
* @prop {Array} textures texture参数, [{ name: string, resource: string }]
|
|
14
14
|
* @prop {() => void} onStart 动画开始回调
|
|
15
|
+
* @prop {boolean} reverseAnimate 是否反向动画
|
|
15
16
|
* @prop {(int,boolean) => void} onEnd
|
|
16
17
|
* 动画结束回调,
|
|
17
18
|
* 返回值1号 int: 回到参数为动画的序列号,和startAnim的返回值匹配
|
|
@@ -65,6 +66,10 @@ const rProps = defineProps({
|
|
|
65
66
|
type: Boolean,
|
|
66
67
|
default: false,
|
|
67
68
|
},
|
|
69
|
+
reverseAnimate: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
68
73
|
shaderStr: {
|
|
69
74
|
type: String,
|
|
70
75
|
required: true,
|
|
@@ -88,8 +93,6 @@ const rProps = defineProps({
|
|
|
88
93
|
// 激活引擎中的功能支持
|
|
89
94
|
JsvUseFeature("JsvFragShaderView", FeatureNames.CustomFragShader);
|
|
90
95
|
|
|
91
|
-
console.log("LudlDebug using JsvFragShaderView...");
|
|
92
|
-
|
|
93
96
|
let rAnimRunning = shallowRef(false); // 动画是否在执行,画面只在动画进行时进行显示
|
|
94
97
|
let vPreloadHandler = null;
|
|
95
98
|
let vPreloadDone = false;
|
|
@@ -133,26 +136,25 @@ if (rProps.textures) {
|
|
|
133
136
|
});
|
|
134
137
|
preload_textures.push(new JsvTextureLoadTool.ItemSet(image_url));
|
|
135
138
|
}
|
|
139
|
+
}
|
|
140
|
+
// 对图片进行预加载,等所有图片预加载完成后才能开始动画,以确保动画的完整性
|
|
136
141
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
vPreloadHandler = JsvTextureLoadTool.preload(preload_textures, () => {
|
|
140
|
-
vPreloadDone = true;
|
|
142
|
+
vPreloadHandler = JsvTextureLoadTool.preload(preload_textures, () => {
|
|
143
|
+
vPreloadDone = true;
|
|
141
144
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
// 加载完成后直接释放句柄即可
|
|
146
|
+
vPreloadHandler.recycleResource();
|
|
147
|
+
vPreloadHandler = null;
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
149
|
+
if (vStartingPromise != null) {
|
|
150
|
+
vStartingPromise.resolve();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
if (vPreloadHandler == null) {
|
|
154
|
+
// 无需要preload的内容,直接视为preloadDone
|
|
155
|
+
vPreloadDone = true;
|
|
156
|
+
if (vStartingPromise != null) {
|
|
157
|
+
vStartingPromise.resolve();
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
}
|
|
@@ -178,7 +180,7 @@ function clearStartAnimTimeout() {
|
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
const startAnim = (alt_duration, on_timeout_func) => {
|
|
183
|
+
const startAnim = (alt_duration, on_timeout_func, reverse = false) => {
|
|
182
184
|
vStartingPromise = null; // 重置promise回执处理
|
|
183
185
|
rAnimRunning.value = false;
|
|
184
186
|
vStartToken++;
|
|
@@ -223,7 +225,9 @@ const startAnim = (alt_duration, on_timeout_func) => {
|
|
|
223
225
|
|
|
224
226
|
if (duration > 0) {
|
|
225
227
|
let shaderAnimation = new Forge.ShaderAnimation(duration, null);
|
|
226
|
-
shaderAnimation.Enable(
|
|
228
|
+
shaderAnimation.Enable(
|
|
229
|
+
0x1 | (reverse ? Forge.AnimationEnable.Reverse : 0)
|
|
230
|
+
); // ReleaseAfterEndCallback
|
|
227
231
|
shaderAnimation.SetAnimationListener(
|
|
228
232
|
new Forge.AnimationListener(
|
|
229
233
|
null /* animation的onStart目前不调用 */,
|
|
@@ -263,7 +267,7 @@ const stopAnim = () => {
|
|
|
263
267
|
|
|
264
268
|
onMounted(() => {
|
|
265
269
|
if (rProps.autoplay) {
|
|
266
|
-
startAnim(rProps.duration);
|
|
270
|
+
startAnim(rProps.duration, undefined, rProps.reverseAnimate);
|
|
267
271
|
}
|
|
268
272
|
});
|
|
269
273
|
|
|
@@ -280,7 +280,7 @@ class ActorPackBuilder {
|
|
|
280
280
|
ActOnGetToSpeed(
|
|
281
281
|
this,
|
|
282
282
|
xSpeed, ySpeed,
|
|
283
|
-
[ActionCmdBuilder.
|
|
283
|
+
[ActionCmdBuilder.SetAccel(0, 0),
|
|
284
284
|
this._NexusRecv ? StateCmdBuilder.FireNexusEvent(ActEventDefine.ActFinish, this._NexusRecv.token) : null
|
|
285
285
|
],
|
|
286
286
|
true, // isFinal
|
|
@@ -24,6 +24,14 @@ class StatePackBuilder {
|
|
|
24
24
|
return CmdPackBuilder.InitStateCmdPack(StateCmdBuilder.RemoveByGroup(group));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/*
|
|
28
|
+
* removeConditionByGroup
|
|
29
|
+
* 清理指定名字的condition
|
|
30
|
+
*/
|
|
31
|
+
removeConditionByName(specName: String) {
|
|
32
|
+
return CmdPackBuilder.InitStateCmdPack(StateCmdBuilder.RemoveByName(specName));
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
/**
|
|
28
36
|
* activeCondition
|
|
29
37
|
* 重新激活对应gid或者specName的condition
|
|
@@ -24,7 +24,7 @@ export class EditViewOperator {
|
|
|
24
24
|
private _EditViewHandle: any = null;
|
|
25
25
|
private _CursorHandle: CursorOperater | null = null;
|
|
26
26
|
private _EditViewId: number = -1;
|
|
27
|
-
private _CursorResumeTimeoutToken:
|
|
27
|
+
private _CursorResumeTimeoutToken: any = -1;
|
|
28
28
|
|
|
29
29
|
private _InputType: number = 0;
|
|
30
30
|
private _FontStyle: FontStyleDefine | null = null
|
|
@@ -157,6 +157,7 @@ function _OnTextChanged(input_final_text, dsp_text) {
|
|
|
157
157
|
);
|
|
158
158
|
rInputFinalText.value = dsp_text;
|
|
159
159
|
rInputFinalTextLenth.value = dsp_text.length;
|
|
160
|
+
rProps.onTextChange?.(dsp_text);
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
function _OnCursorPositionChanged(text_left, cursor_left) {
|
|
@@ -168,15 +168,6 @@ export default {
|
|
|
168
168
|
|
|
169
169
|
<template>
|
|
170
170
|
<div
|
|
171
|
-
v-if="html"
|
|
172
|
-
ref="innerViewDiv"
|
|
173
|
-
:style="{
|
|
174
|
-
top: style.top,
|
|
175
|
-
left: style.left,
|
|
176
|
-
}"
|
|
177
|
-
></div>
|
|
178
|
-
<div
|
|
179
|
-
v-else
|
|
180
171
|
:data-jsv-vw-innerview="innerViewId"
|
|
181
172
|
:style="{
|
|
182
173
|
top: style.top,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @param {Object} style 布局样式(必须),必须包含的信息为{left, top, width, height}
|
|
8
8
|
* @param {function} getId 回调函数,用于接收ID信息,ID信息用于Native端对该view进行跟踪的标识
|
|
9
9
|
* @param {String} setId 给定命名ID,避免同进程不同context重名要和Context相关,
|
|
10
|
-
* 例如`${window.
|
|
10
|
+
* 例如`${window.JsvCoreApi?.getJsContextId()}_${you_name}`
|
|
11
11
|
* @param {number} corner 圆角的尺寸,默认为0
|
|
12
12
|
* @param {number} oversize 为了去除黑边的调整选项,让native video的尺寸信息比扣洞大多少, 默认为0
|
|
13
13
|
* @param {boolean} frontLayer 视图是在JsView界面前方,不是需要扣洞的后方,默认为false
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
<script setup>
|
|
18
18
|
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
|
|
19
|
-
import ForgeHandles from "../JsViewVueTools/ForgeHandles";
|
|
20
19
|
import { JsvTextureStoreApi } from "../JsViewVueTools/JsvTextureStore/JsvTextureStore";
|
|
21
20
|
import { onUnmounted, shallowRef } from "vue";
|
|
22
21
|
import JsvNinePatch from "./JsvNinePatch.vue";
|
|
@@ -49,77 +48,69 @@ let vInnerViewId = -1;
|
|
|
49
48
|
let vNinePatchSet = null;
|
|
50
49
|
let vBackgroudnColorValue = null;
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} else {
|
|
95
|
-
// 用背景色
|
|
96
|
-
vBackgroudnColorValue = "rgba(0,0,0,0)";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// 通过内置函数构造定制的NativeSharedView
|
|
101
|
-
vJsvMainView = new Forge.NativeSharedView();
|
|
102
|
-
vInnerViewId = Forge.sViewStore.add(new Forge.ViewInfo(vJsvMainView));
|
|
103
|
-
if (rProps.oversize != 0) {
|
|
104
|
-
vJsvMainView.SetOverSize(rProps.oversize);
|
|
51
|
+
// 创建JsView图层穿透的texture,抠洞处理
|
|
52
|
+
|
|
53
|
+
if (!rProps.frontLayer) {
|
|
54
|
+
// 有圆角
|
|
55
|
+
if (rProps.corner > 0) {
|
|
56
|
+
let presetGap = 1; // 外延距离,以保证圆角光滑
|
|
57
|
+
vNinePatchSet = {
|
|
58
|
+
imageSize: (rProps.corner + presetGap) * 2, // 半径 + 中心点1像素
|
|
59
|
+
textureName: null,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// 用 JsvTextureStoreApi 绘制半径对等的圆形
|
|
63
|
+
let sampleImageWidth = vNinePatchSet.imageSize;
|
|
64
|
+
let innerRadius2 = sampleImageWidth; // 内直径
|
|
65
|
+
let circleLineWidth = 1.5 * rProps.corner + presetGap - rProps.corner; // 线粗要把四角盖上
|
|
66
|
+
let canvasRef;
|
|
67
|
+
|
|
68
|
+
// 创建画布
|
|
69
|
+
canvasRef = JsvTextureStoreApi.canvasTexture(
|
|
70
|
+
sampleImageWidth,
|
|
71
|
+
sampleImageWidth
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
let circleRadius =
|
|
75
|
+
Math.floor(innerRadius2 / 2) +
|
|
76
|
+
Math.floor(circleLineWidth / 2) -
|
|
77
|
+
presetGap; // 圆环绘制路径是粗线的中心线,所以要减去一半的线宽
|
|
78
|
+
let customPath = canvasRef.circlePath(
|
|
79
|
+
Math.floor(sampleImageWidth / 2),
|
|
80
|
+
Math.floor(sampleImageWidth / 2),
|
|
81
|
+
circleRadius
|
|
82
|
+
); // 创建圆环绘制路径,圆形在画布的中心点位置
|
|
83
|
+
canvasRef.drawColor("rgba(0,0,0,0)"); // 画布绘制透明底色
|
|
84
|
+
customPath.stroke(circleLineWidth, "#FF0000FF"); // 绘制alpha=1的边缘留色
|
|
85
|
+
|
|
86
|
+
// 获取填入url的内容
|
|
87
|
+
// 进行.9拉伸以适配目标尺寸
|
|
88
|
+
// 通过 alphaOverride 进行alpah叠加
|
|
89
|
+
vNinePatchSet.textureName = canvasRef.commit();
|
|
90
|
+
} else {
|
|
91
|
+
// 用背景色
|
|
92
|
+
vBackgroudnColorValue = "rgba(0,0,0,0)";
|
|
105
93
|
}
|
|
94
|
+
}
|
|
106
95
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
96
|
+
// 通过内置函数构造定制的NativeSharedView
|
|
97
|
+
vJsvMainView = new Forge.NativeSharedView();
|
|
98
|
+
vInnerViewId = Forge.sViewStore.add(new Forge.ViewInfo(vJsvMainView));
|
|
99
|
+
if (rProps.oversize != 0) {
|
|
100
|
+
vJsvMainView.SetOverSize(rProps.oversize);
|
|
101
|
+
}
|
|
113
102
|
|
|
114
|
-
|
|
103
|
+
// 更新宽高
|
|
104
|
+
if (typeof vJsvMainView != "undefined" && vJsvMainView) {
|
|
105
|
+
if (rProps.setId) {
|
|
106
|
+
// 使用设置进来的track id,而非自动生成
|
|
107
|
+
vJsvMainView.SetTrackId(rProps.setId);
|
|
115
108
|
}
|
|
109
|
+
|
|
110
|
+
rProps.getId?.(vJsvMainView.GetTrackId());
|
|
116
111
|
}
|
|
117
112
|
|
|
118
113
|
onUnmounted(() => {
|
|
119
|
-
if (!window.JsView) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
114
|
// 清理View管理缓存
|
|
124
115
|
if (vInnerViewId !== -1) {
|
|
125
116
|
Forge.sViewStore.remove(vInnerViewId);
|
|
@@ -135,7 +126,6 @@ onUnmounted(() => {
|
|
|
135
126
|
|
|
136
127
|
<template>
|
|
137
128
|
<div
|
|
138
|
-
v-if="!isBrowserDebug"
|
|
139
129
|
:style="{
|
|
140
130
|
left: style.left,
|
|
141
131
|
top: style.top,
|
|
@@ -173,8 +163,4 @@ onUnmounted(() => {
|
|
|
173
163
|
<slot />
|
|
174
164
|
</div>
|
|
175
165
|
</div>
|
|
176
|
-
|
|
177
|
-
<div v-else :style="{ ...style }">
|
|
178
|
-
<slot />
|
|
179
|
-
</div>
|
|
180
166
|
</template>
|
|
@@ -2,38 +2,44 @@
|
|
|
2
2
|
* @file
|
|
3
3
|
*
|
|
4
4
|
* 【模块 export 内容】
|
|
5
|
-
* JsvPosterDiv:Vue
|
|
5
|
+
* JsvPosterDiv:Vue高阶组件,海报描画, 其字内容为占位图
|
|
6
6
|
* props说明:
|
|
7
7
|
* style {Object} 包含
|
|
8
8
|
* left/top/width/height
|
|
9
9
|
* border-radius
|
|
10
10
|
* backgroundImage/backgroundColor
|
|
11
11
|
* 的style设置
|
|
12
|
+
* enableAA: {boolean} 启用非全局的抗锯齿处理,不过这个处理会使绘制的矩形比原尺寸每边少2~3像素点
|
|
12
13
|
-->
|
|
13
14
|
<script setup>
|
|
14
|
-
|
|
15
|
-
import { reactive, watchEffect } from "vue";
|
|
15
|
+
import { reactive, watchEffect, shallowRef } from "vue";
|
|
16
16
|
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
style: Object,
|
|
19
|
+
enableAA: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
19
23
|
});
|
|
20
24
|
|
|
21
25
|
let common_style = reactive({});
|
|
22
26
|
let image_style = reactive({});
|
|
27
|
+
let rEnableAA = shallowRef("0");
|
|
23
28
|
|
|
24
|
-
watchEffect(()=>{
|
|
29
|
+
watchEffect(() => {
|
|
25
30
|
if (props.style) {
|
|
26
|
-
let {left, top, width, height, ...others} = props.style;
|
|
31
|
+
let { left, top, width, height, transformStyle, ...others } = props.style;
|
|
27
32
|
|
|
28
33
|
common_style.left = left;
|
|
29
34
|
common_style.top = top;
|
|
35
|
+
common_style.transformStyle = transformStyle;
|
|
30
36
|
|
|
31
37
|
image_style.width = width;
|
|
32
38
|
image_style.height = height;
|
|
33
|
-
Object.assign(image_style, others)
|
|
39
|
+
Object.assign(image_style, others);
|
|
34
40
|
}
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
rEnableAA.value = props.enableAA ? "1" : "0";
|
|
42
|
+
});
|
|
37
43
|
</script>
|
|
38
44
|
|
|
39
45
|
<template>
|
|
@@ -43,6 +49,7 @@ watchEffect(()=>{
|
|
|
43
49
|
data-jsv-vw-enable-fade="true"
|
|
44
50
|
data-jsv-vw-mask-poster-on-top="true"
|
|
45
51
|
:style="image_style"
|
|
52
|
+
:data-jsv-img-enable-aa="rEnableAA"
|
|
46
53
|
v-bind="$attrs"
|
|
47
54
|
/>
|
|
48
55
|
</div>
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* src {string} 图片的加载地址
|
|
11
11
|
* fadeIn: {boolean} 图片加载完成是否有淡入效果,默认为打开
|
|
12
12
|
* isPosterImage: 标识是否用于海报位,对于海报位的内容,可以有下载线程控制等策略来优化整体体验
|
|
13
|
+
* enableAA: {boolean} 启用非全局的抗锯齿处理,不过这个处理会使绘制的矩形比原尺寸每边少2~3像素点
|
|
13
14
|
-->
|
|
14
15
|
|
|
15
16
|
<script setup>
|
|
16
|
-
import { reactive, watchEffect, computed } from "vue";
|
|
17
|
+
import { reactive, watchEffect, computed, shallowRef } from "vue";
|
|
17
18
|
import { JsvPerformance } from "../JsViewVueTools/JsvPerformance.ts";
|
|
18
19
|
|
|
19
20
|
const props = defineProps({
|
|
@@ -37,6 +38,10 @@ const props = defineProps({
|
|
|
37
38
|
type: String,
|
|
38
39
|
default: null,
|
|
39
40
|
},
|
|
41
|
+
enableAA: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
40
45
|
style: Object,
|
|
41
46
|
});
|
|
42
47
|
|
|
@@ -52,6 +57,7 @@ const isPosterImage = computed(() => {
|
|
|
52
57
|
|
|
53
58
|
let common_style = reactive({});
|
|
54
59
|
let image_style = reactive({});
|
|
60
|
+
let rEnableAA = shallowRef("0");
|
|
55
61
|
|
|
56
62
|
watchEffect(() => {
|
|
57
63
|
if (props.style) {
|
|
@@ -61,6 +67,7 @@ watchEffect(() => {
|
|
|
61
67
|
top,
|
|
62
68
|
width,
|
|
63
69
|
height,
|
|
70
|
+
transformStyle,
|
|
64
71
|
backgroundImage,
|
|
65
72
|
backgroundColor,
|
|
66
73
|
...others
|
|
@@ -69,11 +76,13 @@ watchEffect(() => {
|
|
|
69
76
|
// 承接x,y偏移和动画设置, 规避默认淡出动画被影响
|
|
70
77
|
common_style.left = left;
|
|
71
78
|
common_style.top = top;
|
|
79
|
+
common_style.transformStyle = transformStyle;
|
|
72
80
|
|
|
73
81
|
image_style.width = width;
|
|
74
82
|
image_style.height = height;
|
|
75
83
|
Object.assign(image_style, others);
|
|
76
84
|
}
|
|
85
|
+
rEnableAA.value = props.enableAA ? "1" : "0";
|
|
77
86
|
});
|
|
78
87
|
</script>
|
|
79
88
|
|
|
@@ -87,6 +96,7 @@ watchEffect(() => {
|
|
|
87
96
|
:data-jsv-img-scaledown-tex="scaleddown"
|
|
88
97
|
:data-jsv-img-color-space="colorSpace"
|
|
89
98
|
:data-jsv-img-poster-image="isPosterImage"
|
|
99
|
+
:data-jsv-img-enable-aa="rEnableAA"
|
|
90
100
|
:style="image_style"
|
|
91
101
|
:src="props.src"
|
|
92
102
|
v-bind="$attrs"
|
|
@@ -197,13 +197,13 @@ const _getPreloadViewIdList = () => {
|
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
const callback_token = texture.RegisterLoadImageCallback(null, (params) => {
|
|
200
|
-
console.log(`preload succeed ${image_url}`, params);
|
|
200
|
+
// console.log(`preload succeed ${image_url}`, params);
|
|
201
201
|
preloadStateList[index] = true;
|
|
202
202
|
preloadResultMap[item.url] = {
|
|
203
203
|
width: params.width,
|
|
204
204
|
height: params.height,
|
|
205
205
|
};
|
|
206
|
-
console.log(`preload succeed ${item.url}, params:${params}`);
|
|
206
|
+
// console.log(`preload succeed ${item.url}, params:${params}`);
|
|
207
207
|
_checkPreload();
|
|
208
208
|
});
|
|
209
209
|
texture.EnableBackgroundLoad();
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="root">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import ActorControl from "./JsvFreeMoveActor/ActorControl";
|
|
9
|
+
import { shallowRef, onMounted, computed, ref } from "vue";
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
initPosition: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: () => [0, 0],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const ReachConditionGroup = 2;
|
|
19
|
+
|
|
20
|
+
const root = shallowRef();
|
|
21
|
+
const actorControl = new ActorControl();
|
|
22
|
+
let preTarget = props.initPosition;
|
|
23
|
+
let curTarget = props.initPosition;
|
|
24
|
+
|
|
25
|
+
onMounted(() => {
|
|
26
|
+
actorControl.bindForgeView(root.value.jsvGetProxyView(), true);
|
|
27
|
+
// 初始化位置
|
|
28
|
+
actorControl.run((cmds) => [
|
|
29
|
+
cmds.action().teleportTo(props.initPosition[0], props.initPosition[1]),
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
let curSpeed = 0;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 移动到指定位置
|
|
37
|
+
* @param speed 速度
|
|
38
|
+
* @param x 目标x坐标
|
|
39
|
+
* @param y 目标y坐标
|
|
40
|
+
* @param onReach 到达目标位置后的回调
|
|
41
|
+
* @param prex 到达前x坐标
|
|
42
|
+
* @param prey 到达前y坐标
|
|
43
|
+
* @param onPreReach 到达前回调
|
|
44
|
+
*/
|
|
45
|
+
const moveTo = (speed, x, y, onReach, prex, prey, onPreReach) => {
|
|
46
|
+
if (x == curTarget[0] && y == curTarget[1] && curSpeed == speed) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
curSpeed = speed;
|
|
50
|
+
let targetX = undefined;
|
|
51
|
+
let targetY = undefined;
|
|
52
|
+
let preTargetX = undefined;
|
|
53
|
+
let preTargetY = undefined;
|
|
54
|
+
let speedX = undefined;
|
|
55
|
+
let speedY = undefined;
|
|
56
|
+
|
|
57
|
+
preTarget = [curTarget[0], curTarget[1]];
|
|
58
|
+
curTarget = [x, y];
|
|
59
|
+
const vec = [x - preTarget[0], y - preTarget[1]];
|
|
60
|
+
const module = Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1]);
|
|
61
|
+
if (vec[0] != 0) {
|
|
62
|
+
speedX = (vec[0] / module) * speed;
|
|
63
|
+
targetX = x;
|
|
64
|
+
preTargetX = prex;
|
|
65
|
+
} else if (vec[1] != 0) {
|
|
66
|
+
speedY = (vec[1] / module) * speed;
|
|
67
|
+
targetY = y;
|
|
68
|
+
preTargetY = prey;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
actorControl.run((cmds) => [
|
|
72
|
+
cmds.state().removeConditionByGroup(ReachConditionGroup),
|
|
73
|
+
cmds.action(0, 0).setSpeed(speedX, speedY),
|
|
74
|
+
cmds
|
|
75
|
+
.condition(ReachConditionGroup)
|
|
76
|
+
.reachPosition(preTargetX, preTargetY)
|
|
77
|
+
.then([onPreReach]),
|
|
78
|
+
cmds
|
|
79
|
+
.condition(ReachConditionGroup)
|
|
80
|
+
.reachPosition(targetX, targetY)
|
|
81
|
+
.then([onReach]),
|
|
82
|
+
]);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 刹车到指定位置
|
|
87
|
+
* @param x 目标x坐标
|
|
88
|
+
* @param y 目标y坐标
|
|
89
|
+
*/
|
|
90
|
+
const brakeTo = (x, y) => {
|
|
91
|
+
actorControl.run((cmds) => [cmds.action(3, 0).brakeToPosition(x, y)]);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const stop = () => {
|
|
95
|
+
actorControl.run((cmds) => [cmds.action().setSpeed(0, 0)]);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const setSpeed = (speedX, speedY) => {
|
|
99
|
+
actorControl.run((cmds) => [cmds.action().setSpeed(speedX, speedY)]);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
defineExpose({
|
|
103
|
+
moveTo,
|
|
104
|
+
brakeTo,
|
|
105
|
+
stop,
|
|
106
|
+
setSpeed,
|
|
107
|
+
});
|
|
108
|
+
</script>
|