@shijiu/jsview-vue 2.2.128 → 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.
Files changed (91) hide show
  1. package/bin/browser/BrowserApic.vue.mjs +2 -2
  2. package/bin/browser/BrowserApic2.vue.mjs +2 -2
  3. package/bin/browser/BrowserApicLib.mjs +8 -2
  4. package/bin/browser/BrowserJsvFragShaderView.vue.mjs +63 -0
  5. package/bin/jsview-vue.mjs +1604 -423
  6. package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +8 -6
  7. package/bin/types/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +10 -12
  8. package/bin/types/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +3 -3
  9. package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +3 -3
  10. package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +2 -2
  11. package/bin/types/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
  12. package/bin/types/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +1 -0
  13. package/bin/types/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +1 -1
  14. package/bin/types/JsViewEngineWidget/index.d.ts +10 -1
  15. package/bin/types/JsViewVueTools/ConstSymbol.d.ts +2 -2
  16. package/bin/types/JsViewVueTools/JsvFederationTools.d.ts +16 -0
  17. package/bin/types/JsViewVueTools/JsvPerformance.d.ts +5 -0
  18. package/bin/types/JsViewVueTools/JsvPreDownloader.d.ts +33 -0
  19. package/bin/types/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +45 -1
  20. package/bin/types/JsViewVueTools/index.d.ts +19 -11
  21. package/bin/types/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +1 -1
  22. package/bin/types/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +1 -1
  23. package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +1 -1
  24. package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +1 -1
  25. package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +2 -1
  26. package/bin/types/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +70 -0
  27. package/bin/types/JsViewVueWidget/JsvClipDiv/index.d.ts +1 -0
  28. package/bin/types/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +104 -0
  29. package/bin/types/JsViewVueWidget/JsvDriftScope/index.d.ts +1 -0
  30. package/bin/types/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue.d.ts +13 -0
  31. package/bin/types/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +13 -0
  32. package/bin/types/JsViewVueWidget/JsvFragShaderView/index.d.ts +2 -0
  33. package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +43 -17
  34. package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +5 -5
  35. package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +4 -2
  36. package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +7 -7
  37. package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +18 -0
  38. package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +2 -0
  39. package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +1 -0
  40. package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +61 -1
  41. package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +153 -0
  42. package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +4 -0
  43. package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +9 -4
  44. package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +2 -0
  45. package/bin/types/JsViewVueWidget/index.d.ts +3 -0
  46. package/package.json +1 -1
  47. package/tools/config/rollup.config.mjs +1 -0
  48. package/utils/JsViewEngineWidget/JsvFocus/{JsvFocusManager.js → JsvFocusManager.ts} +12 -12
  49. package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.ts +20 -0
  50. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +27 -10
  51. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +42 -10
  52. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +320 -203
  53. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +11 -0
  54. package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +8 -0
  55. package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +20 -10
  56. package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +18 -0
  57. package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +7 -0
  58. package/utils/JsViewEngineWidget/{index.js → index.ts} +1 -1
  59. package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +21 -2
  60. package/utils/JsViewVueTools/ConstSymbol.ts +2 -2
  61. package/utils/JsViewVueTools/JsvPreDownloader.ts +3 -3
  62. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +1 -1
  63. package/utils/JsViewVueTools/index.js +19 -19
  64. package/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue +2 -2
  65. package/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue +3 -3
  66. package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +2 -2
  67. package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +3 -3
  68. package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js +8 -3
  69. package/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue +42 -0
  70. package/utils/JsViewVueWidget/JsvClipDiv/index.ts +1 -0
  71. package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +5 -1
  72. package/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue +82 -0
  73. package/utils/JsViewVueWidget/JsvDriftScope/index.ts +1 -0
  74. package/utils/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue +48 -0
  75. package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +145 -0
  76. package/utils/JsViewVueWidget/JsvFragShaderView/index.js +18 -0
  77. package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +142 -63
  78. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +15 -6
  79. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +19 -7
  80. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +15 -11
  81. package/utils/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.ts +120 -0
  82. package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +5 -1
  83. package/utils/JsViewVueWidget/JsvNinePatch.vue +13 -1
  84. package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +257 -48
  85. package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +468 -0
  86. package/utils/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.ts +9 -0
  87. package/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.ts +13 -4
  88. package/utils/JsViewVueWidget/JsvScrollBox/index.ts +3 -0
  89. package/utils/JsViewVueWidget/index.js +3 -0
  90. package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.js +0 -19
  91. package/utils/JsViewVueWidget/JsvScrollBox/index.js +0 -2
