@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.
Files changed (126) hide show
  1. package/bin/browser/BrowserAudio.vue.mjs +4 -1
  2. package/bin/jsview-vue-common.mjs +1 -1
  3. package/bin/jsview-vue.mjs +9771 -7511
  4. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +21 -1
  5. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
  6. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
  7. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
  8. package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
  9. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
  10. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
  11. package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +8 -1
  12. package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +2 -1
  13. package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +10 -7
  14. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
  15. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
  16. package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
  17. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
  18. package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
  19. package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
  20. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
  21. package/bin/types/utils/JsViewVueTools/ForgeHandles.d.ts +1 -0
  22. package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +43 -1
  23. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
  24. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +3 -3
  25. package/bin/types/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.d.ts +7 -0
  26. package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +15 -2
  27. package/bin/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +2 -0
  28. package/bin/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +4 -0
  29. package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
  30. package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
  31. package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
  32. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
  33. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
  34. package/bin/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +11 -0
  35. package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
  36. package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
  37. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
  38. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
  39. package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +2 -1
  40. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
  41. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
  42. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
  43. package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
  44. package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
  45. package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
  46. package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
  47. package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
  48. package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
  49. package/bin/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +72 -0
  50. package/bin/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +26 -0
  51. package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
  52. package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
  53. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +112 -0
  54. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
  55. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +142 -0
  56. package/bin/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +3 -1
  57. package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
  58. package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +4 -3
  59. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
  60. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
  61. package/bin/types/utils/JsViewVueWidget/index.d.ts +4 -1
  62. package/package.json +1 -1
  63. package/utils/JsViewEngineWidget/CheckType.js +3 -3
  64. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
  65. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +27 -1
  66. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
  67. package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
  68. package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
  69. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
  70. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +97 -13
  71. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +876 -412
  72. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +43 -2
  73. package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +38 -26
  74. package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +144 -73
  75. package/utils/JsViewEngineWidget/WidgetCommon.ts +12 -0
  76. package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +4 -0
  77. package/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue +13 -13
  78. package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
  79. package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
  80. package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
  81. package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +50 -32
  82. package/utils/JsViewVueTools/FeatureActive.ts +2 -1
  83. package/utils/JsViewVueTools/ForgeHandles.ts +5 -2
  84. package/utils/JsViewVueTools/JsvRuntimeBridge.js +109 -4
  85. package/utils/JsViewVueTools/JsvTextTools.ts +3 -1
  86. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
  87. package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +15 -12
  88. package/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.ts +36 -0
  89. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +24 -3
  90. package/utils/JsViewVueTools/JsvTextureStore/Store.ts +33 -21
  91. package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +56 -41
  92. package/utils/JsViewVueTools/index.js +0 -1
  93. package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
  94. package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
  95. package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
  96. package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
  97. package/utils/JsViewVueWidget/JsvDashPath.vue +150 -0
  98. package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
  99. package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +153 -0
  100. package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
  101. package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
  102. package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +26 -22
  103. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +1 -1
  104. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
  105. package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
  106. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +1 -0
  107. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
  108. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
  109. package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
  110. package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
  111. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -2
  112. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  113. package/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue +108 -0
  114. package/utils/JsViewVueWidget/JsvSoundPool.js +75 -12
  115. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
  116. package/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue +543 -0
  117. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +3 -3
  118. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue +644 -0
  119. package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -1
  120. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +56 -50
  121. package/utils/JsViewVueWidget/index.js +4 -1
  122. package/bin/browser/BrowserApic.vue.mjs +0 -114
  123. package/bin/browser/BrowserApic2.vue.mjs +0 -108
  124. package/bin/browser/BrowserApicLib.mjs +0 -431
  125. package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
  126. package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
