@shijiu/jsview-vue 2.1.476-test.0 → 2.1.482-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.
@@ -2367,7 +2367,7 @@ class RenderItem {
2367
2367
  }
2368
2368
  }
2369
2369
  onTap = computed(() => {
2370
- return this.enableTap ? { click: this.onClick.bind(this) } : {};
2370
+ return this.enableTap ? this.onClick.bind(this) : null;
2371
2371
  });
2372
2372
  onClick() {
2373
2373
  if (this.mounted.value) {
@@ -2658,6 +2658,14 @@ class ConditionPackBuilder {
2658
2658
  }
2659
2659
  return this._BuildPack(ConditionSetBuilder.OnNextTick(tickGap, this._CommonInfo));
2660
2660
  }
2661
+ /** 指定的swapcount前才能执行 */
2662
+ onSwapCount() {
2663
+ if (!this._CheckCommonInfo()) {
2664
+ return null;
2665
+ }
2666
+ this._CommonInfoValid = false;
2667
+ return this._BuildPack(ConditionSetBuilder.onSwapCount(0, this._CommonInfo));
2668
+ }
2661
2669
  onDragStart() {
2662
2670
  if (!this._CheckCommonInfo()) {
2663
2671
  return null;
@@ -2714,6 +2722,13 @@ class ConditionPackBuilder {
2714
2722
  this._CommonInfoValid = false;
2715
2723
  return this._BuildPack(ConditionSetBuilder.OnFlingCancel(this._CommonInfo, this._ContorlSlefNexus.token));
2716
2724
  }
2725
+ touchCount(count) {
2726
+ if (!this._CheckCommonInfo()) {
2727
+ return null;
2728
+ }
2729
+ this._CommonInfoValid = false;
2730
+ return this._BuildPack(ConditionSetBuilder.TouchCount(this._CommonInfo, count));
2731
+ }
2717
2732
  _CheckCommonInfo() {
2718
2733
  if (!this._CommonInfoValid) {
2719
2734
  console.error("Error: must call from new conditoin()");
@@ -3200,7 +3215,7 @@ class CallbackManager {
3200
3215
  }
3201
3216
  }
3202
3217
  }
3203
- invokeCallback(id, actorState) {
3218
+ invokeCallback(id, actorState, customDataStr, nexusCustomDataStr) {
3204
3219
  let callbackObj = this._CallbackMap.get(id);
3205
3220
  if (callbackObj) {
3206
3221
  if (callbackObj.once) {
@@ -3209,7 +3224,7 @@ class CallbackManager {
3209
3224
  callbackObj.times++;
3210
3225
  }
3211
3226
  try {
3212
- callbackObj.funcRef?.(actorState);
3227
+ callbackObj.funcRef?.(actorState, customDataStr, nexusCustomDataStr);
3213
3228
  } catch (e) {
3214
3229
  console.error("Error: callback error", e);
3215
3230
  }
@@ -3256,6 +3271,9 @@ class ActorControl {
3256
3271
  this._SharedQuickActionPackBuilder = new ActorPackBuilder(this._Callbacks, this._SelfNexusRecv);
3257
3272
  this._StatePackBuilder = new StatePackBuilder();
3258
3273
  }
3274
+ // debugGetAnimId() {
3275
+ // return this._BindAnim?.AnimNativeId;
3276
+ // }
3259
3277
  bindForgeView(bindView, instantActive) {
3260
3278
  this._BindView = bindView;
3261
3279
  if (instantActive) {
@@ -3346,7 +3364,7 @@ class ActorControl {
3346
3364
  if (renderBreakId != 0) {
3347
3365
  FinishRenderBreak(renderBreakId);
3348
3366
  }
3349
- this._Callbacks.invokeCallback(echoRet["eTkn"], retJsonObject);
3367
+ this._Callbacks.invokeCallback(echoRet["eTkn"], retJsonObject, echoRet["cds"], echoRet["ncds"]);
3350
3368
  }
3351
3369
  }
3352
3370
  }
@@ -3729,10 +3747,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
3729
3747
  updateHandler = pageUpdater.update(
3730
3748
  metroTemplate,
3731
3749
  visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
3732
- Math.min(
3733
- visibleInfo.startMax + visibleInfo.range + visibleInfo.padding.end - 1,
3734
- visibleInfo.endWithPadding + props.keepTraceRange * pageRange
3735
- ),
3750
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
3736
3751
  focusId,
3737
3752
  mergeTmp,
3738
3753
  permanentItemList
@@ -3979,6 +3994,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
3979
3994
  if (id == focusId) {
3980
3995
  return;
3981
3996
  }
3997
+ tryCancelDelayLoad();
3982
3998
  templateItemAdder.tryAddItemById(id);
3983
3999
  let next_focus_item = getItemById(id);
3984
4000
  if (next_focus_item) {
@@ -4059,6 +4075,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4059
4075
  enterFocusRect = rect;
4060
4076
  };
4061
4077
  const slideTo = (position, doAnim) => {
4078
+ tryCancelDelayLoad();
4062
4079
  templateItemAdder.tryAddItemByPosition(position);
4063
4080
  if (typeof position !== "undefined" && position != null) {
4064
4081
  let animObj = null;
@@ -4093,6 +4110,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4093
4110
  }
4094
4111
  };
4095
4112
  const slideToDiv = (div, doAnim) => {
4113
+ tryCancelDelayLoad();
4096
4114
  if (div) {
4097
4115
  const item_layout = div.jsvGetRelativePosition(toRaw(locateDiv.value));
4098
4116
  const direction = 1;
@@ -4187,10 +4205,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4187
4205
  const updater = pageUpdater.update(
4188
4206
  metroTemplate,
4189
4207
  visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
4190
- Math.min(
4191
- visibleInfo.startMax + visibleInfo.range + visibleInfo.padding.end - 1,
4192
- visibleInfo.endWithPadding + props.keepTraceRange * pageRange
4193
- ),
4208
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
4194
4209
  focusId,
4195
4210
  false,
4196
4211
  permanentItemList
@@ -4212,6 +4227,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4212
4227
  };
4213
4228
  };
4214
4229
  const moveFocus = (direction) => {
4230
+ tryCancelDelayLoad();
4215
4231
  if (direction == "left" || direction == 37 || direction == EdgeDirection.left) {
4216
4232
  _moveToNext(-1, 0);
4217
4233
  } else if (direction == "right" || direction == 39 || direction == EdgeDirection.right) {
@@ -4247,19 +4263,19 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4247
4263
  unlockSlide,
4248
4264
  lock,
4249
4265
  unlock,
4266
+ refreshData,
4267
+ moveFocus,
4250
4268
  slideTo,
4269
+ slideToItem,
4270
+ slideToDiv,
4251
4271
  setFocusId,
4252
4272
  setFocusByUid,
4253
- getFocusBlockRef,
4254
4273
  setEnterFocusId,
4255
4274
  setEnterFocusRect,
4256
- slideToItem,
4257
- slideToDiv,
4258
- refreshData,
4275
+ setZIndex,
4276
+ getFocusBlockRef,
4259
4277
  getVisibleItems,
4260
- moveFocus,
4261
4278
  getCustomerDataSize,
4262
- setZIndex,
4263
4279
  getCurrentFocusIndex,
4264
4280
  getCurMode,
4265
4281
  getTemplatePosition
@@ -4408,6 +4424,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4408
4424
  if (onKeyDownLock) {
4409
4425
  return true;
4410
4426
  }
4427
+ tryCancelDelayLoad();
4411
4428
  if (mode.getMode() == TOUCH_MODE) {
4412
4429
  if (mode.duringTouch()) {
4413
4430
  return true;
@@ -4681,8 +4698,8 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4681
4698
  } else {
4682
4699
  const updater = pageUpdater.update(
4683
4700
  metroTemplate,
4684
- cur_visible_start2,
4685
- cur_visible_start2 + visibleInfo.range + visibleInfo.padding.end - 1,
4701
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
4702
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
4686
4703
  next_focus_item.id,
4687
4704
  false,
4688
4705
  permanentItemList
@@ -4922,6 +4939,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4922
4939
  const touchLoadItemRect = visibleInfo.range;
4923
4940
  const reachAnchorGroup = 2;
4924
4941
  const wallConditionGroup = 1;
4942
+ const touchCountGroup = 3;
4925
4943
  let divPos = -1;
4926
4944
  let frameCount = -1;
4927
4945
  const getVisibleStart = (moveInfo) => {
@@ -4934,7 +4952,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4934
4952
  return -(divPos + Math.round(moveInfo.xPos));
4935
4953
  }
4936
4954
  };
4937
- const mergeTouchSlideToSlideDiv = () => {
4955
+ const mergeTouchSlideToSlideDiv = (touchCount) => {
4938
4956
  if (vertical) {
4939
4957
  slideDivTop.value = -visibleInfo.start;
4940
4958
  } else {
@@ -4945,10 +4963,17 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4945
4963
  actorController.state().removeConditionByGroup(wallConditionGroup),
4946
4964
  actorController.condition(wallConditionGroup, true).boxPosition(walls.left, walls.top, walls.right, walls.bottom).then([actorController.state().setHitWallOverflow()]),
4947
4965
  //TODO 通过prop设置哪个方向overflow
4948
- actorController.action().teleportTo(0, 0)
4966
+ actorController.condition(touchCountGroup, false).touchCount(touchCount).then([
4967
+ actorController.action().teleportTo(0, 0)
4968
+ ])
4969
+ ]);
4970
+ actorController.run([
4971
+ actorController.condition().onNextTick().then([
4972
+ actorController.state().removeConditionByGroup(touchCountGroup)
4973
+ ])
4949
4974
  ]);
4950
4975
  };
4951
- const onTouchDown = (data) => {
4976
+ const onTouchDown = (data, customData, nexusCustomData) => {
4952
4977
  mode.touchStart();
4953
4978
  mode.flingEnd();
4954
4979
  const t = 100;
@@ -4966,8 +4991,8 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4966
4991
  templateItemAdder.tryAddItemByPosition(visibleInfo.end + visibleInfo.range);
4967
4992
  const updater = pageUpdater.update(
4968
4993
  metroTemplate,
4969
- visibleInfo.startWithPadding - visibleInfo.range,
4970
- visibleInfo.endWithPadding + visibleInfo.range,
4994
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
4995
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
4971
4996
  0,
4972
4997
  false,
4973
4998
  permanentItemList
@@ -4998,32 +5023,48 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
4998
5023
  mode.touchEnd();
4999
5024
  }
5000
5025
  };
5001
- const onDragStart = (data) => {
5026
+ const onDragStart = (data, customData, nexusCustomData) => {
5002
5027
  mode.dragStart();
5003
5028
  visibleInfo.start = getVisibleStart(data);
5004
5029
  };
5005
- const onDragEnd = (data) => {
5030
+ const onDragEnd = (data, customData, nexusCustomData) => {
5006
5031
  visibleInfo.start = getVisibleStart(data);
5007
5032
  actorController.run([
5008
5033
  actorController.state().removeConditionByGroup(reachAnchorGroup)
5009
5034
  ]);
5010
- mergeTouchSlideToSlideDiv();
5035
+ let touchCount = -1;
5036
+ if (nexusCustomData) {
5037
+ try {
5038
+ touchCount = JSON.parse(nexusCustomData).tc;
5039
+ } catch (e) {
5040
+ touchCount = -1;
5041
+ }
5042
+ }
5043
+ mergeTouchSlideToSlideDiv(touchCount);
5011
5044
  updateRenderItems(false, false);
5012
5045
  mode.touchEnd();
5013
5046
  };
5014
- const onFlingStart = (data) => {
5047
+ const onFlingStart = (data, customData, nexusCustomData) => {
5015
5048
  mode.flingStart();
5016
5049
  visibleInfo.start = getVisibleStart(data);
5017
5050
  updateRenderItems(true, true);
5018
5051
  };
5019
- const onFlingProgress = (data) => {
5052
+ const onFlingProgress = (data, customData, nexusCustomData) => {
5020
5053
  visibleInfo.start = getVisibleStart(data);
5021
5054
  updateRenderItems(true, true);
5022
5055
  };
5023
- const onFlingEnd = (data) => {
5056
+ const onFlingEnd = (data, customData, nexusCustomData) => {
5024
5057
  visibleInfo.start = getVisibleStart(data);
5025
5058
  if (mode.duringFling()) {
5026
- mergeTouchSlideToSlideDiv();
5059
+ let touchCount = -1;
5060
+ if (nexusCustomData) {
5061
+ try {
5062
+ touchCount = JSON.parse(nexusCustomData).tc;
5063
+ } catch (e) {
5064
+ touchCount = -1;
5065
+ }
5066
+ }
5067
+ mergeTouchSlideToSlideDiv(touchCount);
5027
5068
  updateRenderItems(false, false);
5028
5069
  mode.flingEnd();
5029
5070
  mode.touchEnd();
@@ -5050,8 +5091,8 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
5050
5091
  templateItemAdder.tryAddItemByPosition(visibleInfo.start + visibleInfo.range);
5051
5092
  const updater = pageUpdater.update(
5052
5093
  metroTemplate,
5053
- expand ? visibleInfo.start - visibleInfo.range : visibleInfo.startWithPadding,
5054
- expand ? visibleInfo.start + 2 * visibleInfo.range : visibleInfo.endWithPadding,
5094
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
5095
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
5055
5096
  0,
5056
5097
  true,
5057
5098
  permanentItemList
@@ -5089,7 +5130,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
5089
5130
  //TODO 通过prop设置哪个方向overflow
5090
5131
  ]);
5091
5132
  };
5092
- pageUpdater = new PageUpdater(_updatePage);
5133
+ pageUpdater = new PageUpdater(_updatePage, props.name);
5093
5134
  visibleInfo.range = vertical ? widgetRectInfo.contentHeight : widgetRectInfo.contentWidth;
5094
5135
  visibleInfo.padding = vertical ? { start: widgetRectInfo.padding.top, end: widgetRectInfo.padding.bottom } : { start: widgetRectInfo.padding.left, end: widgetRectInfo.padding.right };
5095
5136
  if (props.provideData) {
@@ -5134,6 +5175,20 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
5134
5175
  permanentItemList
5135
5176
  );
5136
5177
  initUpdater.apply();
5178
+ const delayLoadHandler = setTimeout(() => {
5179
+ const updateHandler = pageUpdater.update(
5180
+ metroTemplate,
5181
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
5182
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
5183
+ focusId,
5184
+ false,
5185
+ permanentItemList
5186
+ );
5187
+ updateHandler.apply();
5188
+ }, 200);
5189
+ const tryCancelDelayLoad = () => {
5190
+ clearTimeout(delayLoadHandler);
5191
+ };
5137
5192
  onMounted(() => {
5138
5193
  _changeFocusId(focusId, false);
5139
5194
  mounted = true;
@@ -5155,6 +5210,7 @@ const setup = (props, itemRender, locateDiv, renderData, slideDiv, slideDivLeft,
5155
5210
  onUpdated(() => {
5156
5211
  });
5157
5212
  onBeforeUnmount(() => {
5213
+ tryCancelDelayLoad();
5158
5214
  mounted = false;
5159
5215
  });
5160
5216
  return {
@@ -5554,7 +5610,7 @@ const _sfc_main$G = {
5554
5610
  },
5555
5611
  keepTraceRange: {
5556
5612
  type: Number,
5557
- default: 0
5613
+ default: 3
5558
5614
  },
5559
5615
  onScroll: {
5560
5616
  type: Function
@@ -5689,6 +5745,7 @@ const _sfc_main$G = {
5689
5745
  key: pageUpdateToken.value + "_" + item.index,
5690
5746
  ref_for: true,
5691
5747
  ref: item.divRef,
5748
+ "data-jsv-vw-test-rect": "1",
5692
5749
  style: normalizeStyle({
5693
5750
  left: item.templateInfo.left,
5694
5751
  top: item.templateInfo.top,
@@ -5866,7 +5923,7 @@ const _sfc_main$F = {
5866
5923
  },
5867
5924
  keepTraceRange: {
5868
5925
  type: Number,
5869
- default: 0
5926
+ default: 3
5870
5927
  },
5871
5928
  onScroll: {
5872
5929
  type: Function
@@ -6000,6 +6057,7 @@ const _sfc_main$F = {
6000
6057
  key: pageUpdateToken.value + "_" + item.index,
6001
6058
  ref_for: true,
6002
6059
  ref: item.divRef,
6060
+ "data-jsv-vw-test-rect": "1",
6003
6061
  style: normalizeStyle({
6004
6062
  left: item.templateInfo.left,
6005
6063
  top: item.templateInfo.top,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "2.1.476-test.0",
3
+ "version": "2.1.482-test.0",
4
4
  "license": "MIT",
5
5
  "repository": "system/jsview-framework",
6
6
  "author": "mengxk",
@@ -123,7 +123,7 @@ const props = defineProps({
123
123
  },
124
124
  keepTraceRange: {
125
125
  type: Number,
126
- default: 0,
126
+ default: 3,
127
127
  },
128
128
  onScroll: {
129
129
  type: Function,
@@ -255,6 +255,7 @@ defineExpose(exportObject);
255
255
  v-for="(item, index) in renderData"
256
256
  :key="pageUpdateToken + '_' + item.index"
257
257
  :ref="item.divRef"
258
+ data-jsv-vw-test-rect="1"
258
259
  :style="{
259
260
  left: item.templateInfo.left,
260
261
  top: item.templateInfo.top,
@@ -358,7 +358,7 @@ const props = defineProps({
358
358
  },
359
359
  keepTraceRange: {
360
360
  type: Number,
361
- default: 0,
361
+ default: 3,
362
362
  },
363
363
  onScroll: {
364
364
  type: Function,
@@ -490,6 +490,7 @@ defineExpose(exportObject);
490
490
  v-for="(item, index) in renderData"
491
491
  :key="pageUpdateToken + '_' + item.index"
492
492
  :ref="item.divRef"
493
+ data-jsv-vw-test-rect="1"
493
494
  :style="{
494
495
  left: item.templateInfo.left,
495
496
  top: item.templateInfo.top,
@@ -201,6 +201,7 @@ export const setup = (
201
201
 
202
202
  let existOnFocusChange = false;
203
203
  let targetVisibleStart = visibleInfo.start;
204
+
204
205
  //先遍历寻找slide task, 确认目标位置. 有多个slide task时取最后一个
205
206
  taskList.forEach(i => {
206
207
  if (i.type == TaskType.SLIDE) {
@@ -314,13 +315,7 @@ export const setup = (
314
315
  updateHandler = pageUpdater.update(
315
316
  metroTemplate,
316
317
  visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
317
- Math.min(
318
- visibleInfo.startMax +
319
- visibleInfo.range +
320
- visibleInfo.padding.end -
321
- 1,
322
- visibleInfo.endWithPadding + props.keepTraceRange * pageRange
323
- ),
318
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
324
319
  focusId,
325
320
  mergeTmp,
326
321
  permanentItemList
@@ -591,6 +586,8 @@ export const setup = (
591
586
  if (id == focusId) {
592
587
  return;
593
588
  }
589
+ //有外部触发的滚动时, 取消load
590
+ tryCancelDelayLoad();
594
591
  templateItemAdder.tryAddItemById(id);
595
592
  let next_focus_item = getItemById(id);
596
593
  if (next_focus_item) {
@@ -679,6 +676,8 @@ export const setup = (
679
676
  };
680
677
 
681
678
  const slideTo = (position, doAnim) => {
679
+ //有外部触发的滚动时, 取消load
680
+ tryCancelDelayLoad();
682
681
  templateItemAdder.tryAddItemByPosition(position);
683
682
  if (
684
683
  typeof position !== "undefined" &&
@@ -720,6 +719,8 @@ export const setup = (
720
719
  };
721
720
 
722
721
  const slideToDiv = (div, doAnim) => {
722
+ //有外部触发的滚动时, 取消load
723
+ tryCancelDelayLoad();
723
724
  if (div) {
724
725
  const item_layout = div.jsvGetRelativePosition(toRaw(locateDiv.value));
725
726
  const direction = 1;
@@ -822,10 +823,7 @@ export const setup = (
822
823
  const updater = pageUpdater.update(
823
824
  metroTemplate,
824
825
  visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
825
- Math.min(
826
- visibleInfo.startMax + visibleInfo.range + visibleInfo.padding.end - 1,
827
- visibleInfo.endWithPadding + props.keepTraceRange * pageRange
828
- ),
826
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
829
827
  focusId,
830
828
  false,
831
829
  permanentItemList
@@ -849,6 +847,8 @@ export const setup = (
849
847
  };
850
848
 
851
849
  const moveFocus = (direction) => {
850
+ //有外部触发的滚动时, 取消load
851
+ tryCancelDelayLoad();
852
852
  if (direction == "left" || direction == 37 || direction == EdgeDirection.left) {
853
853
  _moveToNext(-1, 0);
854
854
  } else if (direction == "right" || direction == 39 || direction == EdgeDirection.right) {
@@ -891,19 +891,19 @@ export const setup = (
891
891
  unlockSlide,
892
892
  lock,
893
893
  unlock,
894
+ refreshData,
895
+ moveFocus,
894
896
  slideTo,
897
+ slideToItem,
898
+ slideToDiv,
895
899
  setFocusId,
896
900
  setFocusByUid,
897
- getFocusBlockRef,
898
901
  setEnterFocusId,
899
902
  setEnterFocusRect,
900
- slideToItem,
901
- slideToDiv,
902
- refreshData,
903
+ setZIndex,
904
+ getFocusBlockRef,
903
905
  getVisibleItems,
904
- moveFocus,
905
906
  getCustomerDataSize,
906
- setZIndex,
907
907
  getCurrentFocusIndex,
908
908
  getCurMode,
909
909
  getTemplatePosition,
@@ -1108,6 +1108,7 @@ export const setup = (
1108
1108
  if (onKeyDownLock) {
1109
1109
  return true;
1110
1110
  }
1111
+ tryCancelDelayLoad();
1111
1112
  if (mode.getMode() == TOUCH_MODE) {
1112
1113
  if (mode.duringTouch()) {
1113
1114
  //touch过程中的按键不处理
@@ -1414,8 +1415,8 @@ export const setup = (
1414
1415
  } else {
1415
1416
  const updater = pageUpdater.update(
1416
1417
  metroTemplate,
1417
- cur_visible_start,
1418
- cur_visible_start + visibleInfo.range + visibleInfo.padding.end - 1,
1418
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
1419
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
1419
1420
  next_focus_item.id,
1420
1421
  false,
1421
1422
  permanentItemList
@@ -1731,6 +1732,7 @@ export const setup = (
1731
1732
  const touchLoadItemRect = visibleInfo.range;
1732
1733
  const reachAnchorGroup = 2;
1733
1734
  const wallConditionGroup = 1;
1735
+ const touchCountGroup = 3;
1734
1736
 
1735
1737
  let divPos = -1;
1736
1738
  let frameCount = -1;
@@ -1745,7 +1747,8 @@ export const setup = (
1745
1747
  }
1746
1748
  }
1747
1749
 
1748
- const mergeTouchSlideToSlideDiv = () => {
1750
+ const mergeTouchSlideToSlideDiv = (touchCount) => {
1751
+ // console.log("touchtest", props.name, `touchToDiv div: ${slideDivTop.value}, visibleStart:${visibleInfo.start} swapCount: ${Forge.sFrameCount.count}`)
1749
1752
  if (vertical) {
1750
1753
  slideDivTop.value = -visibleInfo.start;
1751
1754
  } else {
@@ -1760,14 +1763,27 @@ export const setup = (
1760
1763
  .boxPosition(walls.left, walls.top, walls.right, walls.bottom)
1761
1764
  .then([actorController.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
1762
1765
  actorController
1763
- .action()
1764
- .teleportTo(0, 0)]);
1766
+ .condition(touchCountGroup, false)
1767
+ .touchCount(touchCount)
1768
+ .then([
1769
+ actorController
1770
+ .action()
1771
+ .teleportTo(0, 0)
1772
+ ])
1773
+ ]);
1774
+ //下一帧删除touchCount
1775
+ actorController.run([
1776
+ actorController.condition().onNextTick().then([
1777
+ actorController.state().removeConditionByGroup(touchCountGroup),
1778
+ ])
1779
+ ])
1765
1780
  }
1766
1781
 
1767
- const onTouchDown = (data) => {
1782
+ const onTouchDown = (data, customData, nexusCustomData) => {
1768
1783
  mode.touchStart();
1769
1784
  mode.flingEnd();
1770
-
1785
+ // console.log("touchtest", `${props.name} animId:${debugAnimId} viewId:${debugViewId}`,
1786
+ // "onTouchDown", data, customData, nexusCustomData)
1771
1787
  const t = 100;
1772
1788
  const offsetThreshold = {
1773
1789
  left: vertical ? undefined : t,
@@ -1789,13 +1805,12 @@ export const setup = (
1789
1805
  //blur item
1790
1806
  onItemBlur(getItemById(focusId));
1791
1807
 
1792
- // visibleInfo.start = getVisibleStart(data);
1793
1808
  templateItemAdder.tryAddItemByPosition(visibleInfo.end + visibleInfo.range);
1794
1809
 
1795
1810
  const updater = pageUpdater.update(
1796
1811
  metroTemplate,
1797
- visibleInfo.startWithPadding - visibleInfo.range,
1798
- visibleInfo.endWithPadding + visibleInfo.range,
1812
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
1813
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
1799
1814
  0,
1800
1815
  false,
1801
1816
  permanentItemList
@@ -1832,37 +1847,56 @@ export const setup = (
1832
1847
  }
1833
1848
  }
1834
1849
 
1835
- const onDragStart = (data) => {
1850
+ const onDragStart = (data, customData, nexusCustomData) => {
1836
1851
  mode.dragStart()
1837
1852
  visibleInfo.start = getVisibleStart(data);
1838
1853
  }
1839
1854
 
1840
- const onDragEnd = (data) => {
1855
+ const onDragEnd = (data, customData, nexusCustomData) => {
1841
1856
  visibleInfo.start = getVisibleStart(data);
1857
+ // console.log("touchtest", props.name + " animId:" + debugAnimId,
1858
+ // `onDragEnd ${visibleInfo.start}`)
1842
1859
  actorController.run([
1843
1860
  actorController.state().removeConditionByGroup(reachAnchorGroup),
1844
1861
  ]);
1845
- mergeTouchSlideToSlideDiv();
1862
+ let touchCount = -1;
1863
+ if (nexusCustomData) {
1864
+ try {
1865
+ touchCount = JSON.parse(nexusCustomData).tc;
1866
+ } catch (e) {
1867
+ touchCount = -1;
1868
+ }
1869
+ }
1870
+ mergeTouchSlideToSlideDiv(touchCount);
1846
1871
  updateRenderItems(false, false);
1847
1872
  mode.touchEnd()
1848
1873
  }
1849
1874
 
1850
- const onFlingStart = (data) => {
1875
+ const onFlingStart = (data, customData, nexusCustomData) => {
1851
1876
  mode.flingStart();
1852
1877
  visibleInfo.start = getVisibleStart(data);
1853
1878
  updateRenderItems(true, true);
1854
1879
  }
1855
1880
 
1856
- const onFlingProgress = (data) => {
1881
+ const onFlingProgress = (data, customData, nexusCustomData) => {
1857
1882
  visibleInfo.start = getVisibleStart(data);
1858
1883
  updateRenderItems(true, true);
1859
1884
  }
1860
1885
 
1861
- const onFlingEnd = (data) => {
1886
+ const onFlingEnd = (data, customData, nexusCustomData) => {
1862
1887
  visibleInfo.start = getVisibleStart(data);
1888
+ // console.log("touchtest", props.name, `onFlingEnd ${visibleInfo.start}`, data, customData, nexusCustomData)
1863
1889
  //记录拖拽的距离
1864
1890
  if (mode.duringFling()) {
1865
- mergeTouchSlideToSlideDiv();
1891
+ let touchCount = -1;
1892
+ if (nexusCustomData) {
1893
+ try {
1894
+ touchCount = JSON.parse(nexusCustomData).tc;
1895
+ } catch (e) {
1896
+ touchCount = -1;
1897
+ }
1898
+ }
1899
+ mergeTouchSlideToSlideDiv(touchCount);
1866
1900
  updateRenderItems(false, false);
1867
1901
  mode.flingEnd();
1868
1902
  mode.touchEnd();
@@ -1891,8 +1925,8 @@ export const setup = (
1891
1925
  templateItemAdder.tryAddItemByPosition(visibleInfo.start + visibleInfo.range);
1892
1926
  const updater = pageUpdater.update(
1893
1927
  metroTemplate,
1894
- expand ? visibleInfo.start - visibleInfo.range : visibleInfo.startWithPadding,
1895
- expand ? visibleInfo.start + 2 * visibleInfo.range : visibleInfo.endWithPadding,
1928
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
1929
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
1896
1930
  0,
1897
1931
  true,
1898
1932
  permanentItemList
@@ -1914,12 +1948,17 @@ export const setup = (
1914
1948
  }
1915
1949
  }
1916
1950
 
1951
+ //TODO debug
1952
+ // let debugAnimId = -1;
1953
+ // let debugViewId = -1
1917
1954
  const initTouch = () => {
1918
1955
  actorController = new ActorControl();
1919
1956
  const divView = touchDiv.value.jsvGetProxyView();
1920
1957
  actorController.bindForgeView(divView, true);
1921
1958
  divView.DragEnables?.(4 | 0x08 | 0x10); // 只激活drag
1922
-
1959
+ // debugAnimId = actorController.debugGetAnimId();
1960
+ // debugViewId = divView.ViewId;
1961
+ // console.log("touchtest", props.name, `animId:${debugAnimId} viewId:${debugViewId}`);
1923
1962
  const walls = getTouchWall();
1924
1963
  //注册回调
1925
1964
  actorController.run([
@@ -1960,7 +1999,7 @@ export const setup = (
1960
1999
  }
1961
2000
 
1962
2001
  //init
1963
- pageUpdater = new PageUpdater(_updatePage);
2002
+ pageUpdater = new PageUpdater(_updatePage, props.name);
1964
2003
  visibleInfo.range = vertical
1965
2004
  ? widgetRectInfo.contentHeight
1966
2005
  : widgetRectInfo.contentWidth;
@@ -2005,6 +2044,7 @@ export const setup = (
2005
2044
  focusId = init_focus_id;
2006
2045
  visibleInfo.start = cur_visible_start;
2007
2046
 
2047
+ //保证创建速度, 你描画一屏
2008
2048
  const initUpdater = pageUpdater.update(
2009
2049
  metroTemplate,
2010
2050
  visibleInfo.startWithPadding,
@@ -2014,6 +2054,21 @@ export const setup = (
2014
2054
  permanentItemList
2015
2055
  );
2016
2056
  initUpdater.apply();
2057
+ //延时加载剩余屏
2058
+ const delayLoadHandler = setTimeout(() => {
2059
+ const updateHandler = pageUpdater.update(
2060
+ metroTemplate,
2061
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
2062
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
2063
+ focusId,
2064
+ false,
2065
+ permanentItemList
2066
+ );
2067
+ updateHandler.apply();
2068
+ }, 200);
2069
+ const tryCancelDelayLoad = () => {
2070
+ clearTimeout(delayLoadHandler);
2071
+ }
2017
2072
 
2018
2073
  onMounted(() => {
2019
2074
  _changeFocusId(focusId, false);
@@ -2038,6 +2093,7 @@ export const setup = (
2038
2093
  onUpdated(() => { });
2039
2094
 
2040
2095
  onBeforeUnmount(() => {
2096
+ tryCancelDelayLoad();
2041
2097
  mounted = false;
2042
2098
  });
2043
2099
 
@@ -115,7 +115,7 @@ export class RenderItem {
115
115
  }
116
116
 
117
117
  public readonly onTap = computed(() => {
118
- return this.enableTap ? { click: this.onClick.bind(this) } : {};
118
+ return this.enableTap ? this.onClick.bind(this) : null;
119
119
  })
120
120
 
121
121
  public onClick(): boolean {
@@ -33,6 +33,10 @@ class ActorControl {
33
33
  this._StatePackBuilder = new StatePackBuilder();
34
34
  }
35
35
 
36
+ // debugGetAnimId() {
37
+ // return this._BindAnim?.AnimNativeId;
38
+ // }
39
+
36
40
  bindForgeView(bindView: any, instantActive: boolean) {
37
41
  this._BindView = bindView;
38
42
 
@@ -138,8 +142,8 @@ class ActorControl {
138
142
 
139
143
  _OnEchoEvent(retJson: string) {
140
144
  // 遇到layout后仍然会因为新broadcast有动作时,一帧中可能会有多次回调
141
- let retJsonObject: Object = JSON.parse(retJson);
142
- let echoRetList = retJsonObject["retList"];
145
+ let retJsonObject: any = JSON.parse(retJson);
146
+ let echoRetList: Array<any> = retJsonObject["retList"];
143
147
  if (echoRetList) {
144
148
  for (let echoRet of echoRetList) {
145
149
  let renderBreakId = echoRet["rbTkn"];
@@ -147,7 +151,7 @@ class ActorControl {
147
151
  // 标识此RenderBreak完成
148
152
  FinishRenderBreak(renderBreakId);
149
153
  }
150
- this._Callbacks.invokeCallback(echoRet["eTkn"], retJsonObject);
154
+ this._Callbacks.invokeCallback(echoRet["eTkn"], retJsonObject, echoRet["cds"], echoRet["ncds"]);
151
155
  }
152
156
  }
153
157
  }
@@ -49,7 +49,9 @@ class CallbackManager {
49
49
  }
50
50
  }
51
51
 
52
- public invokeCallback(id: string, actorState: Object) {
52
+ public invokeCallback(id: string, actorState: Object,
53
+ customDataStr: string | null | undefined,
54
+ nexusCustomDataStr:string | null | undefined) {
53
55
  let callbackObj = this._CallbackMap.get(id);
54
56
  if (callbackObj) {
55
57
  if (callbackObj.once) {
@@ -58,7 +60,7 @@ class CallbackManager {
58
60
  callbackObj.times++;
59
61
  }
60
62
  try {
61
- callbackObj.funcRef?.(actorState);
63
+ callbackObj.funcRef?.(actorState, customDataStr, nexusCustomDataStr);
62
64
  } catch (e) {
63
65
  // 规避 callback 执行出错导致流程执行不下去
64
66
  console.error("Error: callback error", e);
@@ -194,6 +194,16 @@ class ConditionPackBuilder {
194
194
  return this._BuildPack(ConditionSetBuilder.OnNextTick(tickGap, this._CommonInfo));
195
195
  }
196
196
 
197
+ /** 指定的swapcount前才能执行 */
198
+ onSwapCount() {
199
+ // CommonInfo 只能使用一次,规避多次使用问题
200
+ if (!this._CheckCommonInfo()) {
201
+ return null;
202
+ }
203
+ this._CommonInfoValid = false;
204
+ return this._BuildPack(ConditionSetBuilder.onSwapCount(0, this._CommonInfo));
205
+ }
206
+
197
207
  onDragStart() {
198
208
  if (!this._CheckCommonInfo()) {
199
209
  return null;
@@ -259,6 +269,14 @@ class ConditionPackBuilder {
259
269
  return this._BuildPack(ConditionSetBuilder.OnFlingCancel(this._CommonInfo, this._ContorlSlefNexus.token));
260
270
  }
261
271
 
272
+ touchCount(count: number) {
273
+ if (!this._CheckCommonInfo()) {
274
+ return null;
275
+ }
276
+ this._CommonInfoValid = false;
277
+ return this._BuildPack(ConditionSetBuilder.TouchCount(this._CommonInfo, count));
278
+ }
279
+
262
280
  _CheckCommonInfo(): boolean {
263
281
  if (!this._CommonInfoValid) {
264
282
  console.error("Error: must call from new conditoin()");