@@ -16,6 +16,7 @@ interface ItemConfig {
16
16
  normalZIndex: number,
17
17
  itemSlide: number,
18
18
  permanent: boolean,
19
+ showSkeleton: boolean,
19
20
  }
20
21
 
21
22
  interface CustomerCallbackMap {
@@ -38,6 +39,7 @@ export class RenderItem {
38
39
  public touchInit: boolean = false;
39
40
  public rootDiv: HTMLDivElement | null = null;
40
41
  public enableTap: boolean = false;
42
+ public renderKey: Ref<number> = ref(0);
41
43
 
42
44
  private customerCallbackMap: CustomerCallbackMap = {};
43
45
  private onRef: (() => void) | null;
@@ -70,6 +72,14 @@ export class RenderItem {
70
72
  return this.templateInfo.index;
71
73
  }
72
74
 
75
+ public updateCustomData(newCustomData: object, newItemConfig: ItemConfig) {
76
+ this.customerData = newCustomData;
77
+ this.itemConfig = newItemConfig;
78
+ this.customerCallbackMap = {};
79
+ this.mounted.value = false;
80
+ this.renderKey.value++;
81
+ }
82
+
73
83
  //TODO item的div ref 会调用多次, 待调查
74
84
  public divRef = (ele: HTMLDivElement | null) => {
75
85
  this.rootDiv = ele;
@@ -162,5 +172,6 @@ export class RenderItem {
162
172
  private onDivUnmounted(): void {
163
173
  this.touchInit = false;
164
174
  this.divMountedCallback.clear();
175
+ this.customerCallbackMap = {};
165
176
  }
166
177
  }
@@ -211,4 +211,12 @@ export class TaskManager {
211
211
  this.cancellableRunnerList.push(cancellableRunner);
212
212
  cancellableRunner.run();
213
213
  }
214
+
215
+ public cancelAllTask() {
216
+ this.cleanTaskCache();
217
+ this.cancellableRunnerList.forEach(t => {
218
+ t.cancel();
219
+ });
220
+ this.cancellableRunnerList = [];
221
+ }
214
222
  }
@@ -794,18 +794,28 @@ class CommonMetroTemplate extends MetroTemplate {
794
794
  endIndex = baseItem.index;
795
795
  }
796
796
  if (Math.abs(startIndex - endIndex) <= 1) {
797
- const tailItem = this.templateList[this.getTailItemIndex()];
798
- let tailInfo: any = null;
799
- if (tailItem) {
800
- tailInfo = {
801
- left: tailItem.left,
802
- top: tailItem.top,
803
- width: tailItem.width,
804
- height: tailItem.height,
797
+ const startItem = this.templateList[startIndex];
798
+ const endItem = this.templateList[endIndex];
799
+ if (visible(startItem[posKey], startItem[posKey] + startItem[sizeKey])) {
800
+ baseItem = startItem;
801
+ break;
802
+ } else if (visible(endItem[posKey], endItem[posKey] + endItem[sizeKey])) {
803
+ baseItem = endItem;
804
+ break;
805
+ } else {
806
+ const tailItem = this.templateList[this.getTailItemIndex()];
807
+ let tailInfo: any = null;
808
+ if (tailItem) {
809
+ tailInfo = {
810
+ left: tailItem.left,
811
+ top: tailItem.top,
812
+ width: tailItem.width,
813
+ height: tailItem.height,
814
+ }
805
815
  }
816
+ console.log("MetroWidget: can not find visible item", visibleStart, visibleEnd, tailInfo);
817
+ return [-1, -1];
806
818
  }
807
- console.log("MetroWidget: can not find visible item", visibleStart, visibleEnd, tailInfo);
808
- return [-1, -1];
809
819
  } else {
810
820
  baseItem = this.templateList[Math.round((startIndex + endIndex) / 2)];
811
821
  }
@@ -157,6 +157,23 @@ class ListMetroTemplate extends MetroTemplate {
157
157
  return [start, end];
158
158
  }
159
159
 
160
+ private cleanResizeChangeItem(i: TemplateItem) {
161
+ i.neighborIndexList.left = [];
162
+ i.neighborIndexList.top = [];
163
+ i.neighborIndexList.right = [];
164
+ i.neighborIndexList.bottom = [];
165
+
166
+ i.tmpNeighborIndexList.left = [];
167
+ i.tmpNeighborIndexList.top = [];
168
+ i.tmpNeighborIndexList.right = [];
169
+ i.tmpNeighborIndexList.bottom = [];
170
+
171
+ i.pathHistory.left = -1;
172
+ i.pathHistory.top = -1;
173
+ i.pathHistory.right = -1;
174
+ i.pathHistory.bottom = -1;
175
+ }
176
+
160
177
  public updateItemSize(index: number, newSize: { width: number, height: number }): void {
161
178
  const item = this.templateList[index];
162
179
  if (!item || (item.width == newSize.width && item.height == newSize.height)) {
@@ -173,6 +190,7 @@ class ListMetroTemplate extends MetroTemplate {
173
190
  }
174
191
  //TODO 不是一次性加载全部, 可视区域外的懒惰加载
175
192
  for (let i of needChangeList) {
193
+ this.cleanResizeChangeItem(i);
176
194
  this._addTemplateItem(i);
177
195
  i.layoutCache.cache({
178
196
  left: i.left,
@@ -55,6 +55,8 @@ class TemplateItemAdder {
55
55
  }
56
56
 
57
57
  public tryAddItem(cur_item: TemplateItem | null = null, page_num: number = 1) {
58
+ if (!this._Data || this._Data.length <= 0) { return; }
59
+
58
60
  let added = false;
59
61
  if (
60
62
  this._CurIndex < this._Data.length &&
@@ -86,6 +88,8 @@ class TemplateItemAdder {
86
88
  }
87
89
 
88
90
  tryAddItemByPosition(position: number) {
91
+ if (!this._Data || this._Data.length <= 0) { return; }
92
+
89
93
  const page_num = Math.ceil(position / this._PageRange + 1);
90
94
  if (page_num > this._CurPage) {
91
95
  this.tryAddItem(null, page_num - this._CurPage);
@@ -94,6 +98,7 @@ class TemplateItemAdder {
94
98
  }
95
99
 
96
100
  tryAddItemByIndex(index: number) {
101
+ if (!this._Data || this._Data.length <= 0) { return; }
97
102
  let _index = Math.min(index, this._Data.length - 1);
98
103
  let added = false;
99
104
  while (this._CurIndex <= _index) {
@@ -121,6 +126,7 @@ class TemplateItemAdder {
121
126
  }
122
127
 
123
128
  tryAddItemById(id: number) {
129
+ if (!this._Data || this._Data.length <= 0) { return; }
124
130
  let _id = Math.min(id, this._Data.length - 1); // id小于等于index, 因此为了避免过界取小值
125
131
  const last_id = this._MetroTemplate.focusableSize - 1;
126
132
  if (last_id < _id) {
@@ -153,6 +159,7 @@ class TemplateItemAdder {
153
159
  }
154
160
 
155
161
  tryAddItemByUid(uid: string) {
162
+ if (!this._Data || this._Data.length <= 0) { return; }
156
163
  if (this._MetroTemplate.getItemByUid(uid)) {
157
164
  //已经添加
158
165
  return;
@@ -11,7 +11,7 @@ export * from "./MetroWidget/Dispatcher";
11
11
  export { default as SimpleWidget } from "./MetroWidget/MetroWidget.vue";
12
12
  export { default as MetroWidget } from "./MetroWidget/MetroWidget.vue";
13
13
  export { default as ListWidget } from "./MetroWidget/ListWidget.vue";
14
- export { METRO_WIDGET, METRO_WIDGET_CONST } from "./MetroWidget/Const.ts";
14
+ export { METRO_WIDGET, METRO_WIDGET_CONST } from "./MetroWidget/Const";
15
15
 
16
16
  export { default as JsvFocusBlock } from "./JsvFocus/JsvFocusBlock.vue";
17
17
  export { jsvCreateFocusManager, useFocusHub } from "./JsvFocus/JsvFocusManager";
@@ -11,7 +11,7 @@ import { ScreenLockManager } from "./ScreenLockManager.js";
11
11
 
12
12
  let sPluginLoader = GetPluginLoader();
13
13
 
14
- const TAG = "JsvAudio";
14
+ const TAG = "JsvAudio:";
15
15
 
16
16
  let keyToken = 0;
17
17
  const getKeyToken = () => {
@@ -77,6 +77,8 @@ class AudioProxy {
77
77
  this._created = false;
78
78
  this._eventListener = {};
79
79
  this._propCache = {};
80
+ this._unloaded = false;
81
+ this._visibility = window.JsView?.getVisibility();
80
82
  this._onVisibilityChange = this.onVisibilityChange.bind(this);
81
83
  window.JsView?.onVisibilityChange(this._onVisibilityChange);
82
84
  }
@@ -207,18 +209,33 @@ class AudioProxy {
207
209
 
208
210
  /** control */
209
211
  load() {
212
+ if (this._unloaded) {
213
+ console.warn(TAG, "Instead of calling load() after unload(), please update component's key to create a new JsvAudio.");
214
+ return;
215
+ }
210
216
  this.setProperty("enablePlayer", true);
211
217
  }
212
218
 
213
219
  play() {
214
- this.setProperty("paused", false);
220
+ if (this._visibility) {
221
+ this.setProperty("paused", false);
222
+ if (typeof this._propCache["customerPause"] !== "undefined") {
223
+ this._propCache["customerPause"] = false;
224
+ }
225
+ } else {
226
+ console.warn(TAG, "JsvAudio can not play when it is invisible.");
227
+ }
215
228
  }
216
229
 
217
230
  pause() {
218
231
  this.setProperty("paused", true);
232
+ if (typeof this._propCache["customerPause"] !== "undefined") {
233
+ this._propCache["customerPause"] = true;
234
+ }
219
235
  }
220
236
 
221
237
  unload() {
238
+ this._unloaded = true;
222
239
  this.pause();
223
240
  this.setProperty("enablePlayer", false);
224
241
  }
@@ -321,6 +338,7 @@ class AudioProxy {
321
338
  onVisibilityChange(state) {
322
339
  console.log(TAG, "audio visibility change", JSON.stringify(state));
323
340
  if (state.status == "show") {
341
+ this._visibility = true;
324
342
  if (typeof this._propCache["customerPause"] != "undefined") {
325
343
  const customerPause = this._propCache["customerPause"];
326
344
  delete this._propCache["customerPause"];
@@ -330,6 +348,7 @@ class AudioProxy {
330
348
  }
331
349
  } else {
332
350
  // pause when invisible
351
+ this._visibility = false;
333
352
  this._propCache["customerPause"] = this._propCache["paused"];
334
353
  this.pause();
335
354
  }
@@ -1,3 +1,3 @@
1
1
 
2
- export const VERTICAL: Symbol = Symbol("vertical");
3
- export const HORIZONTAL: Symbol = Symbol("horizontal");
2
+ export const VERTICAL = Symbol("vertical");
3
+ export const HORIZONTAL = Symbol("horizontal");
@@ -74,7 +74,7 @@ abstract class JsvPreDownloaderBase {
74
74
  } else {
75
75
  this.downloadInner(url[i].url, url[i].netSetting, !!url[i].isImage)
76
76
  .then(
77
- (info) => {
77
+ (info: any) => {
78
78
  downloadResult[i] = {
79
79
  succeed: true,
80
80
  info: info,
@@ -82,7 +82,7 @@ abstract class JsvPreDownloaderBase {
82
82
  workNumber += 1
83
83
  check();
84
84
  },
85
- (errorInfo) => {
85
+ (errorInfo: any) => {
86
86
  downloadResult[i] = {
87
87
  succeed: false,
88
88
  info: errorInfo,
@@ -119,7 +119,7 @@ class JsvPreDownloaderInJsView extends JsvPreDownloaderBase {
119
119
  netSetting,
120
120
  fileType: isImage ? "image" : "notImage",
121
121
  };
122
- (window as any).jJsvInnerUtils.downloadResource(url, JSON.stringify(setting), (info) => {
122
+ (window as any).jJsvInnerUtils.downloadResource(url, JSON.stringify(setting), (info: any) => {
123
123
  try {
124
124
  const obj: CallbackInfo = JSON.parse(info);
125
125
  const result = JSON.parse(obj.info);
@@ -26,7 +26,7 @@ let sJsvTextureConst = {
26
26
  BOTTOM: 4,
27
27
  }
28
28
 
29
- let sTextureStoreApi: Object = {
29
+ let sTextureStoreApi = {
30
30
  /**
31
31
  * canvasTexture
32
32
  * 创建CanvasTexture句柄,执行commit()后, 获取访问名(访问名规则: 输入参数 baseName + 分配id)
@@ -5,24 +5,24 @@
5
5
  */
6
6
 
7
7
  export * from "./JsvHashHistory";
8
- export * from "./JsvDynamicCssStyle.js";
9
- export * from "./JsvDynamicKeyFrames.ts";
10
- export * from "./JsvRuntimeBridge.js";
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.js";
14
- export * from "./JsvStyleClass.js";
15
- export * from "./JsvStyleSheetsDeclarer.js";
16
- export * from "./DebugContentShellJBridge.js";
17
- export * from "./DebugTool.js";
18
- export * from "./JsvImpactTracer.js";
19
- export * from "./JsvTextTools.js";
20
- export * from "./JsvPreDownloader.ts"
21
- export { default as DefaultKeyCodeMap } from "./DefaultKeyMap.js";
22
- export * from "./JsvDemoTester.js"
23
- export * from "./JsvPerformance.ts"
24
- export * from "./JsvTextureStore/JsvTextureStore.ts"
25
- export * from "./JsvTextureDefines.ts"
26
- export * from "./JsvFederationTools.ts"
27
- export * from "./ConstSymbol.ts"
28
- export * from "./ForgeConstDefine.ts"
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"
@@ -81,8 +81,8 @@ 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(() => {
@@ -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
@@ -104,8 +104,8 @@ defineExpose({
104
104
  waitForPlayInfo = args;
105
105
  viewer?.play(...args);
106
106
  },
107
- stop: () => {
108
- viewer?.stop();
107
+ stop: (frameCount = -1) => {
108
+ viewer?.stop(frameCount);
109
109
  },
110
110
  });
111
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
@@ -23,7 +23,7 @@ class Viewer {
23
23
  this._Listener = listener;
24
24
  this._TimeoutId = -1;
25
25
  this._EndState = ApicEndState.LAST_FRAME;
26
- // this.renderFrame(0);
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
- let duration = this.renderFrame(this._LoopTool.next());
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>