@@ -1,431 +0,0 @@
1
- import { a as LoopToolBase, L as LoopType, A as ApicEndState } from '../jsview-vue-common.mjs';
2
-
3
- /*
4
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.js}
5
- */
6
- class PartLoopTool extends LoopToolBase {
7
- constructor(info_list) {
8
- super();
9
- this.mLoopPeriod = 0;
10
- this.mCurLoopStartFrame = 0;
11
- this.mCurLoopEndFrame = 0;
12
- this.mCurLoopNum = 0;
13
- this.mCurLoopCount = 0;
14
- if (info_list == null) {
15
- console.error("PartLoopTool info is null.");
16
- return;
17
- }
18
- this.mLoopInfo = info_list;
19
- }
20
- getNextIndex(curIndex) {
21
- if (!this.mValid) {
22
- return -1;
23
- }
24
- let next_index = -1;
25
- let loop_period_num = this.mLoopInfo.length;
26
- if (this.mLoopPeriod < loop_period_num) {
27
- if (curIndex < this.mCurLoopEndFrame) {
28
- next_index = curIndex + 1;
29
- } else {
30
- if (this.mCurLoopNum <= 0) {
31
- next_index = this.mCurLoopStartFrame;
32
- } else {
33
- this.mCurLoopCount++;
34
- if (this.mCurLoopCount >= this.mCurLoopNum) {
35
- this.mLoopPeriod++;
36
- if (this.mLoopPeriod < loop_period_num) {
37
- this.mValid = this.updateLoop();
38
- if (this.mValid) {
39
- this.mCurLoopCount = 0;
40
- next_index = this.mCurLoopStartFrame;
41
- }
42
- } else {
43
- }
44
- } else {
45
- next_index = this.mCurLoopStartFrame;
46
- }
47
- }
48
- }
49
- } else {
50
- }
51
- return next_index;
52
- }
53
- updateLoop() {
54
- let loop = this.mLoopInfo[this.mLoopPeriod];
55
- this.mCurLoopNum = loop[0];
56
- this.mCurLoopStartFrame = loop[1];
57
- this.mCurLoopEndFrame = loop[2];
58
- if (isNaN(this.mCurLoopNum) || isNaN(this.mCurLoopStartFrame) || isNaN(this.mCurLoopEndFrame) || this.mCurLoopStartFrame >= this.mTotalFrameNum || this.mCurLoopEndFrame >= this.mTotalFrameNum || this.mCurLoopStartFrame >= this.mCurLoopEndFrame) {
59
- console.error("data error, frame number out of size.", this.mLoopInfo);
60
- return false;
61
- } else {
62
- return true;
63
- }
64
- }
65
- setApicInfo(frameNum, loopNum) {
66
- this.mTotalFrameNum = frameNum;
67
- this.mValid = this.updateLoop();
68
- if (!this.mValid) {
69
- console.log("PartLoopTool init loop info error." + this.mLoopInfo.toString());
70
- } else {
71
- this.mNextFrameIndex = this.mCurLoopStartFrame;
72
- }
73
- }
74
- }
75
-
76
- /*
77
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/NormalLoopTool.js}
78
- */
79
- class NormalLoopTool extends LoopToolBase {
80
- constructor(loop_type, loop_num) {
81
- super();
82
- this.mLoopType = loop_type;
83
- this.mLoopNum = loop_num;
84
- this.mLoopCount = 0;
85
- }
86
- getNextIndex(curFrame) {
87
- if (!this.mValid) {
88
- return -1;
89
- }
90
- let next_index = -1;
91
- switch (this.mLoopType) {
92
- case LoopType.LOOP_DEFAULT:
93
- if (this.mLoopNum <= 0) {
94
- next_index = (curFrame + 1) % this.mTotalFrameNum;
95
- } else {
96
- if (curFrame == this.mTotalFrameNum - 1) {
97
- this.mLoopCount++;
98
- }
99
- next_index = this.mLoopCount >= this.mLoopNum ? -1 : (curFrame + 1) % this.mTotalFrameNum;
100
- }
101
- break;
102
- case LoopType.LOOP_INFINITE:
103
- next_index = (curFrame + 1) % this.mTotalFrameNum;
104
- break;
105
- case LoopType.LOOP_FINITE:
106
- if (curFrame == this.mTotalFrameNum - 1) {
107
- this.mLoopCount++;
108
- }
109
- next_index = this.mLoopCount >= this.mLoopNum ? -1 : (curFrame + 1) % this.mTotalFrameNum;
110
- break;
111
- default:
112
- }
113
- return next_index;
114
- }
115
- setApicInfo(frameNum, loopNum) {
116
- this.mTotalFrameNum = frameNum;
117
- this.mLoopNum = this.mLoopType == LoopType.LOOP_DEFAULT ? loopNum : this.mLoopNum;
118
- this.mNextFrameIndex = 0;
119
- this.mValid = true;
120
- }
121
- }
122
-
123
- /*
124
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.js}
125
- */
126
- class SingleLoopTool extends LoopToolBase {
127
- constructor(index) {
128
- super();
129
- this.mTargetIndex = index;
130
- }
131
- getNextIndex(curIndex) {
132
- return -1;
133
- }
134
- setApicInfo(frame_num, loop_num) {
135
- this.mTotalFrameNum = frame_num;
136
- this.mNextFrameIndex = this.mTargetIndex;
137
- }
138
- }
139
-
140
- /*
141
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js}
142
- */
143
- class Viewer {
144
- constructor(apic_data, canvas, listener) {
145
- this._ApicData = apic_data;
146
- this._Canvas = canvas;
147
- this._Context = this._Canvas.getContext("2d");
148
- this._Listener = listener;
149
- this._TimeoutId = -1;
150
- this._EndState = ApicEndState.LAST_FRAME;
151
- this._CurrentIndex = -1;
152
- }
153
- _createLoopTool(loop_type, loop_info) {
154
- let loop_num = null;
155
- switch (loop_type) {
156
- case LoopType.LOOP_DEFAULT:
157
- case LoopType.LOOP_INFINITE:
158
- case LoopType.LOOP_FINITE:
159
- loop_num = loop_type == LoopType.LOOP_DEFAULT ? this._ApicData.LoopCount : loop_info[0][0];
160
- this._LoopTool = new NormalLoopTool(
161
- loop_type,
162
- loop_num
163
- );
164
- break;
165
- case LoopType.LOOP_PART:
166
- this._LoopTool = new PartLoopTool(
167
- loop_info,
168
- this._ApicData.FrameCount
169
- );
170
- break;
171
- case LoopType.LOOP_SINGLE:
172
- this._LoopTool = new SingleLoopTool(loop_info[0][1]);
173
- break;
174
- default:
175
- this._LoopTool = new NormalLoopTool(
176
- LoopType.LOOP_DEFAULT,
177
- -1
178
- );
179
- }
180
- this._LoopTool.setApicInfo(this._ApicData.FrameCount, this._ApicData.LoopCount);
181
- }
182
- stop(frameCount = -1) {
183
- clearTimeout(this._TimeoutId);
184
- if (frameCount >= 0 && this._CurrentIndex !== frameCount) {
185
- this._CurrentIndex = frameCount;
186
- this.renderFrame(frameCount);
187
- }
188
- if (this._Listener?.onend) {
189
- this._Listener.onend();
190
- }
191
- }
192
- play(loopType, loopInfo, endState = ApicEndState.LAST_FRAME) {
193
- this._EndState = endState;
194
- let lInfo;
195
- if (loopInfo instanceof Array) {
196
- lInfo = loopInfo;
197
- } else if (!isNaN(loopInfo)) {
198
- lInfo = [[loopInfo, 0, 0]];
199
- } else {
200
- lInfo = [[0, 0, 0]];
201
- }
202
- this._createLoopTool(loopType, lInfo);
203
- clearTimeout(this._TimeoutId);
204
- this.renderLoop();
205
- if (this._Listener?.onstart) {
206
- this._Listener.onstart();
207
- }
208
- }
209
- renderLoop() {
210
- if (this._LoopTool.hasNext()) {
211
- this._CurrentIndex = this._LoopTool.next();
212
- let duration = this.renderFrame(this._CurrentIndex);
213
- this._TimeoutId = setTimeout(() => {
214
- this.renderLoop();
215
- }, duration);
216
- } else {
217
- console.log("loop finished");
218
- if (this._EndState == ApicEndState.HIDE) {
219
- this._Context.clearRect(0, 0, this._Canvas.width, this._Canvas.height);
220
- }
221
- if (this._Listener?.onend) {
222
- this._Listener.onend();
223
- }
224
- }
225
- }
226
- renderFrame(frame_index) {
227
- return this._ApicData.toImage(frame_index, this._Canvas, this._Context);
228
- }
229
- }
230
-
231
- /*
232
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.js}
233
- */
234
- const renderDocument = window.JsvCode.Dom.RenderDocument ? window.JsvCode.Dom.RenderDocument : window.JsvCode.Dom.BrowserDocument;
235
- class ApicDataBase {
236
- constructor(arrayBuffer) {
237
- this.LoopCount = 0;
238
- this.FrameCount = 0;
239
- this.Width = 0;
240
- this.Height = 0;
241
- this._Canvas = renderDocument.createElement("canvas");
242
- this._Context = this._Canvas.getContext("2d");
243
- this._DecodedData = null;
244
- this.decode(arrayBuffer);
245
- }
246
- decode(arrayBuffer) {
247
- console.log("decode need override ", arrayBuffer);
248
- }
249
- toImage(frameIndex, canvas, canvasCtx) {
250
- console.log("toImage need override ", frameIndex, canvas, canvasCtx);
251
- }
252
- }
253
-
254
- /*
255
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/WebpData.js}
256
- */
257
- class WebpData extends ApicDataBase {
258
- decode(array_buffer) {
259
- let webp_data = new Uint8Array(array_buffer);
260
- let webp_decoder = new window.WebPDecoder();
261
- let image_data = window.WebPRiffParser(webp_data, 0);
262
- let blend = false;
263
- let header = image_data["header"] ? image_data["header"] : null;
264
- let frames = image_data["frames"] ? image_data["frames"] : null;
265
- if (header) {
266
- this.LoopCount = header["loop_count"];
267
- header["loop_counter"] = header["loop_count"];
268
- this._Canvas.height = header["canvas_height"];
269
- this._Canvas.width = header["canvas_width"];
270
- this.Width = header["canvas_width"];
271
- this.Height = header["canvas_height"];
272
- for (let f = 0; f < frames.length; f++) {
273
- if (frames[f]["blend"] === 0) {
274
- blend = true;
275
- break;
276
- }
277
- }
278
- }
279
- this.FrameCount = frames.length;
280
- for (let f = 0; f < frames.length; f++) {
281
- let height = [0];
282
- let width = [0];
283
- let frame = frames[f];
284
- let rgba = webp_decoder.WebPDecodeRGBA(
285
- webp_data,
286
- frame["src_off"],
287
- frame["src_size"],
288
- width,
289
- height
290
- );
291
- frame["rgba"] = rgba;
292
- frame["imgwidth"] = width[0];
293
- frame["imgheight"] = height[0];
294
- let oldimagedata = [];
295
- if (!header) {
296
- this._Canvas.height = height[0];
297
- this._Canvas.width = width[0];
298
- } else {
299
- if (blend) {
300
- let oldimagedata_ = this._Context.getImageData(
301
- frame["offset_x"],
302
- frame["offset_y"],
303
- width[0],
304
- height[0]
305
- );
306
- for (let i = 0; i < width[0] * height[0] * 4; i++) {
307
- oldimagedata[i] = oldimagedata_.data[i];
308
- }
309
- }
310
- }
311
- let imagedata = this._Context.createImageData(width[0], height[0]);
312
- if (frames.length === 1 && typeof frame["blend"] === "undefined" || frame["blend"] === 1) {
313
- for (let i = 0; i < width[0] * height[0] * 4; i++)
314
- imagedata.data[i] = rgba[i];
315
- } else {
316
- for (let i = 0; i < width[0] * height[0] * 4; i += 4) {
317
- if (rgba[i + 3] > 0) {
318
- imagedata.data[i + 3] = rgba[i + 3];
319
- imagedata.data[i] = rgba[i];
320
- imagedata.data[i + 1] = rgba[i + 1];
321
- imagedata.data[i + 2] = rgba[i + 2];
322
- } else {
323
- imagedata.data[i + 3] = oldimagedata[i + 3];
324
- imagedata.data[i] = oldimagedata[i];
325
- imagedata.data[i + 1] = oldimagedata[i + 1];
326
- imagedata.data[i + 2] = oldimagedata[i + 2];
327
- }
328
- }
329
- }
330
- if (frames.length === 1) {
331
- this._Context.putImageData(imagedata, 0, 0);
332
- } else {
333
- this._Context.putImageData(
334
- imagedata,
335
- frame["offset_x"],
336
- frame["offset_y"]
337
- );
338
- }
339
- frame["frameData"] = frame["rgba"] ? header ? this._Context.getImageData(
340
- 0,
341
- 0,
342
- header["canvas_width"],
343
- header["canvas_height"]
344
- ).data : rgba : null;
345
- if (frame["dispose"] === 1) {
346
- this._Context.clearRect(
347
- frame["offset_x"],
348
- frame["offset_y"],
349
- width[0],
350
- height[0]
351
- );
352
- }
353
- }
354
- this._DecodedData = image_data;
355
- }
356
- toImage(frame_index, canvas, canvas_ctx) {
357
- let frame = this._DecodedData["frames"][frame_index];
358
- let width = this._DecodedData["header"] ? this._DecodedData["header"]["canvas_width"] : frame["imgwidth"];
359
- let height = this._DecodedData["header"] ? this._DecodedData["header"]["canvas_height"] : frame["imgheight"];
360
- canvas.width = width;
361
- canvas.height = height;
362
- let image_data = canvas_ctx.createImageData(width, height);
363
- let frame_data = frame["frameData"];
364
- image_data.data.set(frame_data);
365
- canvas_ctx.putImageData(image_data, 0, 0);
366
- return frame["duration"];
367
- }
368
- }
369
-
370
- /*
371
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/GifData.js}
372
- */
373
- class GifData extends ApicDataBase {
374
- decode(array_buffer) {
375
- const gif = window.ApicTools.parseGIF(array_buffer);
376
- this._DecodedData = window.ApicTools.decompressFrames(gif, true);
377
- this.LoopCount = 0;
378
- this.FrameCount = this._DecodedData.length;
379
- this.Width = this._DecodedData[0].dims.width;
380
- this.Height = this._DecodedData[0].dims.height;
381
- for (let i = 0; i < this._DecodedData.length; i++) {
382
- let frame = this._DecodedData[i];
383
- if (frame["dims"]["width"] !== this.Width || frame["dims"]["height"] !== this.Height) {
384
- let pre_frame_data = this._DecodedData[i - 1]["frameData"];
385
- let left = frame["dims"]["left"];
386
- let top = frame["dims"]["top"];
387
- let width = frame["dims"]["width"];
388
- let height = frame["dims"]["height"];
389
- let patch_data = frame["patch"];
390
- let image_data = new Uint8ClampedArray(this.Width * this.Height * 4);
391
- for (let x = 0; x < this.Width; x++) {
392
- for (let y = 0; y < this.Height; y++) {
393
- let patch_x = x - left;
394
- let patch_y = y - top;
395
- let pixel_index = y * this.Width + x;
396
- let patch_pixel_index = patch_y * width + patch_x;
397
- if (x >= left && x < left + width && y >= top && y < top + height && patch_data[patch_pixel_index * 4 + 3] > 0) {
398
- image_data[pixel_index * 4] = patch_data[patch_pixel_index * 4];
399
- image_data[pixel_index * 4 + 1] = patch_data[patch_pixel_index * 4 + 1];
400
- image_data[pixel_index * 4 + 2] = patch_data[patch_pixel_index * 4 + 2];
401
- image_data[pixel_index * 4 + 3] = patch_data[patch_pixel_index * 4 + 3];
402
- } else {
403
- image_data[pixel_index * 4] = pre_frame_data[pixel_index * 4];
404
- image_data[pixel_index * 4 + 1] = pre_frame_data[pixel_index * 4 + 1];
405
- image_data[pixel_index * 4 + 2] = pre_frame_data[pixel_index * 4 + 2];
406
- image_data[pixel_index * 4 + 3] = pre_frame_data[pixel_index * 4 + 3];
407
- }
408
- }
409
- }
410
- frame["frameData"] = image_data;
411
- } else {
412
- frame["frameData"] = frame["patch"];
413
- }
414
- }
415
- }
416
- toImage(frame_index, canvas, canvas_ctx) {
417
- canvas.width = this.Width;
418
- canvas.height = this.Height;
419
- let frame = this._DecodedData[frame_index];
420
- let image_data = canvas_ctx.createImageData(this.Width, this.Height);
421
- image_data.data.set(frame["frameData"]);
422
- canvas_ctx.putImageData(image_data, 0, 0);
423
- return frame["delay"];
424
- }
425
- }
426
-
427
- /*
428
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.js}
429
- */
430
-
431
- export { GifData as G, Viewer as V, WebpData as W };
@@ -1,2 +0,0 @@
1
- export function enableNativeViewListener(nativeViewId: any, info: any): number;
2
- export function disableNativeViewListener(listenerId: any): void;
@@ -1,81 +0,0 @@
1
- let interfaceLoaded = false;
2
- let idGeneratoer = 1;
3
- let idObjectMap = {};
4
-
5
- const ensureInterface = ()=>{
6
- return new Promise((resolve, reject)=>{
7
- if (interfaceLoaded) {
8
- // 已经加载完成
9
- resolve();
10
- return;
11
- }
12
-
13
- if (window.JsView) {
14
- let cb = ()=>{
15
- // dynamic加载完成
16
- if (window.jJsvDemoTester) {
17
- console.log("window.jJsvDemoTester ready")
18
- } else {
19
- console.log("window.jJsvDemoTester failed")
20
- }
21
-
22
- console.log("remove cb=" + cb);
23
-
24
- // 移除回调
25
- window.JsView.removeEventListener(cb);
26
-
27
- // 无论成功失败,暂且都论为加载完成
28
- interfaceLoaded = true;
29
- resolve();
30
- };
31
- window.JsView.addEventListener("__DemoTesterReady", cb);
32
- window.JsView.ensureTesterUtils();
33
- } else {
34
- interfaceLoaded = true;
35
- resolve(); // 非JsView场景,默认为完成状态
36
- }
37
- });
38
- }
39
-
40
- const enableNativeViewListener = (nativeViewId,info)=>{
41
- let listenerId = idGeneratoer;
42
- idGeneratoer++;
43
- idObjectMap[listenerId] = {
44
- eventCallback: (ret)=>{
45
- info.value=ret.info
46
- console.log(`JsvDemoTester nativeView info=${info.value}`);
47
- }
48
- };
49
-
50
- (async ()=>{
51
- await ensureInterface();
52
-
53
- if (idObjectMap.hasOwnProperty(listenerId)) {
54
- let eventName = "__enableNativeViewListener_" + listenerId;
55
-
56
- window.JsView?.addEventListener(eventName, idObjectMap[listenerId].eventCallback);
57
- window.jJsvDemoTester?.enableNativeViewListener(nativeViewId, listenerId, eventName);
58
- }
59
- })();
60
-
61
- return listenerId; // 用于 disableNativeViewListener() 调用
62
- }
63
-
64
- const disableNativeViewListener = (listenerId)=>{
65
- (async ()=>{
66
- await ensureInterface();
67
-
68
- if (idObjectMap.hasOwnProperty(listenerId)) {
69
- window.JsView?.removeEventListener(idObjectMap[listenerId].eventCallback);
70
- window.jJsvDemoTester?.disableNativeViewListener(listenerId);
71
- delete idObjectMap[listenerId];
72
- } else {
73
- console.warn("disableNativeViewListener id gone");
74
- }
75
- })();
76
- }
77
-
78
- export {
79
- enableNativeViewListener,
80
- disableNativeViewListener,
81
- }