@ives_xxz/framework 2.1.30 → 2.1.31

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.
@@ -1,11 +1,17 @@
1
- import FWListItem from '../item/FWVirtualListItem';
1
+ import FWListItem from "../item/FWVirtualListItem";
2
2
 
3
- const { ccclass, property, disallowMultiple, menu, executionOrder, requireComponent } =
4
- cc._decorator;
3
+ const {
4
+ ccclass,
5
+ property,
6
+ disallowMultiple,
7
+ menu,
8
+ executionOrder,
9
+ requireComponent,
10
+ } = cc._decorator;
5
11
 
6
12
  @ccclass
7
13
  @disallowMultiple()
8
- @menu('CustomComponent/FWVirtualViewComponent')
14
+ @menu("CustomComponent/FWVirtualViewComponent")
9
15
  @requireComponent(cc.ScrollView)
10
16
  //脚本生命周期回调的执行优先级。小于 0 的脚本将优先执行,大于 0 的脚本将最后执行。该优先级只对 onLoad, onEnable, start, update 和 lateUpdate 有效,对 onDisable 和 onDestroy 无效。
11
17
  @executionOrder(-5000)
@@ -36,14 +42,14 @@ export default class FWVirtualViewComponent
36
42
  //模板类型
37
43
  @property({
38
44
  type: cc.Enum(FW.SystemDefine.FWScrollViewTemplateType),
39
- tooltip: CC_DEV && '模板类型',
45
+ tooltip: CC_DEV && "模板类型",
40
46
  })
41
47
  private templateType: FW.SystemDefine.FWScrollViewTemplateType =
42
48
  FW.SystemDefine.FWScrollViewTemplateType.PREFAB;
43
49
  //模板Item(Node)
