@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
|
@@ -49,22 +49,57 @@ class AudioController {
|
|
|
49
49
|
this._SoundId = soundId;
|
|
50
50
|
this._Url = url;
|
|
51
51
|
this._StreamId = -1;
|
|
52
|
+
this._StreamStartTime = 0;
|
|
53
|
+
this._SubStreamId = -1; // 快速重复播放的第二路音轨
|
|
54
|
+
this._SubStreamStartTime = 0;
|
|
55
|
+
this._LatestStreamStartTime = 0;
|
|
52
56
|
|
|
53
57
|
this._Rate = 1;
|
|
54
58
|
this._Loop = 0;
|
|
55
59
|
this._LeftVolume = 1;
|
|
56
60
|
this._RightVolume = 1;
|
|
57
61
|
this._Priority = 0;
|
|
62
|
+
this._FastRepeatGap = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
enableFastRepeat(mini_gap) {
|
|
66
|
+
this._FastRepeatGap = mini_gap;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
/**
|
|
61
70
|
* @description: 播放音频
|
|
62
71
|
*/
|
|
63
72
|
play() {
|
|
73
|
+
if (this._FastRepeatGap == 0) {
|
|
74
|
+
this._playMainStream(0);
|
|
75
|
+
} else {
|
|
76
|
+
let now = Date.now();
|
|
77
|
+
if (now - this._LatestStreamStartTime > this._FastRepeatGap / 2 && now - this._StreamStartTime > this._FastRepeatGap) {
|
|
78
|
+
this._playMainStream(now);
|
|
79
|
+
} else {
|
|
80
|
+
if (now - this._LatestStreamStartTime > this._FastRepeatGap / 2 && now - this._SubStreamStartTime > this._FastRepeatGap) {
|
|
81
|
+
this._playSubStream(now);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_playMainStream(now) {
|
|
64
88
|
if (this._StreamId !== -1) {
|
|
65
89
|
this._SoundPool.stop(this._StreamId);
|
|
66
90
|
}
|
|
67
91
|
this._StreamId = this._SoundPool.play(this._SoundId, this._LeftVolume, this._RightVolume, this._Priority, this._Loop, this._Rate);
|
|
92
|
+
this._StreamStartTime = now;
|
|
93
|
+
this._LatestStreamStartTime = now;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_playSubStream(now) {
|
|
97
|
+
if (this._SubStreamId !== -1) {
|
|
98
|
+
this._SoundPool.stop(this._SubStreamId);
|
|
99
|
+
}
|
|
100
|
+
this._SubStreamId = this._SoundPool.play(this._SoundId, this._LeftVolume, this._RightVolume, this._Priority, this._Loop, this._Rate);
|
|
101
|
+
this._SubStreamStartTime = now;
|
|
102
|
+
this._LatestStreamStartTime = now;
|
|
68
103
|
}
|
|
69
104
|
|
|
70
105
|
/**
|
|
@@ -74,6 +109,11 @@ class AudioController {
|
|
|
74
109
|
if (this._StreamId !== -1) {
|
|
75
110
|
this._SoundPool.pause(this._StreamId);
|
|
76
111
|
}
|
|
112
|
+
// 第二路直接停止即可
|
|
113
|
+
if (this._SubStreamId !== -1) {
|
|
114
|
+
this._SoundPool.stop(this._SubStreamId);
|
|
115
|
+
this._SubStreamId = -1;
|
|
116
|
+
}
|
|
77
117
|
}
|
|
78
118
|
|
|
79
119
|
/**
|
|
@@ -93,6 +133,10 @@ class AudioController {
|
|
|
93
133
|
this._SoundPool.stop(this._StreamId);
|
|
94
134
|
this._StreamId = -1;
|
|
95
135
|
}
|
|
136
|
+
if (this._SubStreamId !== -1) {
|
|
137
|
+
this._SoundPool.stop(this._SubStreamId);
|
|
138
|
+
this._SubStreamId = -1;
|
|
139
|
+
}
|
|
96
140
|
}
|
|
97
141
|
|
|
98
142
|
/**
|
|
@@ -100,10 +144,8 @@ class AudioController {
|
|
|
100
144
|
* @param {float} rate 播放的倍率
|
|
101
145
|
*/
|
|
102
146
|
setRate(rate) {
|
|
147
|
+
// 在起播前设置
|
|
103
148
|
this._Rate = rate;
|
|
104
|
-
if (this._Streamid !== -1) {
|
|
105
|
-
this._SoundPool.setRate(this._StreamId, this._Rate);
|
|
106
|
-
}
|
|
107
149
|
}
|
|
108
150
|
|
|
109
151
|
/**
|
|
@@ -112,11 +154,9 @@ class AudioController {
|
|
|
112
154
|
* @param {float} rightVolume 右声道音量
|
|
113
155
|
*/
|
|
114
156
|
setVolume(leftVolume, rightVolume) {
|
|
157
|
+
// 在起播前设置
|
|
115
158
|
this._LeftVolume = leftVolume;
|
|
116
159
|
this._RightVolume = rightVolume;
|
|
117
|
-
if (this._StreamId !== -1) {
|
|
118
|
-
this._SoundPool.setVolume(this._StreamId, this._LeftVolume, this._RightVolume);
|
|
119
|
-
}
|
|
120
160
|
}
|
|
121
161
|
|
|
122
162
|
/**
|
|
@@ -124,10 +164,8 @@ class AudioController {
|
|
|
124
164
|
* @param {int} loop 循环次数
|
|
125
165
|
*/
|
|
126
166
|
setLoop(loop) {
|
|
167
|
+
// 在起播前设置
|
|
127
168
|
this._Loop = loop;
|
|
128
|
-
if (this._StreamId !== -1) {
|
|
129
|
-
this._SoundPool.setLoop(this._StreamId, this._Loop);
|
|
130
|
-
}
|
|
131
169
|
}
|
|
132
170
|
|
|
133
171
|
/**
|
|
@@ -135,10 +173,8 @@ class AudioController {
|
|
|
135
173
|
* @param {int} priority 优先级
|
|
136
174
|
*/
|
|
137
175
|
setPriority(priority) {
|
|
176
|
+
// 在起播前设置
|
|
138
177
|
this._Priority = priority;
|
|
139
|
-
if (this._StreamId !== -1) {
|
|
140
|
-
this._SoundPool.setPriority(this._StreamId, this._Priority);
|
|
141
|
-
}
|
|
142
178
|
}
|
|
143
179
|
}
|
|
144
180
|
|
|
@@ -161,6 +197,30 @@ class JsvSoundPool {
|
|
|
161
197
|
* @param {function} callback 资源加载完成回调 function(int state, AudioController controller) {}
|
|
162
198
|
*/
|
|
163
199
|
request(url, netSetting, priority, callback) {
|
|
200
|
+
this._request(url, 0, netSetting, priority, callback);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @description: 准备音频资源
|
|
205
|
+
* @param {string} url 音频url
|
|
206
|
+
* @param {int} fastRepeatGap 最小间隔时间, 如果不为0则启用快速重复播放, 用两路音轨解决快速播放的漏音问题
|
|
207
|
+
* @param {string} netSetting http请求配置
|
|
208
|
+
* @param {int} priority 优先级
|
|
209
|
+
* @param {function} callback 资源加载完成回调 function(int state, AudioController controller) {}
|
|
210
|
+
*/
|
|
211
|
+
requestInRepeatMode(url, fastRepeatGap, netSetting, priority, callback) {
|
|
212
|
+
this._request(url, fastRepeatGap, netSetting, priority, callback);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @description: 准备音频资源
|
|
217
|
+
* @param {string} url 音频url
|
|
218
|
+
* @param {int} repeatFastMiniGap 最小间隔时间, 如果不为0则启用快速重复播放, 用两路音轨解决快速播放的漏音问题
|
|
219
|
+
* @param {string} netSetting http请求配置
|
|
220
|
+
* @param {int} priority 优先级
|
|
221
|
+
* @param {function} callback 资源加载完成回调 function(int state, AudioController controller) {}
|
|
222
|
+
*/
|
|
223
|
+
_request(url, repeatFastMiniGap, netSetting, priority, callback) {
|
|
164
224
|
if (!supportSoundPool) {
|
|
165
225
|
callback(-1, null);
|
|
166
226
|
console.log("not support sound pool.");
|
|
@@ -181,6 +241,9 @@ class JsvSoundPool {
|
|
|
181
241
|
referCount: 1
|
|
182
242
|
};
|
|
183
243
|
const controller = new AudioController(this._SoundPool, sound_id, realUrl);
|
|
244
|
+
if (repeatFastMiniGap > 0) {
|
|
245
|
+
controller.enableFastRepeat(repeatFastMiniGap);
|
|
246
|
+
}
|
|
184
247
|
this._StreamIdMap.add(controller);
|
|
185
248
|
callback(state, controller);
|
|
186
249
|
} else {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* pointRes {string} (必需)粒子图案 可选值: 绝对路径url|url(相对路径url)|#FFFFFF|rbga(255,0,0,1.0)
|
|
14
14
|
* sprayStyle {object} (必需)粒子效果配置
|
|
15
15
|
* ignoreClip {boolean} 无视clipView描画
|
|
16
|
+
* onStop {() => void} 停止喷射回调
|
|
16
17
|
*
|
|
17
18
|
* prop中的sprayStyle说明:
|
|
18
19
|
* type {int} (必需)喷射类型 0: 一次喷射 1: 持续喷射
|
|
@@ -38,13 +39,56 @@
|
|
|
38
39
|
* alphaMax {float} 透明度最大值, 默认为1
|
|
39
40
|
* angleMin {float} 角度最小值(角度)
|
|
40
41
|
* angleMax {float} 角度最大值(角度)
|
|
42
|
+
* 方法
|
|
43
|
+
* start { () => void }
|
|
44
|
+
* @descripe 开始喷射
|
|
45
|
+
* stop { (immediate: boolean) => void }
|
|
46
|
+
* @descripe 停止喷射
|
|
47
|
+
* @param immediate { boolean } 是否立即消除粒子, false时会停止喷射,等待已有粒子消失
|
|
41
48
|
-->
|
|
42
|
-
<script>
|
|
49
|
+
<script setup>
|
|
43
50
|
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
|
|
44
51
|
import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
|
|
45
52
|
import { urlCheckSet } from "../../JsViewVueTools";
|
|
53
|
+
import { ref, onBeforeUnmount, onUpdated, onMounted } from "vue";
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
const props = defineProps({
|
|
56
|
+
pointRes: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
sprayStyle: {
|
|
61
|
+
type: Object,
|
|
62
|
+
required: true,
|
|
63
|
+
},
|
|
64
|
+
ignoreClip: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
onStop: {
|
|
69
|
+
type: Function,
|
|
70
|
+
default: null,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const widthSize = ref(0);
|
|
75
|
+
const heightSize = ref(0);
|
|
76
|
+
let sprayView = null;
|
|
77
|
+
|
|
78
|
+
function unloadView() {
|
|
79
|
+
if (viewId.value != -1) {
|
|
80
|
+
Forge.sViewStore.remove(viewId.value);
|
|
81
|
+
viewId.value = -1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let buildForgeView = (
|
|
86
|
+
pointRes,
|
|
87
|
+
sprayStyle,
|
|
88
|
+
ignoreClip,
|
|
89
|
+
widthRef,
|
|
90
|
+
heightRef
|
|
91
|
+
) => {
|
|
48
92
|
if (!pointRes) {
|
|
49
93
|
return -1;
|
|
50
94
|
}
|
|
@@ -60,7 +104,7 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
|
|
|
60
104
|
texture_manager.GetImage2(image_url, false, null, "RGB_8888", null)
|
|
61
105
|
);
|
|
62
106
|
}
|
|
63
|
-
|
|
107
|
+
sprayView = new Forge.SprayView(texture_setting);
|
|
64
108
|
let add_speed = 0.1;
|
|
65
109
|
if (typeof sprayStyle.particleAddSpeed == "number") {
|
|
66
110
|
add_speed = sprayStyle.particleAddSpeed;
|
|
@@ -113,7 +157,7 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
|
|
|
113
157
|
}
|
|
114
158
|
}
|
|
115
159
|
|
|
116
|
-
|
|
160
|
+
sprayView.SetSprayInfo(
|
|
117
161
|
sprayStyle.type,
|
|
118
162
|
sprayStyle.particleNum,
|
|
119
163
|
add_speed,
|
|
@@ -142,69 +186,63 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
|
|
|
142
186
|
sprayStyle.deltaWidth === 0 ? 1 : 2 * sprayStyle.deltaWidth;
|
|
143
187
|
const view_height =
|
|
144
188
|
sprayStyle.deltaHeight === 0 ? 1 : 2 * sprayStyle.deltaHeight;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return Forge.sViewStore.add(new Forge.ViewInfo(
|
|
189
|
+
widthRef.value = view_width;
|
|
190
|
+
heightRef.value = view_height;
|
|
191
|
+
return Forge.sViewStore.add(new Forge.ViewInfo(sprayView, null));
|
|
148
192
|
};
|
|
193
|
+
const viewId = ref(
|
|
194
|
+
buildForgeView(
|
|
195
|
+
props.pointRes,
|
|
196
|
+
props.sprayStyle,
|
|
197
|
+
props.ignoreClip,
|
|
198
|
+
widthSize,
|
|
199
|
+
heightSize
|
|
200
|
+
)
|
|
201
|
+
);
|
|
149
202
|
|
|
150
|
-
|
|
151
|
-
props
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
189
|
-
},
|
|
190
|
-
updated() {
|
|
191
|
-
this.unloadView();
|
|
192
|
-
this.viewId = buildForgeView(
|
|
193
|
-
this.pointRes,
|
|
194
|
-
this.sprayStyle,
|
|
195
|
-
this.size,
|
|
196
|
-
this.ignoreClip
|
|
197
|
-
);
|
|
198
|
-
},
|
|
199
|
-
beforeUnmount() {
|
|
200
|
-
this.unloadView();
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
+
function onStop() {
|
|
204
|
+
props.onStop?.();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
sprayView.RegisterOnStop(onStop);
|
|
208
|
+
sprayView.RegisterEventListener();
|
|
209
|
+
|
|
210
|
+
function start() {
|
|
211
|
+
sprayView.Start();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function stop(immediate) {
|
|
215
|
+
sprayView.Stop(immediate);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
onMounted(() => {
|
|
219
|
+
start();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
onUpdated(() => {
|
|
223
|
+
unloadView();
|
|
224
|
+
viewId.value = buildForgeView(
|
|
225
|
+
props.pointRes,
|
|
226
|
+
props.sprayStyle,
|
|
227
|
+
props.ignoreClip,
|
|
228
|
+
widthSize,
|
|
229
|
+
heightSize
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
onBeforeUnmount(() => {
|
|
234
|
+
unloadView();
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
defineExpose({
|
|
238
|
+
start,
|
|
239
|
+
stop,
|
|
240
|
+
});
|
|
203
241
|
</script>
|
|
204
242
|
|
|
205
243
|
<template>
|
|
206
244
|
<div
|
|
207
|
-
:style="{ width:
|
|
245
|
+
:style="{ width: widthSize, height: heightSize }"
|
|
208
246
|
:data-jsv-vw-innerview="viewId"
|
|
209
247
|
></div>
|
|
210
248
|
</template>
|