@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.
- package/bin/browser/BrowserApic.vue.mjs +2 -2
- package/bin/browser/BrowserApic2.vue.mjs +2 -2
- package/bin/browser/BrowserApicLib.mjs +8 -2
- package/bin/browser/BrowserJsvFragShaderView.vue.mjs +63 -0
- package/bin/jsview-vue.mjs +1604 -423
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +8 -6
- package/bin/types/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +10 -12
- package/bin/types/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +3 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +3 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +2 -2
- package/bin/types/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +1 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +1 -1
- package/bin/types/JsViewEngineWidget/index.d.ts +10 -1
- package/bin/types/JsViewVueTools/ConstSymbol.d.ts +2 -2
- package/bin/types/JsViewVueTools/JsvFederationTools.d.ts +16 -0
- package/bin/types/JsViewVueTools/JsvPerformance.d.ts +5 -0
- package/bin/types/JsViewVueTools/JsvPreDownloader.d.ts +33 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +45 -1
- package/bin/types/JsViewVueTools/index.d.ts +19 -11
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +2 -1
- package/bin/types/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +70 -0
- package/bin/types/JsViewVueWidget/JsvClipDiv/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +104 -0
- package/bin/types/JsViewVueWidget/JsvDriftScope/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +43 -17
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +5 -5
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +4 -2
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +7 -7
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +61 -1
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +153 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +9 -4
- package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/index.d.ts +3 -0
- package/package.json +1 -1
- package/tools/config/rollup.config.mjs +1 -0
- package/utils/JsViewEngineWidget/JsvFocus/{JsvFocusManager.js → JsvFocusManager.ts} +12 -12
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.ts +20 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +27 -10
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +42 -10
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +320 -203
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +11 -0
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +8 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +20 -10
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +18 -0
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +7 -0
- package/utils/JsViewEngineWidget/{index.js → index.ts} +1 -1
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +21 -2
- package/utils/JsViewVueTools/ConstSymbol.ts +2 -2
- package/utils/JsViewVueTools/JsvPreDownloader.ts +3 -3
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +1 -1
- package/utils/JsViewVueTools/index.js +19 -19
- package/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue +2 -2
- package/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue +3 -3
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +2 -2
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +3 -3
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js +8 -3
- package/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue +42 -0
- package/utils/JsViewVueWidget/JsvClipDiv/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +5 -1
- package/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue +82 -0
- package/utils/JsViewVueWidget/JsvDriftScope/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue +48 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +145 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/index.js +18 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +142 -63
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +15 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +19 -7
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +15 -11
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.ts +120 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +5 -1
- package/utils/JsViewVueWidget/JsvNinePatch.vue +13 -1
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +257 -48
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +468 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.ts +9 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.ts +13 -4
- package/utils/JsViewVueWidget/JsvScrollBox/index.ts +3 -0
- package/utils/JsViewVueWidget/index.js +3 -0
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.js +0 -19
- package/utils/JsViewVueWidget/JsvScrollBox/index.js +0 -2
|
@@ -33,6 +33,8 @@ import { ForgeConst } from "../../JsViewVueTools/ForgeConstDefine.ts";
|
|
|
33
33
|
|
|
34
34
|
const TAG = "MetroWidget";
|
|
35
35
|
|
|
36
|
+
let metroWidgetTokenGen = 1;
|
|
37
|
+
|
|
36
38
|
const _getMetroTemplate = function (
|
|
37
39
|
widgetRectInfo,
|
|
38
40
|
direction,
|
|
@@ -127,25 +129,38 @@ export const setup = (
|
|
|
127
129
|
const mode = {
|
|
128
130
|
_mode: FOCUS_MODE,
|
|
129
131
|
_touchState: TouchState.IDLE,
|
|
132
|
+
_touchCount: 0, // 触控流流程ID,解决fling等事件晚于新的touchDown时引起的混乱问题
|
|
130
133
|
|
|
131
134
|
_duringTouch: false,
|
|
132
135
|
_duringFling: false,
|
|
133
|
-
touchStart() {
|
|
136
|
+
touchStart(touchCount) {
|
|
134
137
|
this._mode = TOUCH_MODE;
|
|
135
138
|
modeForExport.value = TOUCH_MODE;
|
|
136
139
|
this._touchState = TouchState.TAP;
|
|
140
|
+
this._touchCount = touchCount;
|
|
137
141
|
},
|
|
138
|
-
touchEnd() {
|
|
139
|
-
this.
|
|
142
|
+
touchEnd(touchCount) {
|
|
143
|
+
if (touchCount == this._touchCount) {
|
|
144
|
+
this._touchState = TouchState.IDLE;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
flingStart(touchCount) {
|
|
148
|
+
if (touchCount == this._touchCount) {
|
|
149
|
+
this._touchState = TouchState.FLING;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
flingEnd(touchCount) {
|
|
153
|
+
if (touchCount == this._touchCount) {
|
|
154
|
+
this._touchState = TouchState.IDLE;
|
|
155
|
+
}
|
|
140
156
|
},
|
|
141
|
-
|
|
142
|
-
this.
|
|
157
|
+
dragStart(touchCount) {
|
|
158
|
+
if (touchCount == this._touchCount) {
|
|
159
|
+
this._touchState = TouchState.DRAG;
|
|
160
|
+
}
|
|
143
161
|
},
|
|
144
|
-
|
|
145
|
-
dragStart() {
|
|
146
|
-
this._touchState = TouchState.DRAG;
|
|
162
|
+
dragEnd(touchCount) {
|
|
147
163
|
},
|
|
148
|
-
dragEnd() { },
|
|
149
164
|
keyDown() {
|
|
150
165
|
this._mode = FOCUS_MODE;
|
|
151
166
|
modeForExport.value = FOCUS_MODE;
|
|
@@ -187,6 +202,10 @@ export const setup = (
|
|
|
187
202
|
let innerSlideSetting = props.slideSetting
|
|
188
203
|
const currentFocusIndex = ref(0);
|
|
189
204
|
|
|
205
|
+
// 当sliderDiv变化时,渲染端在响应此变化前的gap记录,用于准确计算getVisibleStart
|
|
206
|
+
let freeMoveSlideGapTop = 0;
|
|
207
|
+
let freeMoveSlideGapLeft = 0;
|
|
208
|
+
|
|
190
209
|
const DEFAULT_ANIMATION_DURATION = 200;
|
|
191
210
|
|
|
192
211
|
const isItemVisible = (item) => {
|
|
@@ -205,6 +224,7 @@ export const setup = (
|
|
|
205
224
|
}
|
|
206
225
|
|
|
207
226
|
const onAddTask = (allTask) => {
|
|
227
|
+
if (!innerData || innerData.length <= 0) { return; }
|
|
208
228
|
let resizeTaskMap = {};
|
|
209
229
|
//统一处理itemResize和slide动画
|
|
210
230
|
let minIndex = Infinity;
|
|
@@ -332,8 +352,10 @@ export const setup = (
|
|
|
332
352
|
if (anchorInfo) {
|
|
333
353
|
//保持anchor
|
|
334
354
|
const focusItem = getItemById(focusId);
|
|
335
|
-
|
|
336
|
-
|
|
355
|
+
let start = focusItem.templateInfo[pos_key] + focusItem.templateInfo[size_key] * anchorInfo.anchor - 1 - anchorInfo.anchorPosition;
|
|
356
|
+
let totalSize = metroTemplate.getBoundingBoxSize();
|
|
357
|
+
start = Math.min(Math.max(0, start), totalSize[size_key] - visibleInfo.range)
|
|
358
|
+
targetVisibleStart = normalizeVisibleStart(start, focusItem.templateInfo, focusItem.templateInfo.index, visibleInfo);
|
|
337
359
|
} else {
|
|
338
360
|
targetRect = getItemById(focusId).templateInfo;
|
|
339
361
|
}
|
|
@@ -347,8 +369,9 @@ export const setup = (
|
|
|
347
369
|
//存在resize时, 需要调整targetRect
|
|
348
370
|
preInfo = mRectCache.getPreRect();
|
|
349
371
|
if (preInfo) {
|
|
350
|
-
|
|
351
|
-
|
|
372
|
+
let totalSize = metroTemplate.getBoundingBoxSize();
|
|
373
|
+
v.start = Math.min(Math.max(0, targetRect[pos_key] - preInfo[pos_key] + v.start), totalSize[size_key] - v.range);
|
|
374
|
+
preInfo[pos_key] += (v.start - visibleInfo.start);
|
|
352
375
|
}
|
|
353
376
|
}
|
|
354
377
|
targetVisibleStart = _calculateVisibleStart(targetRect, direction, targetRect, v, preInfo);
|
|
@@ -652,7 +675,7 @@ export const setup = (
|
|
|
652
675
|
};
|
|
653
676
|
|
|
654
677
|
const setFocusByUid = (uid, needSlide = true, doAnim = false, extraSetting) => {
|
|
655
|
-
if (!uid) { return; }
|
|
678
|
+
if (!uid || innerData.length <= 0) { return; }
|
|
656
679
|
//添加item
|
|
657
680
|
templateItemAdder.tryAddItemByUid(uid);
|
|
658
681
|
const item = metroTemplate.getItemByUid(uid);
|
|
@@ -665,7 +688,7 @@ export const setup = (
|
|
|
665
688
|
}
|
|
666
689
|
|
|
667
690
|
const setFocusId = (id, needSlide = true, doAnim = false, extraSetting) => {
|
|
668
|
-
if (id == focusId) {
|
|
691
|
+
if (id == focusId || innerData.length <= 0) {
|
|
669
692
|
return;
|
|
670
693
|
}
|
|
671
694
|
//有外部触发的滚动时, 取消load
|
|
@@ -829,94 +852,140 @@ export const setup = (
|
|
|
829
852
|
}
|
|
830
853
|
}
|
|
831
854
|
|
|
832
|
-
const
|
|
855
|
+
const DATA_ID_KEY = "jsvKey";
|
|
856
|
+
const refreshData = (forceUpdate) => {
|
|
833
857
|
//由于data不支持reactive, 因此数据的更新只通过provideData
|
|
834
858
|
if (!props.provideData) {
|
|
835
859
|
console.error("refreshData: provideData is null.");
|
|
836
860
|
return;
|
|
837
861
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
862
|
+
try {
|
|
863
|
+
let newData = toRaw(props.provideData());
|
|
864
|
+
if (newData instanceof Array) {
|
|
865
|
+
let maxSameIndex = -1;
|
|
866
|
+
let layoutChange = false;
|
|
867
|
+
let onlyDataChangeList = [];
|
|
868
|
+
if (focusId >= newData.length) {
|
|
869
|
+
_changeFocusId(newData.length - 1, false)
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
if (!forceUpdate) {
|
|
873
|
+
for (let i = 0; i < dataList.length; ++i) {
|
|
874
|
+
let oldItem = dataList[i];
|
|
875
|
+
let newItem = newData[i];
|
|
876
|
+
if (newItem) {
|
|
877
|
+
if (newItem === oldItem
|
|
878
|
+
|| (typeof newItem[DATA_ID_KEY] !== "undefined" && typeof oldItem[DATA_ID_KEY] !== "undefined" && newItem[DATA_ID_KEY] === oldItem[DATA_ID_KEY])) {
|
|
879
|
+
//相同的item
|
|
880
|
+
maxSameIndex = Math.max(maxSameIndex, i);
|
|
881
|
+
} else {
|
|
882
|
+
const newMeasureItem = props.measures(newItem);
|
|
883
|
+
const oldMeasureItem = props.measures(oldItem);
|
|
884
|
+
if (props.layoutType == "relative") {
|
|
885
|
+
layoutChange = newMeasureItem.width !== oldMeasureItem.width || newMeasureItem.height !== oldMeasureItem.height;
|
|
886
|
+
} else {
|
|
887
|
+
layoutChange = newMeasureItem.width !== oldMeasureItem.width || newMeasureItem.height !== oldMeasureItem.height || newMeasureItem.left !== oldMeasureItem.left || newMeasureItem.top !== oldMeasureItem.top;
|
|
888
|
+
}
|
|
889
|
+
if (layoutChange) {
|
|
890
|
+
break;
|
|
891
|
+
} else {
|
|
892
|
+
if (i < innerData.length) {
|
|
893
|
+
onlyDataChangeList.push({
|
|
894
|
+
templateInfo: innerData[i].templateInfo,
|
|
895
|
+
measureObj: newMeasureItem,
|
|
896
|
+
data: newItem,
|
|
897
|
+
index: i,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
} else {
|
|
903
|
+
if (i >= newData.length) {
|
|
904
|
+
//item减少需要布局改变
|
|
905
|
+
layoutChange = true;
|
|
906
|
+
break;
|
|
907
|
+
} else {
|
|
908
|
+
//数据中存在undefined item
|
|
909
|
+
throw new Error("undefined item in data list.", i, newData);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
854
912
|
}
|
|
855
913
|
}
|
|
856
|
-
|
|
857
|
-
|
|
914
|
+
|
|
915
|
+
dataList = newData.concat();
|
|
916
|
+
if (forceUpdate || layoutChange) {
|
|
917
|
+
//需要更新布局
|
|
918
|
+
pageUpdateToken.value++;
|
|
919
|
+
//数据更改
|
|
920
|
+
permanentItemList = [];
|
|
921
|
+
metroTemplate = _getMetroTemplate(
|
|
922
|
+
widgetRectInfo,
|
|
923
|
+
props.direction,
|
|
924
|
+
props.supportHistoryPath,
|
|
925
|
+
props.layoutType,
|
|
926
|
+
templateMode
|
|
927
|
+
);
|
|
928
|
+
innerData = [];
|
|
929
|
+
templateItemAdder = new TemplateItemAdder(
|
|
930
|
+
metroTemplate,
|
|
931
|
+
dataList,
|
|
932
|
+
props.measures,
|
|
933
|
+
pageRange,
|
|
934
|
+
_onTemplateItemAdd,
|
|
935
|
+
props.name,
|
|
936
|
+
_onTemplateAddDone
|
|
937
|
+
);
|
|
938
|
+
if (props.onScroll) {
|
|
939
|
+
templateItemAdder.tryAddItemByIndex(dataList.length - 1);
|
|
940
|
+
} else {
|
|
941
|
+
templateItemAdder.tryAddItemById(focusId);
|
|
942
|
+
}
|
|
943
|
+
} else {
|
|
944
|
+
if (maxSameIndex < newData.length) {
|
|
945
|
+
//追加数据
|
|
946
|
+
templateItemAdder.updateData(newData);
|
|
947
|
+
if (props.onScroll) {
|
|
948
|
+
templateItemAdder.tryAddItemByIndex(dataList.length - 1);
|
|
949
|
+
} else {
|
|
950
|
+
templateItemAdder.tryAddItemById(focusId);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
//仅用户数据变更
|
|
955
|
+
if (onlyDataChangeList.length > 0) {
|
|
956
|
+
for (let i of onlyDataChangeList) {
|
|
957
|
+
if (i.index < innerData.length) {
|
|
958
|
+
innerData[i.index].updateCustomData(i.data, _getItemConfigFromMeasursObj(i.measureObj));
|
|
959
|
+
} else {
|
|
960
|
+
//之后的数据未布局, 尚未添加到innerData中
|
|
961
|
+
break;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
858
965
|
}
|
|
966
|
+
|
|
967
|
+
const updater = pageUpdater.update(
|
|
968
|
+
metroTemplate,
|
|
969
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
970
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
971
|
+
focusId,
|
|
972
|
+
false,
|
|
973
|
+
permanentItemList
|
|
974
|
+
);
|
|
975
|
+
updater.apply();
|
|
976
|
+
onItemFocus(getItemById(focusId), null);
|
|
977
|
+
let targetRect = mRectCache.getCurRect() ?? mRectCache.getPreRect();
|
|
978
|
+
if (targetRect) {
|
|
979
|
+
slideToRect(targetRect, false);
|
|
980
|
+
} else {
|
|
981
|
+
slideToItem(id2Index(focusId), false);
|
|
982
|
+
}
|
|
983
|
+
//template和slideDivStyle均确定后再次重设box condition
|
|
984
|
+
updateTouchBoxCondition();
|
|
859
985
|
}
|
|
986
|
+
} catch (e) {
|
|
987
|
+
console.log(TAG, "refresh error", e)
|
|
860
988
|
}
|
|
861
|
-
let need_update_content = false;
|
|
862
|
-
if (!_force_update && new_index === metroTemplate.size) {
|
|
863
|
-
//原始数据都在
|
|
864
|
-
if (new_index !== new_list.length) {
|
|
865
|
-
//增加数据
|
|
866
|
-
need_update_content = true;
|
|
867
|
-
templateItemAdder.updateData(new_list);
|
|
868
|
-
} else {
|
|
869
|
-
//数据没变
|
|
870
|
-
}
|
|
871
|
-
} else {
|
|
872
|
-
pageUpdateToken.value++;
|
|
873
|
-
//数据更改
|
|
874
|
-
permanentItemList = [];
|
|
875
|
-
need_update_content = true;
|
|
876
|
-
metroTemplate = _getMetroTemplate(
|
|
877
|
-
widgetRectInfo,
|
|
878
|
-
props.direction,
|
|
879
|
-
props.supportHistoryPath,
|
|
880
|
-
props.layoutType,
|
|
881
|
-
templateMode
|
|
882
|
-
);
|
|
883
|
-
innerData = [];
|
|
884
|
-
dataList = new_list;
|
|
885
|
-
templateItemAdder = new TemplateItemAdder(
|
|
886
|
-
metroTemplate,
|
|
887
|
-
dataList,
|
|
888
|
-
props.measures,
|
|
889
|
-
pageRange,
|
|
890
|
-
_onTemplateItemAdd,
|
|
891
|
-
props.name,
|
|
892
|
-
_onTemplateAddDone
|
|
893
|
-
);
|
|
894
|
-
}
|
|
895
|
-
if (need_update_content) {
|
|
896
|
-
if (props.onScroll) {
|
|
897
|
-
templateItemAdder.tryAddItemByIndex(dataList.length - 1);
|
|
898
|
-
} else {
|
|
899
|
-
templateItemAdder.tryAddItemById(focusId);
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
const updater = pageUpdater.update(
|
|
903
|
-
metroTemplate,
|
|
904
|
-
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
905
|
-
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
906
|
-
focusId,
|
|
907
|
-
false,
|
|
908
|
-
permanentItemList
|
|
909
|
-
);
|
|
910
|
-
updater.apply();
|
|
911
|
-
onItemFocus(getItemById(focusId), null);
|
|
912
|
-
let targetRect = mRectCache.getCurRect() ?? mRectCache.getPreRect();
|
|
913
|
-
if (targetRect) {
|
|
914
|
-
slideToRect(targetRect, false);
|
|
915
|
-
} else {
|
|
916
|
-
slideToItem(id2Index(focusId), false);
|
|
917
|
-
}
|
|
918
|
-
//template和slideDivStyle均确定后再次重设box condition
|
|
919
|
-
updateTouchBoxCondition();
|
|
920
989
|
};
|
|
921
990
|
|
|
922
991
|
const getVisibleItems = () => {
|
|
@@ -933,6 +1002,7 @@ export const setup = (
|
|
|
933
1002
|
};
|
|
934
1003
|
|
|
935
1004
|
const moveFocus = (direction) => {
|
|
1005
|
+
if (innerData.length <= 0) { return; }
|
|
936
1006
|
//有外部触发的滚动时, 取消load
|
|
937
1007
|
tryCancelDelayLoad();
|
|
938
1008
|
if (direction == "left" || direction == 37 || direction == EdgeDirection.left) {
|
|
@@ -1270,7 +1340,7 @@ export const setup = (
|
|
|
1270
1340
|
}
|
|
1271
1341
|
}
|
|
1272
1342
|
|
|
1273
|
-
const
|
|
1343
|
+
const _getItemConfigFromMeasursObj = (measuresObj) => {
|
|
1274
1344
|
let focusZIndex = -1,
|
|
1275
1345
|
normalZIndex = -1;
|
|
1276
1346
|
if (
|
|
@@ -1289,12 +1359,17 @@ export const setup = (
|
|
|
1289
1359
|
normalZIndex = measuresObj["zIndex"];
|
|
1290
1360
|
}
|
|
1291
1361
|
}
|
|
1292
|
-
|
|
1362
|
+
return {
|
|
1293
1363
|
focusZIndex,
|
|
1294
1364
|
normalZIndex,
|
|
1295
1365
|
permanent: measuresObj.permanent ?? false,
|
|
1296
1366
|
itemSlide: measuresObj.itemSlide ?? METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS,
|
|
1367
|
+
showSkeleton: measuresObj.showSkeleton ?? true,
|
|
1297
1368
|
};
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
const _onTemplateItemAdd = (customerData, templateItem, measuresObj) => {
|
|
1372
|
+
let itemConfig = _getItemConfigFromMeasursObj(measuresObj);
|
|
1298
1373
|
|
|
1299
1374
|
const renderStyle = reactive({
|
|
1300
1375
|
left: templateItem.left,
|
|
@@ -1560,13 +1635,14 @@ export const setup = (
|
|
|
1560
1635
|
}
|
|
1561
1636
|
};
|
|
1562
1637
|
|
|
1563
|
-
const normalizeVisibleStart = (origin, targetRect
|
|
1638
|
+
const normalizeVisibleStart = (origin, targetRect, index, _visibleInfo) => {
|
|
1564
1639
|
let pos_key = vertical ? "top" : "left";
|
|
1565
1640
|
let size_key = vertical ? "height" : "width";
|
|
1566
1641
|
let visibleStart = origin;
|
|
1642
|
+
let vInfo = _visibleInfo;
|
|
1567
1643
|
|
|
1568
1644
|
if ((innerSlideSetting.BoundaryProtect & SlideSetting.START_PROTECT) > 0) {
|
|
1569
|
-
if (
|
|
1645
|
+
if (vInfo.start >= 0) {
|
|
1570
1646
|
let boundary = 0;
|
|
1571
1647
|
//首个元素是占位符时, 在保证获焦区域完全展示的前提下要保证首个不可获焦元素的完全展示
|
|
1572
1648
|
const headTemplateInfo = getItemByIndex(0).templateInfo;
|
|
@@ -1574,41 +1650,41 @@ export const setup = (
|
|
|
1574
1650
|
targetRect
|
|
1575
1651
|
&& (!headTemplateInfo.focusable || index == headTemplateInfo.index)
|
|
1576
1652
|
&& targetRect[pos_key] + targetRect[size_key] <=
|
|
1577
|
-
|
|
1653
|
+
vInfo.range
|
|
1578
1654
|
) {
|
|
1579
1655
|
boundary = headTemplateInfo[size_key];
|
|
1580
1656
|
}
|
|
1581
1657
|
visibleStart = visibleStart < boundary ? 0 : visibleStart;
|
|
1582
1658
|
} else {
|
|
1583
1659
|
// 以最后一个item的位置作为动态的保护边界
|
|
1584
|
-
visibleStart = visibleStart <
|
|
1660
|
+
visibleStart = visibleStart < vInfo.start ? vInfo.start : visibleStart;
|
|
1585
1661
|
}
|
|
1586
1662
|
}
|
|
1587
1663
|
if ((innerSlideSetting.BoundaryProtect & SlideSetting.END_PROTECT) > 0) {
|
|
1588
1664
|
let lastTemplateInfo = getItemByIndex(metroTemplate.getTailItemIndex()).templateInfo;
|
|
1589
1665
|
const lastEnd = lastTemplateInfo[pos_key] + lastTemplateInfo[size_key];
|
|
1590
|
-
const lastVisibleStart = Math.max(lastEnd -
|
|
1666
|
+
const lastVisibleStart = Math.max(lastEnd - vInfo.range, 0);
|
|
1591
1667
|
//边界必须大于等于0, 同时若最后一个缩进时, 边界采用最后一个item的位置
|
|
1592
|
-
if (
|
|
1668
|
+
if (vInfo.end <= lastEnd) {
|
|
1593
1669
|
let boundary = lastVisibleStart;
|
|
1594
1670
|
if (
|
|
1595
1671
|
targetRect
|
|
1596
1672
|
&& (!lastTemplateInfo.focusable || index == lastTemplateInfo.index)
|
|
1597
1673
|
&& targetRect[pos_key] - lastVisibleStart >= 0
|
|
1598
1674
|
) {
|
|
1599
|
-
boundary = lastTemplateInfo[pos_key] -
|
|
1675
|
+
boundary = lastTemplateInfo[pos_key] - vInfo.range;
|
|
1600
1676
|
}
|
|
1601
1677
|
visibleStart = visibleStart > boundary ? lastVisibleStart : visibleStart;
|
|
1602
1678
|
} else {
|
|
1603
1679
|
// 以最后一个item的位置作为动态的保护边界
|
|
1604
|
-
visibleStart = visibleStart >
|
|
1680
|
+
visibleStart = visibleStart > vInfo.start ? vInfo.start : visibleStart;
|
|
1605
1681
|
}
|
|
1606
1682
|
}
|
|
1607
1683
|
return visibleStart;
|
|
1608
1684
|
}
|
|
1609
1685
|
|
|
1610
1686
|
const mRectCache = new RectCache();
|
|
1611
|
-
const _calculateVisibleStart = (targetRect, _direction, templateInfo,
|
|
1687
|
+
const _calculateVisibleStart = (targetRect, _direction, templateInfo, vInfo, preInfo = null) => {
|
|
1612
1688
|
if (!targetRect) {
|
|
1613
1689
|
console.error("MetroWidget: _calculateVisibleStart target item is null");
|
|
1614
1690
|
return 0;
|
|
@@ -1635,7 +1711,7 @@ export const setup = (
|
|
|
1635
1711
|
let pos_key = vertical ? "top" : "left";
|
|
1636
1712
|
let size_key = vertical ? "height" : "width";
|
|
1637
1713
|
let center_key = vertical ? "centerYPos" : "centerXPos";
|
|
1638
|
-
let new_visible_start =
|
|
1714
|
+
let new_visible_start = vInfo.start;
|
|
1639
1715
|
|
|
1640
1716
|
let needCalculate = true;
|
|
1641
1717
|
|
|
@@ -1646,7 +1722,7 @@ export const setup = (
|
|
|
1646
1722
|
|
|
1647
1723
|
//首页不滚动
|
|
1648
1724
|
if (innerSlideSetting.FixFirstPage) {
|
|
1649
|
-
if (targetRect[pos_key] + targetRect[size_key] - 1 <
|
|
1725
|
+
if (targetRect[pos_key] + targetRect[size_key] - 1 < vInfo.range) {
|
|
1650
1726
|
new_visible_start = 0;
|
|
1651
1727
|
needCalculate = false;
|
|
1652
1728
|
}
|
|
@@ -1655,7 +1731,7 @@ export const setup = (
|
|
|
1655
1731
|
if (needCalculate) {
|
|
1656
1732
|
new_visible_start = Math.ceil(
|
|
1657
1733
|
targetRect[pos_key] + targetRect[size_key] / 2 -
|
|
1658
|
-
|
|
1734
|
+
vInfo.range * innerSlideSetting.FixPercent
|
|
1659
1735
|
);
|
|
1660
1736
|
}
|
|
1661
1737
|
break;
|
|
@@ -1674,7 +1750,7 @@ export const setup = (
|
|
|
1674
1750
|
case SlideSetting.Type.SEAMLESS:
|
|
1675
1751
|
//首页不滚动
|
|
1676
1752
|
if (innerSlideSetting.FixFirstPage) {
|
|
1677
|
-
if (targetRect[pos_key] + targetRect[size_key] - 1 <
|
|
1753
|
+
if (targetRect[pos_key] + targetRect[size_key] - 1 < vInfo.range) {
|
|
1678
1754
|
new_visible_start = 0;
|
|
1679
1755
|
needCalculate = false;
|
|
1680
1756
|
}
|
|
@@ -1692,11 +1768,11 @@ export const setup = (
|
|
|
1692
1768
|
const itemMainSize = targetRect[size_key];
|
|
1693
1769
|
|
|
1694
1770
|
if (preRect) {
|
|
1695
|
-
const rect0Start =
|
|
1696
|
-
const rect0End =
|
|
1771
|
+
const rect0Start = vInfo.start;
|
|
1772
|
+
const rect0End = vInfo.start + vInfo.range * innerSlideSetting.StartPercent;
|
|
1697
1773
|
const rect0Range = rect0End - rect0Start + 1
|
|
1698
|
-
const rect1Start =
|
|
1699
|
-
const rect1End =
|
|
1774
|
+
const rect1Start = vInfo.start + vInfo.range * innerSlideSetting.EndPercent;
|
|
1775
|
+
const rect1End = vInfo.start + vInfo.range - 1;
|
|
1700
1776
|
const rect1Range = rect1End - rect1Start + 1;
|
|
1701
1777
|
|
|
1702
1778
|
let target0 = Math.min(preRect[pos_key], rect0End);
|
|
@@ -1713,7 +1789,7 @@ export const setup = (
|
|
|
1713
1789
|
} else {
|
|
1714
1790
|
if (direction <= 0) {
|
|
1715
1791
|
//inRect0, 只处理往左/往上
|
|
1716
|
-
rect0Result =
|
|
1792
|
+
rect0Result = vInfo.start + (itemStart - target0)
|
|
1717
1793
|
}
|
|
1718
1794
|
}
|
|
1719
1795
|
}
|
|
@@ -1726,7 +1802,7 @@ export const setup = (
|
|
|
1726
1802
|
} else {
|
|
1727
1803
|
if (direction >= 0) {
|
|
1728
1804
|
//inRect1, 只处理往右/往下
|
|
1729
|
-
rect1Result =
|
|
1805
|
+
rect1Result = vInfo.start + (itemEnd - target1);
|
|
1730
1806
|
}
|
|
1731
1807
|
}
|
|
1732
1808
|
}
|
|
@@ -1742,16 +1818,16 @@ export const setup = (
|
|
|
1742
1818
|
}
|
|
1743
1819
|
|
|
1744
1820
|
//保证item处于safe area范围
|
|
1745
|
-
const headSafeArea = innerSlideSetting.HeadSafeArea *
|
|
1746
|
-
const tailSafeArea = innerSlideSetting.TailSafeArea *
|
|
1747
|
-
if (itemMainSize >
|
|
1821
|
+
const headSafeArea = innerSlideSetting.HeadSafeArea * vInfo.range;
|
|
1822
|
+
const tailSafeArea = innerSlideSetting.TailSafeArea * vInfo.range;
|
|
1823
|
+
if (itemMainSize > vInfo.range - headSafeArea - tailSafeArea) {
|
|
1748
1824
|
// 大item
|
|
1749
|
-
new_visible_start = Math.round(itemStart - (
|
|
1825
|
+
new_visible_start = Math.round(itemStart - (vInfo.range - itemMainSize) / 2)
|
|
1750
1826
|
} else {
|
|
1751
1827
|
if (itemStart < new_visible_start + headSafeArea) {
|
|
1752
1828
|
new_visible_start = itemStart - headSafeArea;
|
|
1753
|
-
} else if (itemEnd > new_visible_start +
|
|
1754
|
-
new_visible_start = itemEnd -
|
|
1829
|
+
} else if (itemEnd > new_visible_start + vInfo.range - 1 - tailSafeArea) {
|
|
1830
|
+
new_visible_start = itemEnd - vInfo.range + tailSafeArea;
|
|
1755
1831
|
}
|
|
1756
1832
|
}
|
|
1757
1833
|
}
|
|
@@ -1763,7 +1839,7 @@ export const setup = (
|
|
|
1763
1839
|
);
|
|
1764
1840
|
}
|
|
1765
1841
|
|
|
1766
|
-
new_visible_start = normalizeVisibleStart(new_visible_start, targetRect, templateInfo?.index);
|
|
1842
|
+
new_visible_start = normalizeVisibleStart(new_visible_start, targetRect, templateInfo?.index, vInfo);
|
|
1767
1843
|
return Math.round(new_visible_start);
|
|
1768
1844
|
};
|
|
1769
1845
|
|
|
@@ -1893,9 +1969,7 @@ export const setup = (
|
|
|
1893
1969
|
let divPos = -1;
|
|
1894
1970
|
let frameCount = -1;
|
|
1895
1971
|
const getVisibleStart = (moveInfo) => {
|
|
1896
|
-
|
|
1897
|
-
divPos = vertical ? slideDivTop.value : slideDivLeft.value;
|
|
1898
|
-
}
|
|
1972
|
+
divPos = vertical ? slideDivTop.value + freeMoveSlideGapTop : slideDivLeft.value + freeMoveSlideGapLeft;
|
|
1899
1973
|
if (vertical) {
|
|
1900
1974
|
return -(divPos + Math.round(moveInfo.yPos));
|
|
1901
1975
|
} else {
|
|
@@ -1916,34 +1990,32 @@ export const setup = (
|
|
|
1916
1990
|
}
|
|
1917
1991
|
|
|
1918
1992
|
const mergeTouchSlideToSlideDiv = (touchCount) => {
|
|
1993
|
+
let originSlideDivTop = slideDivTop.value;
|
|
1994
|
+
let originSlideDivLeft = slideDivLeft.value;
|
|
1919
1995
|
if (vertical) {
|
|
1920
1996
|
slideDivTop.value = -visibleInfo.start;
|
|
1921
1997
|
} else {
|
|
1922
1998
|
slideDivLeft.value = -visibleInfo.start;
|
|
1923
1999
|
}
|
|
2000
|
+
let newSlideGapTop = originSlideDivTop - slideDivTop.value;
|
|
2001
|
+
let newSlideGapLeft = originSlideDivLeft - slideDivLeft.value;
|
|
2002
|
+
freeMoveSlideGapTop += newSlideGapTop; // 累计slider变化的gap,等待同步完毕时消除gap
|
|
2003
|
+
freeMoveSlideGapLeft += newSlideGapLeft;
|
|
1924
2004
|
|
|
1925
2005
|
const walls = getTouchWall();
|
|
1926
|
-
actorController.run([
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
.condition(wallConditionGroup, true)
|
|
2006
|
+
actorController.run((cmds) => [
|
|
2007
|
+
cmds.state().removeConditionByGroup(wallConditionGroup),
|
|
2008
|
+
cmds.condition(wallConditionGroup, true)
|
|
1930
2009
|
.boxPosition(walls.left, walls.top, walls.right, walls.bottom)
|
|
1931
|
-
.then([
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
.teleportTo(0, 0)
|
|
1939
|
-
])
|
|
1940
|
-
]);
|
|
1941
|
-
//下一帧删除touchCount
|
|
1942
|
-
actorController.run([
|
|
1943
|
-
actorController.condition().onNextTick().then([
|
|
1944
|
-
actorController.state().removeConditionByGroup(touchCountGroup),
|
|
2010
|
+
.then([cmds.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
|
|
2011
|
+
cmds.state().setStartOffsetPos(newSlideGapLeft, newSlideGapTop), // 将div的位置调整回馈给FreeMove计量系统
|
|
2012
|
+
cmds.condition().onNextTick(0).then([
|
|
2013
|
+
SliderEditFuncReOrderWrap(() => {
|
|
2014
|
+
freeMoveSlideGapTop -= newSlideGapTop;
|
|
2015
|
+
freeMoveSlideGapLeft -= newSlideGapLeft;
|
|
2016
|
+
}, true) // Slide调整回调要放在其他事件之前,调整slide的gap值
|
|
1945
2017
|
])
|
|
1946
|
-
])
|
|
2018
|
+
]);
|
|
1947
2019
|
}
|
|
1948
2020
|
|
|
1949
2021
|
const onTouchDown = (data, customData, nexusCustomData) => {
|
|
@@ -1954,27 +2026,32 @@ export const setup = (
|
|
|
1954
2026
|
//模式切换, 更新boxPosition
|
|
1955
2027
|
updateTouchBoxCondition();
|
|
1956
2028
|
}
|
|
1957
|
-
mode.touchStart();
|
|
1958
|
-
mode.flingEnd();
|
|
2029
|
+
mode.touchStart(touchCount);
|
|
1959
2030
|
// console.log("touchtest", `${props.name} animId:${debugAnimId} viewId:${debugViewId}`,
|
|
1960
2031
|
// "onTouchDown", data, customData, nexusCustomData)
|
|
1961
|
-
|
|
2032
|
+
|
|
2033
|
+
// 运动方向锁定机制
|
|
2034
|
+
// 当MetroWidget在某一方向拖动后,讲另一方向的移动进行锁定
|
|
2035
|
+
const lockThreshhold = 10;
|
|
2036
|
+
const unlockThreshold = 100;
|
|
1962
2037
|
const offsetThreshold = {
|
|
1963
|
-
left: vertical ? undefined :
|
|
1964
|
-
right: vertical ? undefined :
|
|
1965
|
-
top: vertical ?
|
|
1966
|
-
bottom: vertical ?
|
|
2038
|
+
left: vertical ? undefined : lockThreshhold,
|
|
2039
|
+
right: vertical ? undefined : lockThreshhold,
|
|
2040
|
+
top: vertical ? lockThreshhold : undefined,
|
|
2041
|
+
bottom: vertical ? lockThreshhold : undefined,
|
|
1967
2042
|
}
|
|
1968
2043
|
|
|
1969
|
-
|
|
1970
|
-
|
|
2044
|
+
let passDownTouchInfo = nexusCustomData;
|
|
2045
|
+
actorController.run((cmds) => [
|
|
2046
|
+
cmds
|
|
1971
2047
|
.condition(undefined, false)
|
|
1972
2048
|
.offsetPosition(offsetThreshold.left, offsetThreshold.top, offsetThreshold.right, offsetThreshold.bottom)
|
|
1973
|
-
.then([
|
|
1974
|
-
|
|
2049
|
+
.then([
|
|
2050
|
+
cmds.state().touchLockSwitch(true, vertical ? 1 : 2, unlockThreshold)]),
|
|
2051
|
+
cmds
|
|
1975
2052
|
.condition(undefined, false)
|
|
1976
2053
|
.startMove(true, true)
|
|
1977
|
-
.then([onDragStart]),
|
|
2054
|
+
.then([SliderEditFuncReOrderWrap((d) => { onDragStart(d, null, passDownTouchInfo) })]),
|
|
1978
2055
|
])
|
|
1979
2056
|
|
|
1980
2057
|
//blur item
|
|
@@ -2002,28 +2079,30 @@ export const setup = (
|
|
|
2002
2079
|
anchorPosList.push(-visibleInfo.start - visibleInfo.range - anchorPos + 1);
|
|
2003
2080
|
anchorPos += anchorSpacing;
|
|
2004
2081
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2082
|
+
actorController.run((cmds) => {
|
|
2083
|
+
const reachConditionList = anchorPosList.map(pos => {
|
|
2084
|
+
return cmds
|
|
2085
|
+
.condition(reachAnchorGroup)
|
|
2086
|
+
.reachPosition(pos, undefined)
|
|
2087
|
+
.then([SliderEditFuncReOrderWrap((data) => { updateRenderItems(true, true) })])
|
|
2088
|
+
})
|
|
2089
|
+
reachConditionList.unshift(
|
|
2090
|
+
cmds.state().removeConditionByGroup(reachAnchorGroup),
|
|
2091
|
+
)
|
|
2092
|
+
return reachConditionList
|
|
2093
|
+
});
|
|
2015
2094
|
}
|
|
2016
2095
|
|
|
2017
|
-
const onTouchRelease = () => {
|
|
2096
|
+
const onTouchRelease = (touchCount) => {
|
|
2018
2097
|
if (mode.getTouchState() == TouchState.TAP) {
|
|
2019
2098
|
//只点击, 没有移动或者fling
|
|
2020
2099
|
updateRenderItems(false, false);
|
|
2021
|
-
mode.touchEnd();
|
|
2100
|
+
mode.touchEnd(touchCount);
|
|
2022
2101
|
} else {
|
|
2023
2102
|
if (touchRecorder.moved && !mode.duringFling()) {
|
|
2024
2103
|
mergeTouchSlideToSlideDiv(touchRecorder.touchCount);
|
|
2025
2104
|
updateRenderItems(false, false);
|
|
2026
|
-
mode.touchEnd()
|
|
2105
|
+
mode.touchEnd(touchCount)
|
|
2027
2106
|
}
|
|
2028
2107
|
}
|
|
2029
2108
|
}
|
|
@@ -2031,43 +2110,50 @@ export const setup = (
|
|
|
2031
2110
|
const exportOnTouchRelease = props.touchFlag > 0 ? onTouchRelease : undefined;
|
|
2032
2111
|
|
|
2033
2112
|
const onDragStart = (data, customData, nexusCustomData) => {
|
|
2113
|
+
let touchCount = getTouchCount(nexusCustomData); // 注意,由startMove触发的onDragStart是没有touchCount的
|
|
2034
2114
|
touchRecorder.move();
|
|
2035
|
-
mode.dragStart()
|
|
2115
|
+
mode.dragStart(touchCount)
|
|
2036
2116
|
visibleInfo.start = getVisibleStart(data);
|
|
2037
2117
|
}
|
|
2038
2118
|
|
|
2039
2119
|
const onDragEnd = (data, customData, nexusCustomData) => {
|
|
2120
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
2121
|
+
mode.dragEnd(touchCount);
|
|
2040
2122
|
visibleInfo.start = getVisibleStart(data);
|
|
2041
|
-
actorController.run([
|
|
2042
|
-
|
|
2123
|
+
actorController.run((cmds) => [
|
|
2124
|
+
cmds.state().removeConditionByGroup(reachAnchorGroup),
|
|
2043
2125
|
]);
|
|
2044
2126
|
}
|
|
2045
2127
|
|
|
2046
2128
|
const onFlingStart = (data, customData, nexusCustomData) => {
|
|
2129
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
2047
2130
|
touchRecorder.move();
|
|
2048
|
-
mode.flingStart();
|
|
2131
|
+
mode.flingStart(touchCount);
|
|
2049
2132
|
visibleInfo.start = getVisibleStart(data);
|
|
2050
2133
|
updateRenderItems(true, true);
|
|
2051
2134
|
}
|
|
2052
2135
|
|
|
2053
2136
|
const onFlingProgress = (data, customData, nexusCustomData) => {
|
|
2137
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
2054
2138
|
visibleInfo.start = getVisibleStart(data);
|
|
2055
2139
|
updateRenderItems(true, true);
|
|
2056
2140
|
}
|
|
2057
2141
|
|
|
2058
2142
|
const onFlingEnd = (data, customData, nexusCustomData) => {
|
|
2143
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
2059
2144
|
visibleInfo.start = getVisibleStart(data);
|
|
2060
2145
|
//记录拖拽的距离
|
|
2061
2146
|
if (mode.duringFling()) {
|
|
2062
2147
|
let touchCount = getTouchCount(nexusCustomData);
|
|
2063
2148
|
mergeTouchSlideToSlideDiv(touchCount);
|
|
2064
2149
|
updateRenderItems(false, false);
|
|
2065
|
-
mode.flingEnd();
|
|
2066
|
-
mode.touchEnd();
|
|
2150
|
+
mode.flingEnd(touchCount);
|
|
2151
|
+
mode.touchEnd(touchCount);
|
|
2067
2152
|
}
|
|
2068
2153
|
}
|
|
2069
2154
|
|
|
2070
2155
|
const onFlingDrop = (data, customData, nexusCustomData) => {
|
|
2156
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
2071
2157
|
visibleInfo.start = getVisibleStart(data);
|
|
2072
2158
|
}
|
|
2073
2159
|
|
|
@@ -2092,6 +2178,7 @@ export const setup = (
|
|
|
2092
2178
|
wall.left = wall.right;
|
|
2093
2179
|
}
|
|
2094
2180
|
}
|
|
2181
|
+
|
|
2095
2182
|
return wall;
|
|
2096
2183
|
}
|
|
2097
2184
|
|
|
@@ -2113,12 +2200,12 @@ export const setup = (
|
|
|
2113
2200
|
const walls = getTouchWall();
|
|
2114
2201
|
|
|
2115
2202
|
//更新wall设置
|
|
2116
|
-
actorController.run([
|
|
2117
|
-
|
|
2118
|
-
|
|
2203
|
+
actorController.run((cmds) => [
|
|
2204
|
+
cmds.state().removeConditionByGroup(wallConditionGroup),
|
|
2205
|
+
cmds
|
|
2119
2206
|
.condition(wallConditionGroup, true)
|
|
2120
2207
|
.boxPosition(walls.left, walls.top, walls.right, walls.bottom)
|
|
2121
|
-
.then([
|
|
2208
|
+
.then([cmds.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
|
|
2122
2209
|
]);
|
|
2123
2210
|
}
|
|
2124
2211
|
}
|
|
@@ -2138,6 +2225,21 @@ export const setup = (
|
|
|
2138
2225
|
}
|
|
2139
2226
|
};
|
|
2140
2227
|
|
|
2228
|
+
const metroWidgetToken = metroWidgetTokenGen++;
|
|
2229
|
+
|
|
2230
|
+
let orderTouchSlideCallbacks;
|
|
2231
|
+
const SliderEditFuncReOrderWrap = (callback, addHeader = false) => {
|
|
2232
|
+
return (...args) => {
|
|
2233
|
+
let pkg = { cb: callback, a: args }
|
|
2234
|
+
if (addHeader) {
|
|
2235
|
+
orderTouchSlideCallbacks.splice(0, 0, pkg);
|
|
2236
|
+
} else {
|
|
2237
|
+
orderTouchSlideCallbacks.push(pkg);
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
|
|
2141
2243
|
//TODO debug
|
|
2142
2244
|
// let debugAnimId = -1;
|
|
2143
2245
|
// let debugViewId = -1
|
|
@@ -2145,54 +2247,68 @@ export const setup = (
|
|
|
2145
2247
|
actorController = new ActorControl();
|
|
2146
2248
|
const divView = touchDiv.value.jsvGetProxyView();
|
|
2147
2249
|
actorController.bindForgeView(divView, true);
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2250
|
+
|
|
2251
|
+
// 对触控回调进行顺序管理
|
|
2252
|
+
orderTouchSlideCallbacks = new Array();
|
|
2253
|
+
actorController.addCondCycleListener(
|
|
2254
|
+
// starter
|
|
2255
|
+
() => {
|
|
2256
|
+
// TODO: condtion回调的开始处理时机,预留函数为了加打印追踪
|
|
2257
|
+
},
|
|
2258
|
+
// finish
|
|
2259
|
+
() => {
|
|
2260
|
+
// 按照排好的顺序,进行cb调用
|
|
2261
|
+
for (let pkg of orderTouchSlideCallbacks) {
|
|
2262
|
+
pkg.cb(...pkg.a);
|
|
2263
|
+
}
|
|
2264
|
+
// 执行结束后进行清理
|
|
2265
|
+
orderTouchSlideCallbacks.length = 0;
|
|
2266
|
+
}
|
|
2267
|
+
)
|
|
2268
|
+
|
|
2269
|
+
|
|
2153
2270
|
// debugAnimId = actorController.debugGetAnimId();
|
|
2154
2271
|
// debugViewId = divView.ViewId;
|
|
2155
2272
|
// console.log("testtest", props.name, `animId:${debugAnimId} viewId:${debugViewId}`);
|
|
2156
2273
|
const walls = getTouchWall();
|
|
2157
2274
|
//注册回调
|
|
2158
|
-
actorController.run([
|
|
2159
|
-
|
|
2275
|
+
actorController.run((cmds) => [
|
|
2276
|
+
cmds
|
|
2160
2277
|
.condition(undefined, true)
|
|
2161
2278
|
.onTouchDown()
|
|
2162
|
-
.then([onTouchDown]),
|
|
2163
|
-
|
|
2279
|
+
.then([SliderEditFuncReOrderWrap(onTouchDown)]),
|
|
2280
|
+
cmds
|
|
2164
2281
|
.condition(undefined, true)
|
|
2165
2282
|
.onDragStart()
|
|
2166
|
-
.then([onDragStart]),
|
|
2167
|
-
|
|
2283
|
+
.then([SliderEditFuncReOrderWrap(onDragStart)]),
|
|
2284
|
+
cmds
|
|
2168
2285
|
.condition(undefined, true)
|
|
2169
2286
|
.onDragEnd()
|
|
2170
|
-
.then([onDragEnd]),
|
|
2171
|
-
|
|
2287
|
+
.then([SliderEditFuncReOrderWrap(onDragEnd)]),
|
|
2288
|
+
cmds
|
|
2172
2289
|
.condition(undefined, true)
|
|
2173
2290
|
.onFlingStart()
|
|
2174
|
-
.then([onFlingStart]),
|
|
2175
|
-
|
|
2291
|
+
.then([SliderEditFuncReOrderWrap(onFlingStart)]),
|
|
2292
|
+
cmds
|
|
2176
2293
|
.condition(undefined, true)
|
|
2177
2294
|
.onFlingProgress()
|
|
2178
|
-
.then([onFlingProgress]),
|
|
2179
|
-
|
|
2295
|
+
.then([SliderEditFuncReOrderWrap(onFlingProgress)]),
|
|
2296
|
+
cmds
|
|
2180
2297
|
.condition(undefined, true)
|
|
2181
2298
|
.onFlingEnd()
|
|
2182
|
-
.then([onFlingEnd]),
|
|
2183
|
-
|
|
2299
|
+
.then([SliderEditFuncReOrderWrap(onFlingEnd)]),
|
|
2300
|
+
cmds
|
|
2184
2301
|
.condition(undefined, true)
|
|
2185
2302
|
.onFlingDrop()
|
|
2186
|
-
.then([onFlingDrop]),
|
|
2187
|
-
|
|
2303
|
+
.then([SliderEditFuncReOrderWrap(onFlingDrop)]),
|
|
2304
|
+
cmds
|
|
2188
2305
|
.condition(undefined, true)
|
|
2189
2306
|
.onTouchRelease()
|
|
2190
|
-
.then([
|
|
2191
|
-
|
|
2192
|
-
actorController
|
|
2307
|
+
.then([cmds.state().touchLockSwitch(false, vertical ? 1 : 2)]),
|
|
2308
|
+
cmds
|
|
2193
2309
|
.condition(wallConditionGroup, true)
|
|
2194
2310
|
.boxPosition(walls.left, walls.top, walls.right, walls.bottom)
|
|
2195
|
-
.then([
|
|
2311
|
+
.then([cmds.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
|
|
2196
2312
|
]);
|
|
2197
2313
|
}
|
|
2198
2314
|
|
|
@@ -2292,6 +2408,7 @@ export const setup = (
|
|
|
2292
2408
|
onUpdated(() => { });
|
|
2293
2409
|
|
|
2294
2410
|
onBeforeUnmount(() => {
|
|
2411
|
+
taskManager.cancelAllTask();
|
|
2295
2412
|
tryCancelDelayLoad();
|
|
2296
2413
|
mounted = false;
|
|
2297
2414
|
});
|