44
50
  @property({
45
51
  type: cc.Node,
46
- tooltip: CC_DEV && '模板Item',
52
+ tooltip: CC_DEV && "模板Item",
47
53
  visible() {
48
54
  return this.templateType == FW.SystemDefine.FWScrollViewTemplateType.NODE;
49
55
  },
@@ -52,9 +58,11 @@ export default class FWVirtualViewComponent
52
58
  //模板Item(Prefab)
53
59
  @property({
54
60
  type: cc.Prefab,
55
- tooltip: CC_DEV && '模板Item',
61
+ tooltip: CC_DEV && "模板Item",
56
62
  visible() {
57
- return this.templateType == FW.SystemDefine.FWScrollViewTemplateType.PREFAB;
63
+ return (
64
+ this.templateType == FW.SystemDefine.FWScrollViewTemplateType.PREFAB
65
+ );
58
66
  },
59
67
  })
60
68
  tmpPrefab: cc.Prefab = null;
@@ -64,7 +72,7 @@ export default class FWVirtualViewComponent
64
72
  FW.SystemDefine.FWScrollViewSlideType.NORMAL;
65
73
  @property({
66
74
  type: cc.Enum(FW.SystemDefine.FWScrollViewSlideType),
67
- tooltip: CC_DEV && '滑动模式',
75
+ tooltip: CC_DEV && "滑动模式",
68
76
  })
69
77
  set slideMode(val: FW.SystemDefine.FWScrollViewSlideType) {
70
78
  this._slideMode = val;
@@ -76,7 +84,7 @@ export default class FWVirtualViewComponent
76
84
  @property({
77
85
  type: cc.Float,
78
86
  range: [0, 1, 0.1],
79
- tooltip: CC_DEV && '翻页作用距离',
87
+ tooltip: CC_DEV && "翻页作用距离",
80
88
  slide: true,
81
89
  visible() {
82
90
  return this._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE;
@@ -89,7 +97,7 @@ export default class FWVirtualViewComponent
89
97
  private _virtual: boolean = true;
90
98
  @property({
91
99
  type: cc.Boolean,
92
- tooltip: CC_DEV && '是否为虚拟列表(动态列表)',
100
+ tooltip: CC_DEV && "是否为虚拟列表(动态列表)",
93
101
  })
94
102
  set virtual(val: boolean) {
95
103
  if (val != null) this._virtual = val;
@@ -102,10 +110,11 @@ export default class FWVirtualViewComponent
102
110
  }
103
111
  //是否为循环列表
104
112
  @property({
105
- tooltip: CC_DEV && '是否为循环列表',
113
+ tooltip: CC_DEV && "是否为循环列表",
106
114
  visible() {
107
115
  let val: boolean =
108
- /*this.virtual &&*/ this.slideMode == FW.SystemDefine.FWScrollViewSlideType.NORMAL;
116
+ /*this.virtual &&*/ this.slideMode ==
117
+ FW.SystemDefine.FWScrollViewSlideType.NORMAL;
109
118
  if (!val) this.cyclic = false;
110
119
  return val;
111
120
  },
@@ -113,7 +122,9 @@ export default class FWVirtualViewComponent
113
122
  public cyclic: boolean = false;
114
123
  //缺省居中
115
124
  @property({
116
- tooltip: CC_DEV && 'Item数量不足以填满Content时,是否居中显示Item(不支持Grid布局)',
125
+ tooltip:
126
+ CC_DEV &&
127
+ "Item数量不足以填满Content时,是否居中显示Item(不支持Grid布局)",
117
128
  visible() {
118
129
  return this.virtual;
119
130
  },
@@ -121,7 +132,7 @@ export default class FWVirtualViewComponent
121
132
  public lackCenter: boolean = false;
122
133
  //缺省可滑动
123
134
  @property({
124
- tooltip: CC_DEV && 'Item数量不足以填满Content时,是否可滑动',
135
+ tooltip: CC_DEV && "Item数量不足以填满Content时,是否可滑动",
125
136
  visible() {
126
137
  let val: boolean = this.virtual && !this.lackCenter;
127
138
  if (!val) this.lackSlide = false;
@@ -135,7 +146,7 @@ export default class FWVirtualViewComponent
135
146
  @property({
136
147
  type: cc.Integer,
137
148
  range: [0, 6, 1],
138
- tooltip: CC_DEV && '刷新频率(值越大刷新频率越低、性能越高)',
149
+ tooltip: CC_DEV && "刷新频率(值越大刷新频率越低、性能越高)",
139
150
  slide: true,
140
151
  })
141
152
  set updateRate(val: number) {
@@ -150,7 +161,7 @@ export default class FWVirtualViewComponent
150
161
  @property({
151
162
  type: cc.Integer,
152
163
  range: [0, 12, 1],
153
- tooltip: CC_DEV && '逐帧渲染时,每帧渲染的Item数量(<=0时关闭分帧渲染)',
164
+ tooltip: CC_DEV && "逐帧渲染时,每帧渲染的Item数量(<=0时关闭分帧渲染)",
154
165
  slide: true,
155
166
  })
156
167
  public frameByFrameRenderNum: number = 0;
@@ -158,18 +169,20 @@ export default class FWVirtualViewComponent
158
169
  //选择模式
159
170
  @property({
160
171
  type: cc.Enum(FW.SystemDefine.FWScrollViewSelectedType),
161
- tooltip: CC_DEV && '选择模式',
172
+ tooltip: CC_DEV && "选择模式",
162
173
  })
163
174
  public selectedMode: FW.SystemDefine.FWScrollViewSelectedType = 0;
164
175
  @property({
165
- tooltip: CC_DEV && '是否重复响应单选事件',
176
+ tooltip: CC_DEV && "是否重复响应单选事件",
166
177
  visible() {
167
- return this.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.SINGLE;
178
+ return (
179
+ this.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.SINGLE
180
+ );
168
181
  },
169
182
  })
170
183
  public repeatEventSingle: boolean = false;
171
184
 
172
- @property({ tooltip: CC_DEV && '是否刷新widget' })
185
+ @property({ tooltip: CC_DEV && "是否刷新widget" })
173
186
  public isUpdateWidget: boolean = true;
174
187
 
175
188
  //当前选择id
@@ -219,7 +232,9 @@ export default class FWVirtualViewComponent
219
232
  t.onSelected?.(
220
233
  item,
221
234
  val % this._actualNumItems,
222
- t._lastSelectedId == null ? null : t._lastSelectedId % this._actualNumItems,
235
+ t._lastSelectedId == null
236
+ ? null
237
+ : t._lastSelectedId % this._actualNumItems,
223
238
  bool,
224
239
  );
225
240
  break;
@@ -253,7 +268,7 @@ export default class FWVirtualViewComponent
253
268
  let t = this;
254
269
  if (!t.checkInited(false)) return;
255
270
  if (val == null || val < 0) {
256
- FW.Log.error('numItems set the wrong::', val);
271
+ FW.Log.error("numItems set the wrong::", val);
257
272
  return;
258
273
  }
259
274
  t._actualNumItems = t._numItems = val;
@@ -265,7 +280,10 @@ export default class FWVirtualViewComponent
265
280
  t._numItems = t._cyclicNum * t._numItems;
266
281
  }
267
282
  t._onScrolling();
268
- if (!t.frameByFrameRenderNum && t.slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE)
283
+ if (
284
+ !t.frameByFrameRenderNum &&
285
+ t.slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE
286
+ )
269
287
  t.curPageNum = t.nearestListId;
270
288
  } else {
271
289
  if (t.cyclic) {
@@ -282,7 +300,9 @@ export default class FWVirtualViewComponent
282
300
  if (t.frameByFrameRenderNum > 0) {
283
301
  //先渲染几个出来
284
302
  let len: number =
285
- t.frameByFrameRenderNum > t._numItems ? t._numItems : t.frameByFrameRenderNum;
303
+ t.frameByFrameRenderNum > t._numItems
304
+ ? t._numItems
305
+ : t.frameByFrameRenderNum;
286
306
  for (let n: number = 0; n < len; n++) {
287
307
  t._createOrUpdateItem2(n);
288
308
  }
@@ -415,22 +435,22 @@ export default class FWVirtualViewComponent
415
435
  _registerEvent() {
416
436
  let t: any = this;
417
437
  t.node.on(cc.Node.EventType.TOUCH_START, t._onTouchStart, t, true);
418
- t.node.on('touch-up', t._onTouchUp, t);
438
+ t.node.on("touch-up", t._onTouchUp, t);
419
439
  t.node.on(cc.Node.EventType.TOUCH_CANCEL, t._onTouchCancelled, t, true);
420
- t.node.on('scroll-began', t._onScrollBegan, t, true);
421
- t.node.on('scroll-ended', t._onScrollEnded, t, true);
422
- t.node.on('scrolling', t._onScrolling, t, true);
440
+ t.node.on("scroll-began", t._onScrollBegan, t, true);
441
+ t.node.on("scroll-ended", t._onScrollEnded, t, true);
442
+ t.node.on("scrolling", t._onScrolling, t, true);
423
443
  t.node.on(cc.Node.EventType.SIZE_CHANGED, t._onSizeChanged, t);
424
444
  }
425
445
  //卸载事件
426
446
  _unregisterEvent() {
427
447
  let t: any = this;
428
448
  t.node.off(cc.Node.EventType.TOUCH_START, t._onTouchStart, t, true);
429
- t.node.off('touch-up', t._onTouchUp, t);
449
+ t.node.off("touch-up", t._onTouchUp, t);
430
450
  t.node.off(cc.Node.EventType.TOUCH_CANCEL, t._onTouchCancelled, t, true);
431
- t.node.off('scroll-began', t._onScrollBegan, t, true);
432
- t.node.off('scroll-ended', t._onScrollEnded, t, true);
433
- t.node.off('scrolling', t._onScrolling, t, true);
451
+ t.node.off("scroll-began", t._onScrollBegan, t, true);
452
+ t.node.off("scroll-ended", t._onScrollEnded, t, true);
453
+ t.node.off("scrolling", t._onScrolling, t, true);
434
454
  t.node.off(cc.Node.EventType.SIZE_CHANGED, t._onSizeChanged, t);
435
455
  }
436
456
 
@@ -468,7 +488,9 @@ export default class FWVirtualViewComponent
468
488
 
469
489
  t.setTemplateItem(
470
490
  cc.instantiate(
471
- t.templateType == FW.SystemDefine.FWScrollViewTemplateType.PREFAB ? t.tmpPrefab : t.tmpNode,
491
+ t.templateType == FW.SystemDefine.FWScrollViewTemplateType.PREFAB
492
+ ? t.tmpPrefab
493
+ : t.tmpNode,
472
494
  ),
473
495
  );
474
496
 
@@ -569,43 +591,51 @@ export default class FWVirtualViewComponent
569
591
  */
570
592
  _processAutoScrolling(dt: number) {
571
593
  let brakingFactor: number = 1;
572
- this._scrollView['_autoScrollAccumulatedTime'] += dt * (1 / brakingFactor);
594
+ this._scrollView["_autoScrollAccumulatedTime"] += dt * (1 / brakingFactor);
573
595
 
574
596
  let percentage: number = Math.min(
575
597
  1,
576
- this._scrollView['_autoScrollAccumulatedTime'] / this._scrollView['_autoScrollTotalTime'],
598
+ this._scrollView["_autoScrollAccumulatedTime"] /
599
+ this._scrollView["_autoScrollTotalTime"],
577
600
  );
578
- if (this._scrollView['_autoScrollAttenuate']) {
601
+ if (this._scrollView["_autoScrollAttenuate"]) {
579
602
  let time: number = percentage - 1;
580
603
  percentage = time * time * time * time * time + 1;
581
604
  }
582
605
 
583
- let newPosition: any = this._scrollView['_autoScrollStartPosition'].add(
584
- this._scrollView['_autoScrollTargetDelta'].mul(percentage),
606
+ let newPosition: any = this._scrollView["_autoScrollStartPosition"].add(
607
+ this._scrollView["_autoScrollTargetDelta"].mul(percentage),
585
608
  );
586
- let EPSILON: number = this._scrollView['getScrollEndedEventTiming']();
609
+ let EPSILON: number = this._scrollView["getScrollEndedEventTiming"]();
587
610
  let reachedEnd: boolean = Math.abs(percentage - 1) <= EPSILON;
588
611
 
589
612
  let fireEvent: boolean =
590
- Math.abs(percentage - 1) <= this._scrollView['getScrollEndedEventTiming']();
591
- if (fireEvent && !this._scrollView['_isScrollEndedWithThresholdEventFired']) {
592
- this._scrollView['_dispatchEvent']('scroll-ended-with-threshold');
593
- this._scrollView['_isScrollEndedWithThresholdEventFired'] = true;
613
+ Math.abs(percentage - 1) <=
614
+ this._scrollView["getScrollEndedEventTiming"]();
615
+ if (
616
+ fireEvent &&
617
+ !this._scrollView["_isScrollEndedWithThresholdEventFired"]
618
+ ) {
619
+ this._scrollView["_dispatchEvent"]("scroll-ended-with-threshold");
620
+ this._scrollView["_isScrollEndedWithThresholdEventFired"] = true;
594
621
  }
595
622
 
596
623
  if (reachedEnd) {
597
- this._scrollView['_autoScrolling'] = false;
624
+ this._scrollView["_autoScrolling"] = false;
598
625
  }
599
626
 
600
627
  let deltaMove: any = newPosition.sub(this._scrollView.getContentPosition());
601
- this._scrollView['_moveContent'](this._scrollView['_clampDelta'](deltaMove), reachedEnd);
602
- this._scrollView['_dispatchEvent']('scrolling');
628
+ this._scrollView["_moveContent"](
629
+ this._scrollView["_clampDelta"](deltaMove),
630
+ reachedEnd,
631
+ );
632
+ this._scrollView["_dispatchEvent"]("scrolling");
603
633
 
604
634
  // scollTo API controll move
605
- if (!this._scrollView['_autoScrolling']) {
606
- this._scrollView['_isBouncing'] = false;
607
- this._scrollView['_scrolling'] = false;
608
- this._scrollView['_dispatchEvent']('scroll-ended');
635
+ if (!this._scrollView["_autoScrolling"]) {
636
+ this._scrollView["_isBouncing"] = false;
637
+ this._scrollView["_scrolling"] = false;
638
+ this._scrollView["_dispatchEvent"]("scroll-ended");
609
639
  }
610
640
  }
611
641
  //设置模板Item
@@ -614,7 +644,8 @@ export default class FWVirtualViewComponent
614
644
  let t: any = this;
615
645
  t._itemTmp = item;
616
646
 
617
- if (t._resizeMode == cc.Layout.ResizeMode.CHILDREN) t._itemSize = t._layout.cellSize;
647
+ if (t._resizeMode == cc.Layout.ResizeMode.CHILDREN)
648
+ t._itemSize = t._layout.cellSize;
618
649
  else t._itemSize = cc.size(item.width, item.height);
619
650
 
620
651
  //获取ListItem,如果没有就取消选择模式
@@ -633,7 +664,8 @@ export default class FWVirtualViewComponent
633
664
  if (com && com.enabled) {
634
665
  t._needUpdateWidget = true;
635
666
  }
636
- if (t.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.MULTIPLE) t.multSelected = [];
667
+ if (t.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.MULTIPLE)
668
+ t.multSelected = [];
637
669
 
638
670
  t._resetColumn();
639
671
  }
@@ -654,13 +686,17 @@ export default class FWVirtualViewComponent
654
686
  case cc.Layout.AxisDirection.HORIZONTAL:
655
687
  //计算列数
656
688
  let trimW: number = t.content.width - t._leftGap - t._rightGap;
657
- t._colLineNum = Math.floor((trimW + t._columnGap) / (t._itemSize.width + t._columnGap));
689
+ t._colLineNum = Math.floor(
690
+ (trimW + t._columnGap) / (t._itemSize.width + t._columnGap),
691
+ );
658
692
  t._sizeType = true;
659
693
  break;
660
694
  case cc.Layout.AxisDirection.VERTICAL:
661
695
  //计算行数
662
696
  let trimH: number = t.content.height - t._topGap - t._bottomGap;
663
- t._colLineNum = Math.floor((trimH + t._lineGap) / (t._itemSize.height + t._lineGap));
697
+ t._colLineNum = Math.floor(
698
+ (trimH + t._lineGap) / (t._itemSize.height + t._lineGap),
699
+ );
664
700
  t._sizeType = false;
665
701
  break;
666
702
  }
@@ -675,7 +711,7 @@ export default class FWVirtualViewComponent
675
711
  */
676
712
  checkInited(printLog: boolean = true) {
677
713
  if (!this._inited) {
678
- if (printLog) FW.Log.error('List initialization not completed!');
714
+ if (printLog) FW.Log.error("List initialization not completed!");
679
715
  return false;
680
716
  }
681
717
  return true;
@@ -729,12 +765,18 @@ export default class FWVirtualViewComponent
729
765
  case cc.Layout.AxisDirection.HORIZONTAL:
730
766
  let lineNum: number = Math.ceil(t._numItems / t._colLineNum);
731
767
  result =
732
- t._topGap + t._itemSize.height * lineNum + t._lineGap * (lineNum - 1) + t._bottomGap;
768
+ t._topGap +
769
+ t._itemSize.height * lineNum +
770
+ t._lineGap * (lineNum - 1) +
771
+ t._bottomGap;
733
772
  break;
734
773
  case cc.Layout.AxisDirection.VERTICAL:
735
774
  let colNum: number = Math.ceil(t._numItems / t._colLineNum);
736
775
  result =
737
- t._leftGap + t._itemSize.width * colNum + t._columnGap * (colNum - 1) + t._rightGap;
776
+ t._leftGap +
777
+ t._itemSize.width * colNum +
778
+ t._columnGap * (colNum - 1) +
779
+ t._rightGap;
738
780
  break;
739
781
  }
740
782
  break;
@@ -746,7 +788,8 @@ export default class FWVirtualViewComponent
746
788
 
747
789
  t._allItemSize = result;
748
790
  t._allItemSizeNoEdge =
749
- t._allItemSize - (t._sizeType ? t._topGap + t._bottomGap : t._leftGap + t._rightGap);
791
+ t._allItemSize -
792
+ (t._sizeType ? t._topGap + t._bottomGap : t._leftGap + t._rightGap);
750
793
 
751
794
  if (t.cyclic) {
752
795
  let totalSize: number = t._sizeType ? t.node.height : t.node.width;
@@ -757,20 +800,25 @@ export default class FWVirtualViewComponent
757
800
  let spacing: number = t._sizeType ? t._lineGap : t._columnGap;
758
801
  t._cyclicPos2 = t._cyclicPos1 + t._allItemSizeNoEdge + spacing;
759
802
  t._cyclicAllItemSize =
760
- t._allItemSize + t._allItemSizeNoEdge * (t._cyclicNum - 1) + spacing * (t._cyclicNum - 1);
803
+ t._allItemSize +
804
+ t._allItemSizeNoEdge * (t._cyclicNum - 1) +
805
+ spacing * (t._cyclicNum - 1);
761
806
  t._cycilcAllItemSizeNoEdge = t._allItemSizeNoEdge * t._cyclicNum;
762
807
  t._cycilcAllItemSizeNoEdge += spacing * (t._cyclicNum - 1);
763
808
  // cc.log('_cyclicNum ->', t._cyclicNum, t._allItemSizeNoEdge, t._allItemSize, t._cyclicPos1, t._cyclicPos2);
764
809
  }
765
810
 
766
- t._lack = !t.cyclic && t._allItemSize < (t._sizeType ? t.node.height : t.node.width);
767
- let slideOffset: number = (!t._lack || !t.lackCenter) && t.lackSlide ? 0 : 0.1;
811
+ t._lack =
812
+ !t.cyclic &&
813
+ t._allItemSize < (t._sizeType ? t.node.height : t.node.width);
814
+ let slideOffset: number =
815
+ (!t._lack || !t.lackCenter) && t.lackSlide ? 0 : 0.1;
768
816
 
769
817
  let targetWH: number = t._lack
770
818
  ? (t._sizeType ? t.node.height : t.node.width) - slideOffset
771
819
  : t.cyclic
772
- ? t._cyclicAllItemSize
773
- : t._allItemSize;
820
+ ? t._cyclicAllItemSize
821
+ : t._allItemSize;
774
822
  if (targetWH < 0) targetWH = 0;
775
823
 
776
824
  if (t._sizeType) {
@@ -785,7 +833,12 @@ export default class FWVirtualViewComponent
785
833
  //滚动进行时...
786
834
  _onScrolling(ev: cc.Event = null) {
787
835
  if (this.frameCount == null) this.frameCount = this._updateRate;
788
- if (!this._forceUpdate && ev && ev.type != 'scroll-ended' && this.frameCount > 0) {
836
+ if (
837
+ !this._forceUpdate &&
838
+ ev &&
839
+ ev.type != "scroll-ended" &&
840
+ this.frameCount > 0
841
+ ) {
789
842
  this.frameCount--;
790
843
  return;
791
844
  } else this.frameCount = this._updateRate;
@@ -797,7 +850,9 @@ export default class FWVirtualViewComponent
797
850
  let scrollPos: any = this.content.getPosition();
798
851
  scrollPos = this._sizeType ? scrollPos.y : scrollPos.x;
799
852
 
800
- let addVal = this._allItemSizeNoEdge + (this._sizeType ? this._lineGap : this._columnGap);
853
+ let addVal =
854
+ this._allItemSizeNoEdge +
855
+ (this._sizeType ? this._lineGap : this._columnGap);
801
856
  let add: any = this._sizeType ? cc.v2(0, addVal) : cc.v2(addVal, 0);
802
857
 
803
858
  switch (this._alignCalcType) {
@@ -805,8 +860,8 @@ export default class FWVirtualViewComponent
805
860
  if (scrollPos > -this._cyclicPos1) {
806
861
  this.content.x = -this._cyclicPos2;
807
862
  if (this._scrollView.isAutoScrolling()) {
808
- this._scrollView['_autoScrollStartPosition'] =
809
- this._scrollView['_autoScrollStartPosition'].sub(add);
863
+ this._scrollView["_autoScrollStartPosition"] =
864
+ this._scrollView["_autoScrollStartPosition"].sub(add);
810
865
  }
811
866
  // if (this._beganPos) {
812
867
  // this._beganPos += add;
@@ -814,8 +869,8 @@ export default class FWVirtualViewComponent
814
869
  } else if (scrollPos < -this._cyclicPos2) {
815
870
  this.content.x = -this._cyclicPos1;
816
871
  if (this._scrollView.isAutoScrolling()) {
817
- this._scrollView['_autoScrollStartPosition'] =
818
- this._scrollView['_autoScrollStartPosition'].add(add);
872
+ this._scrollView["_autoScrollStartPosition"] =
873
+ this._scrollView["_autoScrollStartPosition"].add(add);
819
874
  }
820
875
  // if (this._beganPos) {
821
876
  // this._beganPos -= add;
@@ -826,14 +881,14 @@ export default class FWVirtualViewComponent
826
881
  if (scrollPos < this._cyclicPos1) {
827
882
  this.content.x = this._cyclicPos2;
828
883
  if (this._scrollView.isAutoScrolling()) {
829
- this._scrollView['_autoScrollStartPosition'] =
830
- this._scrollView['_autoScrollStartPosition'].add(add);
884
+ this._scrollView["_autoScrollStartPosition"] =
885
+ this._scrollView["_autoScrollStartPosition"].add(add);
831
886
  }
832
887
  } else if (scrollPos > this._cyclicPos2) {
833
888
  this.content.x = this._cyclicPos1;
834
889
  if (this._scrollView.isAutoScrolling()) {
835
- this._scrollView['_autoScrollStartPosition'] =
836
- this._scrollView['_autoScrollStartPosition'].sub(add);
890
+ this._scrollView["_autoScrollStartPosition"] =
891
+ this._scrollView["_autoScrollStartPosition"].sub(add);
837
892
  }
838
893
  }
839
894
  break;
@@ -841,14 +896,14 @@ export default class FWVirtualViewComponent
841
896
  if (scrollPos < this._cyclicPos1) {
842
897
  this.content.y = this._cyclicPos2;
843
898
  if (this._scrollView.isAutoScrolling()) {
844
- this._scrollView['_autoScrollStartPosition'] =
845
- this._scrollView['_autoScrollStartPosition'].add(add);
899
+ this._scrollView["_autoScrollStartPosition"] =
900
+ this._scrollView["_autoScrollStartPosition"].add(add);
846
901
  }
847
902
  } else if (scrollPos > this._cyclicPos2) {
848
903
  this.content.y = this._cyclicPos1;
849
904
  if (this._scrollView.isAutoScrolling()) {
850
- this._scrollView['_autoScrollStartPosition'] =
851
- this._scrollView['_autoScrollStartPosition'].sub(add);
905
+ this._scrollView["_autoScrollStartPosition"] =
906
+ this._scrollView["_autoScrollStartPosition"].sub(add);
852
907
  }
853
908
  }
854
909
  break;
@@ -856,14 +911,14 @@ export default class FWVirtualViewComponent
856
911
  if (scrollPos > -this._cyclicPos1) {
857
912
  this.content.y = -this._cyclicPos2;
858
913
  if (this._scrollView.isAutoScrolling()) {
859
- this._scrollView['_autoScrollStartPosition'] =
860
- this._scrollView['_autoScrollStartPosition'].sub(add);
914
+ this._scrollView["_autoScrollStartPosition"] =
915
+ this._scrollView["_autoScrollStartPosition"].sub(add);
861
916
  }
862
917
  } else if (scrollPos < -this._cyclicPos2) {
863
918
  this.content.y = -this._cyclicPos1;
864
919
  if (this._scrollView.isAutoScrolling()) {
865
- this._scrollView['_autoScrollStartPosition'] =
866
- this._scrollView['_autoScrollStartPosition'].add(add);
920
+ this._scrollView["_autoScrollStartPosition"] =
921
+ this._scrollView["_autoScrollStartPosition"].add(add);
867
922
  }
868
923
  }
869
924
  break;
@@ -980,7 +1035,8 @@ export default class FWVirtualViewComponent
980
1035
  // 因List的显示数据是有序的,所以只需要判断数组长度是否相等,以及头、尾两个元素是否相等即可。
981
1036
  haveDataChange =
982
1037
  this.firstListId != this._lastDisplayData[0] ||
983
- this.displayData[this.displayItemNum - 1].id != this._lastDisplayData[len - 1];
1038
+ this.displayData[this.displayItemNum - 1].id !=
1039
+ this._lastDisplayData[len - 1];
984
1040
  }
985
1041
 
986
1042
  if (this._forceUpdate || haveDataChange) {
@@ -1023,16 +1079,21 @@ export default class FWVirtualViewComponent
1023
1079
  this.viewLeft = (scrollPos.x < 0 ? -scrollPos.x : 0) - this.elasticLeft;
1024
1080
  this.viewRight = this.viewLeft + this.node.width;
1025
1081
  this.elasticRight =
1026
- this.viewRight > this.content.width ? Math.abs(this.viewRight - this.content.width) : 0;
1082
+ this.viewRight > this.content.width
1083
+ ? Math.abs(this.viewRight - this.content.width)
1084
+ : 0;
1027
1085
  this.viewRight += this.elasticRight;
1028
1086
  // cc.log(this.elasticLeft, this.elasticRight, this.viewLeft, this.viewRight);
1029
1087
  break;
1030
1088
  case 2: //单行HORIZONTAL(RIGHT_TO_LEFT)、网格VERTICAL(RIGHT_TO_LEFT)
1031
1089
  this.elasticRight = scrollPos.x < 0 ? -scrollPos.x : 0;
1032
- this.viewRight = (scrollPos.x > 0 ? -scrollPos.x : 0) + this.elasticRight;
1090
+ this.viewRight =
1091
+ (scrollPos.x > 0 ? -scrollPos.x : 0) + this.elasticRight;
1033
1092
  this.viewLeft = this.viewRight - this.node.width;
1034
1093
  this.elasticLeft =
1035
- this.viewLeft < -this.content.width ? Math.abs(this.viewLeft + this.content.width) : 0;
1094
+ this.viewLeft < -this.content.width
1095
+ ? Math.abs(this.viewLeft + this.content.width)
1096
+ : 0;
1036
1097
  this.viewLeft -= this.elasticLeft;
1037
1098
  // cc.log(this.elasticLeft, this.elasticRight, this.viewLeft, this.viewRight);
1038
1099
  break;
@@ -1049,10 +1110,13 @@ export default class FWVirtualViewComponent
1049
1110
  break;
1050
1111
  case 4: //单列VERTICAL(BOTTOM_TO_TOP)、网格HORIZONTAL(BOTTOM_TO_TOP)
1051
1112
  this.elasticBottom = scrollPos.y > 0 ? Math.abs(scrollPos.y) : 0;
1052
- this.viewBottom = (scrollPos.y < 0 ? -scrollPos.y : 0) - this.elasticBottom;
1113
+ this.viewBottom =
1114
+ (scrollPos.y < 0 ? -scrollPos.y : 0) - this.elasticBottom;
1053
1115
  this.viewTop = this.viewBottom + this.node.height;
1054
1116
  this.elasticTop =
1055
- this.viewTop > this.content.height ? Math.abs(this.viewTop - this.content.height) : 0;
1117
+ this.viewTop > this.content.height
1118
+ ? Math.abs(this.viewTop - this.content.height)
1119
+ : 0;
1056
1120
  this.viewTop -= this.elasticTop;
1057
1121
  // cc.log(this.elasticTop, this.elasticBottom, this.viewTop, this.viewBottom);
1058
1122
  break;
@@ -1081,12 +1145,14 @@ export default class FWVirtualViewComponent
1081
1145
  let cs: number = this._customSize[id];
1082
1146
  width = cs > 0 ? cs : this._itemSize.width;
1083
1147
  } else {
1084
- left = this._leftGap + (this._itemSize.width + this._columnGap) * id;
1148
+ left =
1149
+ this._leftGap + (this._itemSize.width + this._columnGap) * id;
1085
1150
  width = this._itemSize.width;
1086
1151
  }
1087
1152
  if (this.lackCenter) {
1088
1153
  left -= this._leftGap;
1089
- let offset: number = this.content.width / 2 - this._allItemSizeNoEdge / 2;
1154
+ let offset: number =
1155
+ this.content.width / 2 - this._allItemSizeNoEdge / 2;
1090
1156
  left += offset;
1091
1157
  }
1092
1158
  right = left + width;
@@ -1108,12 +1174,14 @@ export default class FWVirtualViewComponent
1108
1174
  let cs: number = this._customSize[id];
1109
1175
  width = cs > 0 ? cs : this._itemSize.width;
1110
1176
  } else {
1111
- right = -this._rightGap - (this._itemSize.width + this._columnGap) * id;
1177
+ right =
1178
+ -this._rightGap - (this._itemSize.width + this._columnGap) * id;
1112
1179
  width = this._itemSize.width;
1113
1180
  }
1114
1181
  if (this.lackCenter) {
1115
1182
  right += this._rightGap;
1116
- let offset: number = this.content.width / 2 - this._allItemSizeNoEdge / 2;
1183
+ let offset: number =
1184
+ this.content.width / 2 - this._allItemSizeNoEdge / 2;
1117
1185
  right -= offset;
1118
1186
  }
1119
1187
  left = right - width;
@@ -1139,12 +1207,14 @@ export default class FWVirtualViewComponent
1139
1207
  let cs: number = this._customSize[id];
1140
1208
  height = cs > 0 ? cs : this._itemSize.height;
1141
1209
  } else {
1142
- top = -this._topGap - (this._itemSize.height + this._lineGap) * id;
1210
+ top =
1211
+ -this._topGap - (this._itemSize.height + this._lineGap) * id;
1143
1212
  height = this._itemSize.height;
1144
1213
  }
1145
1214
  if (this.lackCenter) {
1146
1215
  top += this._topGap;
1147
- let offset: number = this.content.height / 2 - this._allItemSizeNoEdge / 2;
1216
+ let offset: number =
1217
+ this.content.height / 2 - this._allItemSizeNoEdge / 2;
1148
1218
  top -= offset;
1149
1219
  }
1150
1220
  bottom = top - height;
@@ -1166,12 +1236,14 @@ export default class FWVirtualViewComponent
1166
1236
  let cs: number = this._customSize[id];
1167
1237
  height = cs > 0 ? cs : this._itemSize.height;
1168
1238
  } else {
1169
- bottom = this._bottomGap + (this._itemSize.height + this._lineGap) * id;
1239
+ bottom =
1240
+ this._bottomGap + (this._itemSize.height + this._lineGap) * id;
1170
1241
  height = this._itemSize.height;
1171
1242
  }
1172
1243
  if (this.lackCenter) {
1173
1244
  bottom -= this._bottomGap;
1174
- let offset: number = this.content.height / 2 - this._allItemSizeNoEdge / 2;
1245
+ let offset: number =
1246
+ this.content.height / 2 - this._allItemSizeNoEdge / 2;
1175
1247
  bottom += offset;
1176
1248
  }
1177
1249
  top = bottom + height;
@@ -1192,20 +1264,26 @@ export default class FWVirtualViewComponent
1192
1264
  case cc.Layout.AxisDirection.HORIZONTAL: {
1193
1265
  switch (this._verticalDir) {
1194
1266
  case cc.Layout.VerticalDirection.TOP_TO_BOTTOM: {
1195
- top = -this._topGap - (this._itemSize.height + this._lineGap) * colLine;
1267
+ top =
1268
+ -this._topGap -
1269
+ (this._itemSize.height + this._lineGap) * colLine;
1196
1270
  bottom = top - this._itemSize.height;
1197
1271
  itemY = bottom + this._itemTmp.anchorY * this._itemSize.height;
1198
1272
  break;
1199
1273
  }
1200
1274
  case cc.Layout.VerticalDirection.BOTTOM_TO_TOP: {
1201
- bottom = this._bottomGap + (this._itemSize.height + this._lineGap) * colLine;
1275
+ bottom =
1276
+ this._bottomGap +
1277
+ (this._itemSize.height + this._lineGap) * colLine;
1202
1278
  top = bottom + this._itemSize.height;
1203
1279
  itemY = bottom + this._itemTmp.anchorY * this._itemSize.height;
1204
1280
  break;
1205
1281
  }
1206
1282
  }
1207
1283
  itemX =
1208
- this._leftGap + (id % this._colLineNum) * (this._itemSize.width + this._columnGap);
1284
+ this._leftGap +
1285
+ (id % this._colLineNum) *
1286
+ (this._itemSize.width + this._columnGap);
1209
1287
  switch (this._horizontalDir) {
1210
1288
  case cc.Layout.HorizontalDirection.LEFT_TO_RIGHT: {
1211
1289
  itemX += this._itemTmp.anchorX * this._itemSize.width;
@@ -1230,14 +1308,18 @@ export default class FWVirtualViewComponent
1230
1308
  case cc.Layout.AxisDirection.VERTICAL: {
1231
1309
  switch (this._horizontalDir) {
1232
1310
  case cc.Layout.HorizontalDirection.LEFT_TO_RIGHT: {
1233
- left = this._leftGap + (this._itemSize.width + this._columnGap) * colLine;
1311
+ left =
1312
+ this._leftGap +
1313
+ (this._itemSize.width + this._columnGap) * colLine;
1234
1314
  right = left + this._itemSize.width;
1235
1315
  itemX = left + this._itemTmp.anchorX * this._itemSize.width;
1236
1316
  itemX -= this.content.anchorX * this.content.width;
1237
1317
  break;
1238
1318
  }
1239
1319
  case cc.Layout.HorizontalDirection.RIGHT_TO_LEFT: {
1240
- right = -this._rightGap - (this._itemSize.width + this._columnGap) * colLine;
1320
+ right =
1321
+ -this._rightGap -
1322
+ (this._itemSize.width + this._columnGap) * colLine;
1241
1323
  left = right - this._itemSize.width;
1242
1324
  itemX = left + this._itemTmp.anchorX * this._itemSize.width;
1243
1325
  itemX += (1 - this.content.anchorX) * this.content.width;
@@ -1245,7 +1327,8 @@ export default class FWVirtualViewComponent
1245
1327
  }
1246
1328
  }
1247
1329
  itemY =
1248
- -this._topGap - (id % this._colLineNum) * (this._itemSize.height + this._lineGap);
1330
+ -this._topGap -
1331
+ (id % this._colLineNum) * (this._itemSize.height + this._lineGap);
1249
1332
  switch (this._verticalDir) {
1250
1333
  case cc.Layout.VerticalDirection.TOP_TO_BOTTOM: {
1251
1334
  itemY -= (1 - this._itemTmp.anchorY) * this._itemSize.height;
@@ -1332,7 +1415,10 @@ export default class FWVirtualViewComponent
1332
1415
  }
1333
1416
  t._onScrolling();
1334
1417
 
1335
- if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.ADHERING && !t.adhering) {
1418
+ if (
1419
+ t._slideMode == FW.SystemDefine.FWScrollViewSlideType.ADHERING &&
1420
+ !t.adhering
1421
+ ) {
1336
1422
  //cc.log(t.adhering, t._scrollView.isAutoScrolling(), t._scrollView.isScrolling());
1337
1423
  t.adhere();
1338
1424
  } else if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE) {
@@ -1345,12 +1431,14 @@ export default class FWVirtualViewComponent
1345
1431
  }
1346
1432
  // 触摸时
1347
1433
  _onTouchStart(ev, captureListeners) {
1348
- if ((this._scrollView['hasNestedViewGroup'] as any)(ev, captureListeners)) return;
1434
+ if ((this._scrollView["hasNestedViewGroup"] as any)(ev, captureListeners))
1435
+ return;
1349
1436
  this.curScrollIsTouch = true;
1350
1437
  let isMe = ev.eventPhase === cc.Event.AT_TARGET && ev.target === this.node;
1351
1438
  if (!isMe) {
1352
1439
  let itemNode: any = ev.target;
1353
- while (itemNode._listId == null && itemNode.parent) itemNode = itemNode.parent;
1440
+ while (itemNode._listId == null && itemNode.parent)
1441
+ itemNode = itemNode.parent;
1354
1442
  this._scrollItem = itemNode._listId != null ? itemNode : ev.target;
1355
1443
  }
1356
1444
  }
@@ -1373,7 +1461,10 @@ export default class FWVirtualViewComponent
1373
1461
 
1374
1462
  _onTouchCancelled(ev, captureListeners) {
1375
1463
  let t = this;
1376
- if ((this._scrollView['hasNestedViewGroup'] as any)(ev, captureListeners) || ev.simulate)
1464
+ if (
1465
+ (this._scrollView["hasNestedViewGroup"] as any)(ev, captureListeners) ||
1466
+ ev.simulate
1467
+ )
1377
1468
  return;
1378
1469
 
1379
1470
  t._scrollPos = null;
@@ -1423,7 +1514,10 @@ export default class FWVirtualViewComponent
1423
1514
  let t = this;
1424
1515
  if (
1425
1516
  !t.cyclic &&
1426
- (t.elasticTop > 0 || t.elasticRight > 0 || t.elasticBottom > 0 || t.elasticLeft > 0)
1517
+ (t.elasticTop > 0 ||
1518
+ t.elasticRight > 0 ||
1519
+ t.elasticBottom > 0 ||
1520
+ t.elasticLeft > 0)
1427
1521
  )
1428
1522
  return;
1429
1523
  let curPos = t._sizeType ? t.viewTop : t.viewLeft;
@@ -1465,11 +1559,18 @@ export default class FWVirtualViewComponent
1465
1559
  adhere() {
1466
1560
  let t: any = this;
1467
1561
  if (!t.checkInited()) return;
1468
- if (t.elasticTop > 0 || t.elasticRight > 0 || t.elasticBottom > 0 || t.elasticLeft > 0) return;
1562
+ if (
1563
+ t.elasticTop > 0 ||
1564
+ t.elasticRight > 0 ||
1565
+ t.elasticBottom > 0 ||
1566
+ t.elasticLeft > 0
1567
+ )
1568
+ return;
1469
1569
  t.adhering = true;
1470
1570
  t._calcNearestItem();
1471
1571
  let offset: number =
1472
- (t._sizeType ? t._topGap : t._leftGap) / (t._sizeType ? t.node.height : t.node.width);
1572
+ (t._sizeType ? t._topGap : t._leftGap) /
1573
+ (t._sizeType ? t.node.height : t.node.width);
1473
1574
  let timeInSecond: number = 0.7;
1474
1575
  t.scrollTo(t.nearestListId, timeInSecond, offset);
1475
1576
  }
@@ -1559,7 +1660,7 @@ export default class FWVirtualViewComponent
1559
1660
  item.setSiblingIndex(this.content.childrenCount - 1);
1560
1661
 
1561
1662
  let listItem: FWListItem = item.getComponent(FWListItem);
1562
- item['listItem'] = listItem;
1663
+ item["listItem"] = listItem;
1563
1664
  if (listItem) {
1564
1665
  listItem.listId = data.id;
1565
1666
  listItem.list = this;
@@ -1588,7 +1689,7 @@ export default class FWVirtualViewComponent
1588
1689
  item._listId = listId;
1589
1690
  this.content.addChild(item);
1590
1691
  listItem = item.getComponent(FWListItem);
1591
- item['listItem'] = listItem;
1692
+ item["listItem"] = listItem;
1592
1693
  if (listItem) {
1593
1694
  listItem.listId = listId;
1594
1695
  listItem.list = this;
@@ -1628,7 +1729,9 @@ export default class FWVirtualViewComponent
1628
1729
  * @param {Number||Node} listIdOrItem
1629
1730
  */
1630
1731
  _updateItemPos(listIdOrItem: any) {
1631
- let item: any = isNaN(listIdOrItem) ? listIdOrItem : this.getItemByListId(listIdOrItem);
1732
+ let item: any = isNaN(listIdOrItem)
1733
+ ? listIdOrItem
1734
+ : this.getItemByListId(listIdOrItem);
1632
1735
  let pos: any = this.getItemPos(item._listId);
1633
1736
  item.setPosition(pos.x, pos.y);
1634
1737
  }
@@ -1740,7 +1843,8 @@ export default class FWVirtualViewComponent
1740
1843
  let arr: any[] = this._getOutsideItem();
1741
1844
  for (let n: number = arr.length - 1; n >= 0; n--) {
1742
1845
  let item: any = arr[n];
1743
- if (this._scrollItem && item._listId == this._scrollItem._listId) continue;
1846
+ if (this._scrollItem && item._listId == this._scrollItem._listId)
1847
+ continue;
1744
1848
  item.isCached = true;
1745
1849
  this._pool.put(item);
1746
1850
  for (let m: number = this._lastDisplayData.length - 1; m >= 0; m--) {
@@ -1753,7 +1857,9 @@ export default class FWVirtualViewComponent
1753
1857
  // cc.log('存入::', str, ' pool.length =', this._pool.length);
1754
1858
  } else {
1755
1859
  while (this.content.childrenCount > this._numItems) {
1756
- this._delSingleItem(this.content.children[this.content.childrenCount - 1]);
1860
+ this._delSingleItem(
1861
+ this.content.children[this.content.childrenCount - 1],
1862
+ );
1757
1863
  }
1758
1864
  }
1759
1865
  }
@@ -1772,14 +1878,15 @@ export default class FWVirtualViewComponent
1772
1878
  let t: any = this;
1773
1879
 
1774
1880
  if (!t.checkInited() || t.cyclic || !t._virtual)
1775
- return FW.Log.error('This function is not allowed to be called!');
1881
+ return FW.Log.error("This function is not allowed to be called!");
1776
1882
 
1777
1883
  if (!callFunc)
1778
1884
  return FW.Log.error(
1779
- 'CallFunc are not allowed to be NULL, You need to delete the corresponding index in the data array in the CallFunc!',
1885
+ "CallFunc are not allowed to be NULL, You need to delete the corresponding index in the data array in the CallFunc!",
1780
1886
  );
1781
1887
 
1782
- if (t._aniDelRuning) return cc.warn('Please wait for the current deletion to finish!');
1888
+ if (t._aniDelRuning)
1889
+ return cc.warn("Please wait for the current deletion to finish!");
1783
1890
 
1784
1891
  let item: any = t.getItemByListId(listId);
1785
1892
  let listItem: FWListItem;
@@ -1838,11 +1945,17 @@ export default class FWVirtualViewComponent
1838
1945
  //后面的Item向前怼的动效
1839
1946
  let sec: number = 0.2333;
1840
1947
  let tween: cc.Tween, haveCB: boolean;
1841
- for (let n: number = newId != null ? newId : curLastId; n >= listId + 1; n--) {
1948
+ for (
1949
+ let n: number = newId != null ? newId : curLastId;
1950
+ n >= listId + 1;
1951
+ n--
1952
+ ) {
1842
1953
  item = t.getItemByListId(n);
1843
1954
  if (item) {
1844
1955
  let posData: any = t._calcItemPos(n - 1);
1845
- tween = cc.tween(item).to(sec, { position: cc.v2(posData.x, posData.y) });
1956
+ tween = cc
1957
+ .tween(item)
1958
+ .to(sec, { position: cc.v2(posData.x, posData.y) });
1846
1959
  if (n <= listId + 1) {
1847
1960
  haveCB = true;
1848
1961
  tween.call(() => {
@@ -1890,7 +2003,7 @@ export default class FWVirtualViewComponent
1890
2003
 
1891
2004
  let pos = t.getItemPos(listId);
1892
2005
  if (!pos) {
1893
- return CC_DEV && FW.Log.error('pos is null', listId);
2006
+ return CC_DEV && FW.Log.error("pos is null", listId);
1894
2007
  }
1895
2008
  let targetX: number, targetY: number;
1896
2009
 
@@ -1924,7 +2037,9 @@ export default class FWVirtualViewComponent
1924
2037
  viewPos = Math.abs(t._sizeType ? viewPos.y : viewPos.x);
1925
2038
 
1926
2039
  let comparePos = t._sizeType ? pos.y : pos.x;
1927
- let runScroll = Math.abs((t._scrollPos != null ? t._scrollPos : viewPos) - comparePos) > 0.5;
2040
+ let runScroll =
2041
+ Math.abs((t._scrollPos != null ? t._scrollPos : viewPos) - comparePos) >
2042
+ 0.5;
1928
2043
  // cc.log(runScroll, t._scrollPos, viewPos, comparePos)
1929
2044
 
1930
2045
  t._scrollView.stopAutoScroll();
@@ -1937,13 +2052,20 @@ export default class FWVirtualViewComponent
1937
2052
  if (!t._adheringBarrier) {
1938
2053
  t.adhering = t._adheringBarrier = false;
1939
2054
  }
1940
- t._scrollPos = t._scrollToListId = t._scrollToEndTime = t._scrollToSo = null;
2055
+ t._scrollPos =
2056
+ t._scrollToListId =
2057
+ t._scrollToEndTime =
2058
+ t._scrollToSo =
2059
+ null;
1941
2060
  //cc.log('2222222222', t._adheringBarrier)
1942
2061
  if (overStress) {
1943
2062
  // t.scrollToListId = listId;
1944
2063
  let item = t.getItemByListId(listId);
1945
2064
  if (item) {
1946
- cc.tween(item).to(0.1, { scale: 1.05 }).to(0.1, { scale: 1 }).start();
2065
+ cc.tween(item)
2066
+ .to(0.1, { scale: 1.05 })
2067
+ .to(0.1, { scale: 1 })
2068
+ .start();
1947
2069
  }
1948
2070
  }
1949
2071
  }, timeInSecond + 0.1);
@@ -1970,7 +2092,11 @@ export default class FWVirtualViewComponent
1970
2092
  vLeft = t.viewLeft;
1971
2093
 
1972
2094
  let breakFor: boolean = false;
1973
- for (let n = 0; n < t.content.childrenCount && !breakFor; n += t._colLineNum) {
2095
+ for (
2096
+ let n = 0;
2097
+ n < t.content.childrenCount && !breakFor;
2098
+ n += t._colLineNum
2099
+ ) {
1974
2100
  data = t._virtual ? t.displayData[n] : t._calcExistItemPos(n);
1975
2101
  if (data) {
1976
2102
  center = t._sizeType
@@ -2009,9 +2135,13 @@ export default class FWVirtualViewComponent
2009
2135
  }
2010
2136
  }
2011
2137
  //判断最后一个Item。。。(哎,这些判断真心恶心,判断了前面的还要判断最后一个。。。一开始呢,就只有一个布局(单列布局),那时候代码才三百行,后来就想着完善啊,艹..这坑真深,现在这行数都一千五了= =||)
2012
- data = t._virtual ? t.displayData[t.displayItemNum - 1] : t._calcExistItemPos(t._numItems - 1);
2138
+ data = t._virtual
2139
+ ? t.displayData[t.displayItemNum - 1]
2140
+ : t._calcExistItemPos(t._numItems - 1);
2013
2141
  if (data && data.id == t._numItems - 1) {
2014
- center = t._sizeType ? (data.top + data.bottom) / 2 : (center = (data.left + data.right) / 2);
2142
+ center = t._sizeType
2143
+ ? (data.top + data.bottom) / 2
2144
+ : (center = (data.left + data.right) / 2);
2015
2145
  switch (t._alignCalcType) {
2016
2146
  case 1: //单行HORIZONTAL(LEFT_TO_RIGHT)、网格VERTICAL(LEFT_TO_RIGHT)
2017
2147
  if (vRight > center) t.nearestListId = data.id;
@@ -2046,7 +2176,9 @@ export default class FWVirtualViewComponent
2046
2176
  let t: any = this;
2047
2177
  if (!t.checkInited()) return;
2048
2178
  if (t._slideMode != FW.SystemDefine.FWScrollViewSlideType.PAGE)
2049
- return FW.Log.error('This function is not allowed to be called, Must SlideMode = PAGE!');
2179
+ return FW.Log.error(
2180
+ "This function is not allowed to be called, Must SlideMode = PAGE!",
2181
+ );
2050
2182
  if (pageNum < 0 || pageNum >= t._numItems) return;
2051
2183
  if (t.curPageNum == pageNum) return;
2052
2184
  // cc.log(pageNum);
@@ -2058,14 +2190,17 @@ export default class FWVirtualViewComponent
2058
2190
  calcCustomSize(numItems: number) {
2059
2191
  let t: any = this;
2060
2192
  if (!t.checkInited()) return;
2061
- if (!t._itemTmp) return FW.Log.error('Unset template item!');
2062
- if (!t.renderEvent) return FW.Log.error('Unset Render-Event!');
2193
+ if (!t._itemTmp) return FW.Log.error("Unset template item!");
2194
+ if (!t.renderEvent) return FW.Log.error("Unset Render-Event!");
2063
2195
  t._customSize = {};
2064
2196
  let temp: any = cc.instantiate(t._itemTmp);
2065
2197
  t.content.addChild(temp);
2066
2198
  for (let n: number = 0; n < numItems; n++) {
2067
2199
  cc.Component.EventHandler.emitEvents([t.renderEvent], temp, n);
2068
- if (temp.height != t._itemSize.height || temp.width != t._itemSize.width) {
2200
+ if (
2201
+ temp.height != t._itemSize.height ||
2202
+ temp.width != t._itemSize.width
2203
+ ) {
2069
2204
  t._customSize[n] = t._sizeType ? temp.height : temp.width;
2070
2205
  }
2071
2206
  }