@shijiu/jsview-vue 2.1.476-test.0 → 2.2.35
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/BrowserTextureAnim.vue.mjs +8 -1
- package/bin/jsview-vue.mjs +340 -127
- package/bin/types/JsViewEngineWidget/CheckType.d.ts +3 -0
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue.d.ts +102 -0
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +88 -0
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +10 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/Const.d.ts +16 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +14 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +158 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +158 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +46 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +21 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +46 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/SlotComponent.vue.d.ts +48 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/VisibleInfo.d.ts +16 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +17 -0
- package/bin/types/JsViewEngineWidget/RangeModel.d.ts +162 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +37 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/Fence.d.ts +58 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +15 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +97 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +22 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/index.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/WidgetCommon.d.ts +137 -0
- package/bin/types/JsViewEngineWidget/index.d.ts +6 -0
- package/bin/types/JsViewPlugin/JsvAccount/JsvAccount.d.ts +42 -0
- package/bin/types/JsViewPlugin/JsvAudio/AudioProxy.d.ts +2 -0
- package/bin/types/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue.d.ts +18 -0
- package/bin/types/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue.d.ts +208 -0
- package/bin/types/JsViewPlugin/JsvAudio/CheckType.d.ts +2 -0
- package/bin/types/JsViewPlugin/JsvAudio/Events.d.ts +13 -0
- package/bin/types/JsViewPlugin/JsvAudio/JsvAudio.vue.d.ts +18 -0
- package/bin/types/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.d.ts +8 -0
- package/bin/types/JsViewPlugin/JsvAudio/JsvAudioProxy.vue.d.ts +2 -0
- package/bin/types/JsViewPlugin/JsvAudio/PluginLoader.d.ts +1 -0
- package/bin/types/JsViewPlugin/JsvAudio/ScreenLockManager.d.ts +5 -0
- package/bin/types/JsViewPlugin/JsvAudio/index.d.ts +3 -0
- package/bin/types/JsViewPlugin/JsvAudio/version.d.ts +10 -0
- package/bin/types/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +1 -0
- package/bin/types/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +13 -0
- package/bin/types/JsViewPlugin/JsvLatex/Color.d.ts +1 -0
- package/bin/types/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +17 -0
- package/bin/types/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +3 -0
- package/bin/types/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +2 -0
- package/bin/types/JsViewPlugin/JsvLatex/PluginLoader.d.ts +1 -0
- package/bin/types/JsViewPlugin/JsvLatex/index.d.ts +3 -0
- package/bin/types/JsViewPlugin/JsvLatex/version.d.ts +10 -0
- package/bin/types/JsViewPlugin/index.d.ts +3 -0
- package/bin/types/JsViewVueTools/DebugContentShellJBridge.d.ts +6 -0
- package/bin/types/JsViewVueTools/DebugTool.d.ts +8 -0
- package/bin/types/JsViewVueTools/DefaultKeyMap.d.ts +10 -0
- package/bin/types/JsViewVueTools/ForgeHandles.d.ts +6 -0
- package/bin/types/JsViewVueTools/JsvDemoTester.d.ts +2 -0
- package/bin/types/JsViewVueTools/JsvDynamicCssStyle.d.ts +14 -0
- package/bin/types/JsViewVueTools/JsvDynamicKeyFrames.d.ts +21 -0
- package/bin/types/JsViewVueTools/JsvHashHistory.d.ts +16 -0
- package/bin/types/JsViewVueTools/JsvImpactTracer.d.ts +40 -0
- package/bin/types/JsViewVueTools/JsvRefTaker.d.ts +27 -0
- package/bin/types/JsViewVueTools/JsvRuntimeBridge.d.ts +223 -0
- package/bin/types/JsViewVueTools/JsvStyleClass.d.ts +31 -0
- package/bin/types/JsViewVueTools/JsvStyleSheetsDeclarer.d.ts +15 -0
- package/bin/types/JsViewVueTools/JsvTextTools.d.ts +37 -0
- package/bin/types/JsViewVueTools/JsvTextureDefines.d.ts +6 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.d.ts +95 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +15 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +75 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +24 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/Store.d.ts +10 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/Texture.d.ts +15 -0
- package/bin/types/JsViewVueTools/NinePatchHelper.d.ts +21 -0
- package/bin/types/JsViewVueTools/TypeCheckAndSet.d.ts +2 -0
- package/bin/types/JsViewVueTools/index.d.ts +14 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/ActorControlBase.d.ts +31 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/JsvActorMove.vue.d.ts +64 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.d.ts +33 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +15 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +50 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +23 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.d.ts +3 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/GifData.d.ts +5 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/NormalLoopTool.d.ts +7 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.d.ts +12 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.d.ts +5 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +19 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/WebpData.d.ts +5 -0
- package/bin/types/{jsview-vue-common.d.mts → JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.d.ts} +12 -13
- package/bin/types/JsViewVueWidget/JsvConnectLine/ArcLineManager.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvEnableRenderBreak.vue.d.ts +51 -0
- package/bin/types/JsViewVueWidget/JsvFilterView.vue.d.ts +72 -0
- package/bin/types/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue.d.ts +72 -0
- package/bin/types/JsViewVueWidget/JsvFlexCell/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +72 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +84 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/NexusNode.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvGrid.vue.d.ts +168 -0
- package/bin/types/JsViewVueWidget/JsvHole.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +36 -0
- package/bin/types/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +210 -0
- package/bin/types/JsViewVueWidget/JsvInput/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +12 -0
- package/bin/types/JsViewVueWidget/JsvLine/LineManager.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvLine/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvMarquee.vue.d.ts +12 -0
- package/bin/types/JsViewVueWidget/JsvMaskClipDiv.vue.d.ts +83 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/CommonType.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/Constant.d.ts +9 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/DataTree.d.ts +69 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/Geometry.d.ts +68 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +145 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/rtree.d.ts +40 -0
- package/bin/types/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +31 -0
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvPieChart.vue.d.ts +9 -0
- package/bin/types/JsViewVueWidget/JsvPosterDiv.vue.d.ts +60 -0
- package/bin/types/JsViewVueWidget/JsvPosterImage.vue.d.ts +75 -0
- package/bin/types/JsViewVueWidget/JsvPreload/BrowserPreload.vue.d.ts +10 -0
- package/bin/types/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +25 -0
- package/bin/types/JsViewVueWidget/JsvPreload/index.d.ts +17 -0
- package/bin/types/JsViewVueWidget/JsvProgressBar.vue.d.ts +12 -0
- package/bin/types/JsViewVueWidget/JsvQrcode/BrowserQrcode.vue.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +60 -0
- package/bin/types/JsViewVueWidget/JsvQrcode/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvRadarChart.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvRipple/Constant.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +84 -0
- package/bin/types/JsViewVueWidget/JsvRipple/index.d.ts +3 -0
- package/bin/types/JsViewVueWidget/JsvScaleTextBox.vue.d.ts +10 -0
- package/bin/types/JsViewVueWidget/JsvSector.vue.d.ts +10 -0
- package/bin/types/JsViewVueWidget/JsvSoundPool.d.ts +84 -0
- package/bin/types/JsViewVueWidget/JsvSpray/BrowserSpray.vue.d.ts +25 -0
- package/bin/types/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +38 -0
- package/bin/types/JsViewVueWidget/JsvSpray/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.d.ts +14 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue.d.ts +69 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/JsvSpriteTools.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/SpriteController.d.ts +17 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/index.d.ts +5 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/sAnimationToken.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +209 -0
- package/bin/types/JsViewVueWidget/JsvSwiper/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +97 -0
- package/bin/types/JsViewVueWidget/JsvSwiper3D/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvTextBox.vue.d.ts +75 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue.d.ts +151 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/CommonType.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +107 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/index.d.ts +14 -0
- package/bin/types/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +84 -0
- package/bin/types/JsViewVueWidget/JsvVisibleSensor/index.d.ts +84 -0
- package/bin/types/JsViewVueWidget/index.d.ts +37 -0
- package/bin/types/index.d.ts +4 -0
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/tools/config/tsconfig.json +6 -6
- package/tools/jsview-vue-build.mjs +13 -4
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +8 -4
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +19 -5
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +317 -151
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +3 -3
- package/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.ts +1 -1
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +21 -21
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +4 -4
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +10 -10
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +6 -6
- package/utils/JsViewEngineWidget/WidgetCommon.ts +18 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +2 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +7 -3
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +4 -2
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +26 -0
- package/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue +1 -1
- package/utils/JsViewVueWidget/JsvMindMap/rtree.js +1 -1
- package/utils/JsViewVueWidget/JsvTextBox.vue +14 -2
- package/utils/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue +18 -3
- package/bin/types/browser/BrowserApic.vue.d.mts +0 -33
- package/bin/types/browser/BrowserApic2.vue.d.mts +0 -16
- package/bin/types/browser/BrowserApicLib.d.mts +0 -56
- package/bin/types/browser/BrowserAudio.vue.d.mts +0 -2
- package/bin/types/browser/BrowserJsvLatex.vue.d.mts +0 -55
- package/bin/types/browser/BrowserPreload.vue.d.mts +0 -14
- package/bin/types/browser/BrowserQrcode.vue.d.mts +0 -29
- package/bin/types/browser/BrowserSpray.vue.d.mts +0 -2
- package/bin/types/browser/BrowserTextureAnim.vue.d.mts +0 -2
- package/bin/types/export-sfc.d.mts +0 -2
- package/bin/types/jsview-vue.d.mts +0 -2511
|
@@ -108,6 +108,19 @@ export const setup = (
|
|
|
108
108
|
FLING: 3,
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
let innerKeepTraceRange = 0;
|
|
112
|
+
if (typeof props.keepTraceRange > 0) {
|
|
113
|
+
innerKeepTraceRange = props.keepTraceRange;
|
|
114
|
+
} else {
|
|
115
|
+
if (props.touchFlag > 0) {
|
|
116
|
+
//触控默认3屏
|
|
117
|
+
innerKeepTraceRange = 3;
|
|
118
|
+
} else {
|
|
119
|
+
//按键模式默认0屏
|
|
120
|
+
innerKeepTraceRange = 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
111
124
|
const modeForExport = ref(FOCUS_MODE);
|
|
112
125
|
const mode = {
|
|
113
126
|
_mode: FOCUS_MODE,
|
|
@@ -171,6 +184,7 @@ export const setup = (
|
|
|
171
184
|
let visibleInfo = new VisibleInfo();
|
|
172
185
|
let preSlideDirection = 0;
|
|
173
186
|
let alreadyCallItemFocus = false;
|
|
187
|
+
let innerSlideSetting = props.slideSetting
|
|
174
188
|
const currentFocusIndex = ref(0);
|
|
175
189
|
|
|
176
190
|
const DEFAULT_ANIMATION_DURATION = 200;
|
|
@@ -201,6 +215,7 @@ export const setup = (
|
|
|
201
215
|
|
|
202
216
|
let existOnFocusChange = false;
|
|
203
217
|
let targetVisibleStart = visibleInfo.start;
|
|
218
|
+
|
|
204
219
|
//先遍历寻找slide task, 确认目标位置. 有多个slide task时取最后一个
|
|
205
220
|
taskList.forEach(i => {
|
|
206
221
|
if (i.type == TaskType.SLIDE) {
|
|
@@ -291,8 +306,8 @@ export const setup = (
|
|
|
291
306
|
easing: "",
|
|
292
307
|
onStart: null,
|
|
293
308
|
onEnd: null,
|
|
294
|
-
speed:
|
|
295
|
-
duration:
|
|
309
|
+
speed: innerSlideSetting.Speed,
|
|
310
|
+
duration: innerSlideSetting.Duration,
|
|
296
311
|
}
|
|
297
312
|
}
|
|
298
313
|
}
|
|
@@ -313,14 +328,8 @@ export const setup = (
|
|
|
313
328
|
taskManager.run(() => {
|
|
314
329
|
updateHandler = pageUpdater.update(
|
|
315
330
|
metroTemplate,
|
|
316
|
-
visibleInfo.startWithPadding -
|
|
317
|
-
|
|
318
|
-
visibleInfo.startMax +
|
|
319
|
-
visibleInfo.range +
|
|
320
|
-
visibleInfo.padding.end -
|
|
321
|
-
1,
|
|
322
|
-
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
323
|
-
),
|
|
331
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
332
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
324
333
|
focusId,
|
|
325
334
|
mergeTmp,
|
|
326
335
|
permanentItemList
|
|
@@ -459,7 +468,7 @@ export const setup = (
|
|
|
459
468
|
}
|
|
460
469
|
|
|
461
470
|
const _slideTo = (target, animObj, updateParam = { mergeTmp: false }) => {
|
|
462
|
-
if (slideLock) {
|
|
471
|
+
if (slideLock || target == visibleInfo.start) {
|
|
463
472
|
return
|
|
464
473
|
};
|
|
465
474
|
taskManager.addTask(TaskType.SLIDE, { target: -target, animObj, updateParam });
|
|
@@ -591,6 +600,8 @@ export const setup = (
|
|
|
591
600
|
if (id == focusId) {
|
|
592
601
|
return;
|
|
593
602
|
}
|
|
603
|
+
//有外部触发的滚动时, 取消load
|
|
604
|
+
tryCancelDelayLoad();
|
|
594
605
|
templateItemAdder.tryAddItemById(id);
|
|
595
606
|
let next_focus_item = getItemById(id);
|
|
596
607
|
if (next_focus_item) {
|
|
@@ -679,6 +690,8 @@ export const setup = (
|
|
|
679
690
|
};
|
|
680
691
|
|
|
681
692
|
const slideTo = (position, doAnim) => {
|
|
693
|
+
//有外部触发的滚动时, 取消load
|
|
694
|
+
tryCancelDelayLoad();
|
|
682
695
|
templateItemAdder.tryAddItemByPosition(position);
|
|
683
696
|
if (
|
|
684
697
|
typeof position !== "undefined" &&
|
|
@@ -687,10 +700,10 @@ export const setup = (
|
|
|
687
700
|
let animObj = null;
|
|
688
701
|
if (doAnim) {
|
|
689
702
|
animObj = {
|
|
690
|
-
easing:
|
|
703
|
+
easing: innerSlideSetting.Easing,
|
|
691
704
|
onStart: null,
|
|
692
|
-
speed:
|
|
693
|
-
duration:
|
|
705
|
+
speed: innerSlideSetting.Speed,
|
|
706
|
+
duration: innerSlideSetting.Duration,
|
|
694
707
|
};
|
|
695
708
|
}
|
|
696
709
|
_slideTo(position, animObj);
|
|
@@ -720,6 +733,8 @@ export const setup = (
|
|
|
720
733
|
};
|
|
721
734
|
|
|
722
735
|
const slideToDiv = (div, doAnim) => {
|
|
736
|
+
//有外部触发的滚动时, 取消load
|
|
737
|
+
tryCancelDelayLoad();
|
|
723
738
|
if (div) {
|
|
724
739
|
const item_layout = div.jsvGetRelativePosition(toRaw(locateDiv.value));
|
|
725
740
|
const direction = 1;
|
|
@@ -741,8 +756,8 @@ export const setup = (
|
|
|
741
756
|
_slideTo(cur_slide, doAnim ? {
|
|
742
757
|
easing: "",
|
|
743
758
|
onStart: null,
|
|
744
|
-
speed:
|
|
745
|
-
duration:
|
|
759
|
+
speed: innerSlideSetting.Speed,
|
|
760
|
+
duration: innerSlideSetting.Duration,
|
|
746
761
|
onEnd: null,
|
|
747
762
|
} : null);
|
|
748
763
|
}
|
|
@@ -821,11 +836,8 @@ export const setup = (
|
|
|
821
836
|
}
|
|
822
837
|
const updater = pageUpdater.update(
|
|
823
838
|
metroTemplate,
|
|
824
|
-
visibleInfo.startWithPadding -
|
|
825
|
-
|
|
826
|
-
visibleInfo.startMax + visibleInfo.range + visibleInfo.padding.end - 1,
|
|
827
|
-
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
828
|
-
),
|
|
839
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
840
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
829
841
|
focusId,
|
|
830
842
|
false,
|
|
831
843
|
permanentItemList
|
|
@@ -833,6 +845,8 @@ export const setup = (
|
|
|
833
845
|
updater.apply();
|
|
834
846
|
onItemFocus(getItemById(focusId), null);
|
|
835
847
|
slideToItem(id2Index(focusId), false);
|
|
848
|
+
//template和slideDivStyle均确定后再次重设box condition
|
|
849
|
+
updateTouchBoxCondition();
|
|
836
850
|
};
|
|
837
851
|
|
|
838
852
|
const getVisibleItems = () => {
|
|
@@ -849,6 +863,8 @@ export const setup = (
|
|
|
849
863
|
};
|
|
850
864
|
|
|
851
865
|
const moveFocus = (direction) => {
|
|
866
|
+
//有外部触发的滚动时, 取消load
|
|
867
|
+
tryCancelDelayLoad();
|
|
852
868
|
if (direction == "left" || direction == 37 || direction == EdgeDirection.left) {
|
|
853
869
|
_moveToNext(-1, 0);
|
|
854
870
|
} else if (direction == "right" || direction == 39 || direction == EdgeDirection.right) {
|
|
@@ -886,27 +902,36 @@ export const setup = (
|
|
|
886
902
|
slideLock = false;
|
|
887
903
|
}
|
|
888
904
|
|
|
905
|
+
const setSlideSetting = (setting) => {
|
|
906
|
+
if (!setting) {
|
|
907
|
+
innerSlideSetting = props.slideSetting;
|
|
908
|
+
} else {
|
|
909
|
+
innerSlideSetting = setting;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
|
|
889
913
|
const exportObject = {
|
|
890
914
|
lockSlide,
|
|
891
915
|
unlockSlide,
|
|
892
916
|
lock,
|
|
893
917
|
unlock,
|
|
918
|
+
refreshData,
|
|
919
|
+
moveFocus,
|
|
894
920
|
slideTo,
|
|
921
|
+
slideToItem,
|
|
922
|
+
slideToDiv,
|
|
895
923
|
setFocusId,
|
|
896
924
|
setFocusByUid,
|
|
897
|
-
getFocusBlockRef,
|
|
898
925
|
setEnterFocusId,
|
|
899
926
|
setEnterFocusRect,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
refreshData,
|
|
927
|
+
setZIndex,
|
|
928
|
+
getFocusBlockRef,
|
|
903
929
|
getVisibleItems,
|
|
904
|
-
moveFocus,
|
|
905
930
|
getCustomerDataSize,
|
|
906
|
-
setZIndex,
|
|
907
931
|
getCurrentFocusIndex,
|
|
908
932
|
getCurMode,
|
|
909
933
|
getTemplatePosition,
|
|
934
|
+
setSlideSetting
|
|
910
935
|
};
|
|
911
936
|
|
|
912
937
|
const _calculateNearestItemByRect = (visibleSet, enter_rect_info) => {
|
|
@@ -1108,6 +1133,7 @@ export const setup = (
|
|
|
1108
1133
|
if (onKeyDownLock) {
|
|
1109
1134
|
return true;
|
|
1110
1135
|
}
|
|
1136
|
+
tryCancelDelayLoad();
|
|
1111
1137
|
if (mode.getMode() == TOUCH_MODE) {
|
|
1112
1138
|
if (mode.duringTouch()) {
|
|
1113
1139
|
//touch过程中的按键不处理
|
|
@@ -1159,6 +1185,8 @@ export const setup = (
|
|
|
1159
1185
|
metroTemplate.getTailItemIndex()
|
|
1160
1186
|
)?.templateInfo;
|
|
1161
1187
|
if (lastTemplateInfo) {
|
|
1188
|
+
let preTouchW = touchDivSize.width;
|
|
1189
|
+
let preTouchH = touchDivSize.height;
|
|
1162
1190
|
if (vertical) {
|
|
1163
1191
|
touchDivSize.width = props.width;
|
|
1164
1192
|
touchDivSize.height = lastTemplateInfo.top + lastTemplateInfo.height - 1;
|
|
@@ -1166,7 +1194,9 @@ export const setup = (
|
|
|
1166
1194
|
touchDivSize.width = lastTemplateInfo.left + lastTemplateInfo.width - 1;
|
|
1167
1195
|
touchDivSize.height = props.height;
|
|
1168
1196
|
}
|
|
1169
|
-
|
|
1197
|
+
if (preTouchW !== touchDivSize.width || preTouchH !== touchDivSize.height) {
|
|
1198
|
+
updateTouchBoxCondition();
|
|
1199
|
+
}
|
|
1170
1200
|
}
|
|
1171
1201
|
}
|
|
1172
1202
|
|
|
@@ -1300,8 +1330,8 @@ export const setup = (
|
|
|
1300
1330
|
{
|
|
1301
1331
|
easing: "",
|
|
1302
1332
|
onStart: null,
|
|
1303
|
-
speed:
|
|
1304
|
-
duration:
|
|
1333
|
+
speed: innerSlideSetting.Speed,
|
|
1334
|
+
duration: innerSlideSetting.Duration,
|
|
1305
1335
|
},
|
|
1306
1336
|
{
|
|
1307
1337
|
mergeTmp: true
|
|
@@ -1401,28 +1431,33 @@ export const setup = (
|
|
|
1401
1431
|
onItemBlur(preFocusItem);
|
|
1402
1432
|
onItemFocus(next_focus_item, preEdgeRect);
|
|
1403
1433
|
|
|
1404
|
-
|
|
1405
|
-
if (
|
|
1406
|
-
|
|
1434
|
+
|
|
1435
|
+
if (next_focus_item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
|
|
1436
|
+
let cur_visible_start = _calculateVisibleStart(
|
|
1437
|
+
next_focus_item.templateInfo,
|
|
1438
|
+
vertical ? vertical_direction : horizontal_direction,
|
|
1439
|
+
preFocusItem.templateInfo,
|
|
1440
|
+
);
|
|
1441
|
+
if (visibleInfo.start !== cur_visible_start) {
|
|
1407
1442
|
let animObj = {
|
|
1408
1443
|
easing: "",
|
|
1409
1444
|
onStart: null,
|
|
1410
|
-
speed:
|
|
1411
|
-
duration:
|
|
1445
|
+
speed: innerSlideSetting.Speed,
|
|
1446
|
+
duration: innerSlideSetting.Duration,
|
|
1412
1447
|
};
|
|
1413
1448
|
_slideTo(cur_visible_start, animObj, { mergeTmp: false });
|
|
1414
|
-
} else {
|
|
1415
|
-
const updater = pageUpdater.update(
|
|
1416
|
-
metroTemplate,
|
|
1417
|
-
cur_visible_start,
|
|
1418
|
-
cur_visible_start + visibleInfo.range + visibleInfo.padding.end - 1,
|
|
1419
|
-
next_focus_item.id,
|
|
1420
|
-
false,
|
|
1421
|
-
permanentItemList
|
|
1422
|
-
);
|
|
1423
|
-
//不做滚动时,保证获焦的item创建. 为了避免提前隐藏, 使用applyTmp
|
|
1424
|
-
updater.applyTmp();
|
|
1425
1449
|
}
|
|
1450
|
+
} else {
|
|
1451
|
+
const updater = pageUpdater.update(
|
|
1452
|
+
metroTemplate,
|
|
1453
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
1454
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
1455
|
+
next_focus_item.id,
|
|
1456
|
+
false,
|
|
1457
|
+
permanentItemList
|
|
1458
|
+
);
|
|
1459
|
+
//不做滚动时,保证获焦的item创建. 为了避免提前隐藏, 使用applyTmp
|
|
1460
|
+
updater.applyTmp();
|
|
1426
1461
|
}
|
|
1427
1462
|
} else {
|
|
1428
1463
|
//到达边缘
|
|
@@ -1473,48 +1508,58 @@ export const setup = (
|
|
|
1473
1508
|
const normalizeVisibleStart = (origin, targetItem = null) => {
|
|
1474
1509
|
let pos_key = vertical ? "top" : "left";
|
|
1475
1510
|
let size_key = vertical ? "height" : "width";
|
|
1476
|
-
let
|
|
1477
|
-
if ((
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1511
|
+
let visibleStart = origin;
|
|
1512
|
+
if ((innerSlideSetting.BoundaryProtect & SlideSetting.START_PROTECT) > 0) {
|
|
1513
|
+
if (visibleInfo.start >= 0) {
|
|
1514
|
+
let boundary = 0;
|
|
1515
|
+
//首个元素是占位符时, 在保证获焦区域完全展示的前提下要保证首个不可获焦元素的完全展示
|
|
1516
|
+
const headTemplateInfo = getItemByIndex(0).templateInfo;
|
|
1517
|
+
if (
|
|
1518
|
+
targetItem
|
|
1519
|
+
&& (!headTemplateInfo.focusable || targetItem.index == headTemplateInfo.index)
|
|
1520
|
+
&& targetItem[pos_key] + targetItem[size_key] <=
|
|
1521
|
+
visibleInfo.range
|
|
1522
|
+
) {
|
|
1523
|
+
boundary = headTemplateInfo[size_key];
|
|
1524
|
+
}
|
|
1525
|
+
visibleStart = visibleStart < boundary ? 0 : visibleStart;
|
|
1526
|
+
} else {
|
|
1527
|
+
// 以最后一个item的位置作为动态的保护边界
|
|
1528
|
+
visibleStart = visibleStart < visibleInfo.start ? visibleInfo.start : visibleStart;
|
|
1488
1529
|
}
|
|
1489
|
-
visible_start = visible_start < boundary ? 0 : visible_start;
|
|
1490
1530
|
}
|
|
1491
|
-
if ((
|
|
1531
|
+
if ((innerSlideSetting.BoundaryProtect & SlideSetting.END_PROTECT) > 0) {
|
|
1492
1532
|
let lastTemplateInfo = getItemByIndex(metroTemplate.getTailItemIndex()).templateInfo;
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1533
|
+
const lastEnd = lastTemplateInfo[pos_key] + lastTemplateInfo[size_key];
|
|
1534
|
+
const lastVisibleStart = Math.max(lastEnd - visibleInfo.range, 0);
|
|
1535
|
+
//边界必须大于等于0, 同时若最后一个缩进时, 边界采用最后一个item的位置
|
|
1536
|
+
if (visibleInfo.end <= lastEnd) {
|
|
1537
|
+
let boundary = lastVisibleStart;
|
|
1538
|
+
if (
|
|
1539
|
+
targetItem
|
|
1540
|
+
&& (!lastTemplateInfo.focusable || targetItem.index == lastTemplateInfo.index)
|
|
1541
|
+
&& targetItem[pos_key] - lastVisibleStart >= 0
|
|
1542
|
+
) {
|
|
1543
|
+
boundary = lastTemplateInfo[pos_key] - visibleInfo.range;
|
|
1544
|
+
}
|
|
1545
|
+
visibleStart = visibleStart > boundary ? lastVisibleStart : visibleStart;
|
|
1546
|
+
} else {
|
|
1547
|
+
// 以最后一个item的位置作为动态的保护边界
|
|
1548
|
+
visibleStart = visibleStart > visibleInfo.start ? visibleInfo.start : visibleStart;
|
|
1506
1549
|
}
|
|
1507
|
-
visible_start =
|
|
1508
|
-
visible_start > boundary ? last_visible_start : visible_start;
|
|
1509
1550
|
}
|
|
1510
|
-
return
|
|
1551
|
+
return visibleStart;
|
|
1511
1552
|
}
|
|
1512
1553
|
|
|
1513
|
-
|
|
1554
|
+
let preTemplateInfo = null;
|
|
1555
|
+
const _calculateVisibleStart = (targetTemplateInfo, direction, preInfo = null) => {
|
|
1514
1556
|
if (!targetTemplateInfo) {
|
|
1515
1557
|
console.error("MetroWidget: _calculateVisibleStart target item is null");
|
|
1516
1558
|
return 0;
|
|
1517
1559
|
}
|
|
1560
|
+
if (preInfo) {
|
|
1561
|
+
preTemplateInfo = preInfo;
|
|
1562
|
+
}
|
|
1518
1563
|
|
|
1519
1564
|
preSlideDirection = direction;
|
|
1520
1565
|
preAnchorItemIndex = targetTemplateInfo.index;
|
|
@@ -1524,12 +1569,14 @@ export const setup = (
|
|
|
1524
1569
|
let new_visible_start = visibleInfo.start;
|
|
1525
1570
|
|
|
1526
1571
|
let needCalculate = true;
|
|
1527
|
-
|
|
1572
|
+
|
|
1573
|
+
switch (innerSlideSetting.Type) {
|
|
1528
1574
|
case SlideSetting.Type.FIX_POSITION:
|
|
1575
|
+
//TODO 当item的size和widget的size相同时, 滚动速度会出现未预期的变化
|
|
1529
1576
|
//FIX_POSITION 模式会将当前 item 的中心固定到指定位置
|
|
1530
1577
|
|
|
1531
1578
|
//首页不滚动
|
|
1532
|
-
if (
|
|
1579
|
+
if (innerSlideSetting.FixFirstPage) {
|
|
1533
1580
|
if (targetTemplateInfo[pos_key] + targetTemplateInfo[size_key] - 1 < visibleInfo.range) {
|
|
1534
1581
|
new_visible_start = 0;
|
|
1535
1582
|
needCalculate = false;
|
|
@@ -1539,7 +1586,7 @@ export const setup = (
|
|
|
1539
1586
|
if (needCalculate) {
|
|
1540
1587
|
new_visible_start = Math.ceil(
|
|
1541
1588
|
targetTemplateInfo[center_key] -
|
|
1542
|
-
visibleInfo.range *
|
|
1589
|
+
visibleInfo.range * innerSlideSetting.FixPercent
|
|
1543
1590
|
);
|
|
1544
1591
|
}
|
|
1545
1592
|
break;
|
|
@@ -1557,68 +1604,93 @@ export const setup = (
|
|
|
1557
1604
|
break;
|
|
1558
1605
|
case SlideSetting.Type.SEAMLESS:
|
|
1559
1606
|
//首页不滚动
|
|
1560
|
-
if (
|
|
1607
|
+
if (innerSlideSetting.FixFirstPage) {
|
|
1561
1608
|
if (targetTemplateInfo[pos_key] + targetTemplateInfo[size_key] - 1 < visibleInfo.range) {
|
|
1562
1609
|
new_visible_start = 0;
|
|
1563
1610
|
needCalculate = false;
|
|
1564
1611
|
}
|
|
1565
1612
|
}
|
|
1613
|
+
|
|
1566
1614
|
if (needCalculate) {
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1615
|
+
/**
|
|
1616
|
+
* seamless滚动规则:
|
|
1617
|
+
* 0-start: 焦点往右时不处理, 往左的时候更新position以保持焦点的start位置一致
|
|
1618
|
+
* end-1.0: 焦点往左时不处理, 往右的时候更新position以保持焦点的end位置一致
|
|
1619
|
+
* 重合区域: 保持焦点的中心位置一致
|
|
1620
|
+
*/
|
|
1621
|
+
const rect0Start = visibleInfo.start;
|
|
1622
|
+
const rect0End = visibleInfo.start + visibleInfo.range * innerSlideSetting.StartPercent;
|
|
1623
|
+
const rect1Start = visibleInfo.start + visibleInfo.range * innerSlideSetting.EndPercent;
|
|
1624
|
+
const rect1End = visibleInfo.end;
|
|
1625
|
+
|
|
1626
|
+
const itemStart = targetTemplateInfo[pos_key];
|
|
1627
|
+
const itemEnd = targetTemplateInfo[pos_key] + targetTemplateInfo[size_key] - 1;
|
|
1628
|
+
|
|
1629
|
+
let targetStart;
|
|
1630
|
+
let targetEnd;
|
|
1631
|
+
if (preTemplateInfo != null) {
|
|
1632
|
+
targetStart = preTemplateInfo[pos_key];
|
|
1633
|
+
targetEnd = preTemplateInfo[pos_key] + preTemplateInfo[size_key] - 1;
|
|
1575
1634
|
} else {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
visibleInfo.range * props.slideSetting.StartPercent;
|
|
1635
|
+
targetStart = rect0End;
|
|
1636
|
+
targetEnd = rect1Start;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
let rect0Result = undefined;
|
|
1640
|
+
let rect1Result = undefined;
|
|
1641
|
+
if (itemStart < rect0End) {
|
|
1642
|
+
if (targetStart < rect0Start) {
|
|
1643
|
+
rect0Result = itemStart;
|
|
1644
|
+
} else {
|
|
1645
|
+
//inRect0, 只处理往左/往上
|
|
1646
|
+
if (direction <= 0) {
|
|
1647
|
+
let pre;
|
|
1648
|
+
if (targetStart < rect0End) {
|
|
1649
|
+
pre = targetStart;
|
|
1650
|
+
} else {
|
|
1651
|
+
pre = rect0End;
|
|
1652
|
+
}
|
|
1653
|
+
rect0Result = visibleInfo.start + (itemStart - pre);
|
|
1596
1654
|
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
if (itemEnd > rect1Start) {
|
|
1658
|
+
if (targetEnd > rect1End) {
|
|
1659
|
+
rect1Result = itemEnd - visibleInfo.range;
|
|
1597
1660
|
} else {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
new_visible_start =
|
|
1608
|
-
targetTemplateInfo[pos_key] +
|
|
1609
|
-
targetTemplateInfo[size_key] -
|
|
1610
|
-
visibleInfo.range * props.slideSetting.EndPercent;
|
|
1661
|
+
//inRect1, 只处理往右/往下
|
|
1662
|
+
let pre;
|
|
1663
|
+
if (targetEnd > rect1Start) {
|
|
1664
|
+
pre = targetEnd;
|
|
1665
|
+
} else {
|
|
1666
|
+
pre = rect1Start;
|
|
1667
|
+
}
|
|
1668
|
+
if (direction >= 0) {
|
|
1669
|
+
rect1Result = visibleInfo.start + (itemEnd - pre);
|
|
1611
1670
|
}
|
|
1612
1671
|
}
|
|
1672
|
+
} else {
|
|
1673
|
+
//不移动
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
if (typeof rect0Result !== "undefined" && typeof rect1Result !== "undefined") {
|
|
1677
|
+
//重叠区域
|
|
1678
|
+
new_visible_start = rect0Result;
|
|
1679
|
+
} else if (typeof rect0Result !== "undefined") {
|
|
1680
|
+
new_visible_start = rect0Result;
|
|
1681
|
+
} else if (typeof rect1Result !== "undefined") {
|
|
1682
|
+
new_visible_start = rect1Result;
|
|
1613
1683
|
}
|
|
1614
1684
|
}
|
|
1615
1685
|
break;
|
|
1616
1686
|
default:
|
|
1617
1687
|
console.error(
|
|
1618
1688
|
"MetroWidget: undefined slide type",
|
|
1619
|
-
|
|
1689
|
+
innerSlideSetting.Type
|
|
1620
1690
|
);
|
|
1621
1691
|
}
|
|
1692
|
+
|
|
1693
|
+
preTemplateInfo = targetTemplateInfo;
|
|
1622
1694
|
new_visible_start = normalizeVisibleStart(new_visible_start, targetTemplateInfo);
|
|
1623
1695
|
return Math.round(new_visible_start);
|
|
1624
1696
|
};
|
|
@@ -1731,6 +1803,7 @@ export const setup = (
|
|
|
1731
1803
|
const touchLoadItemRect = visibleInfo.range;
|
|
1732
1804
|
const reachAnchorGroup = 2;
|
|
1733
1805
|
const wallConditionGroup = 1;
|
|
1806
|
+
const touchCountGroup = 3;
|
|
1734
1807
|
|
|
1735
1808
|
let divPos = -1;
|
|
1736
1809
|
let frameCount = -1;
|
|
@@ -1745,7 +1818,20 @@ export const setup = (
|
|
|
1745
1818
|
}
|
|
1746
1819
|
}
|
|
1747
1820
|
|
|
1748
|
-
const
|
|
1821
|
+
const getTouchCount = (nexusCustomData) => {
|
|
1822
|
+
let touchCount = -1;
|
|
1823
|
+
if (nexusCustomData) {
|
|
1824
|
+
try {
|
|
1825
|
+
touchCount = JSON.parse(nexusCustomData).tc;
|
|
1826
|
+
} catch (e) {
|
|
1827
|
+
touchCount = -1;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
return touchCount;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
const mergeTouchSlideToSlideDiv = (touchCount) => {
|
|
1834
|
+
// console.log("testtest", props.name, `touchToDiv div: ${slideDivTop.value}, visibleStart:${visibleInfo.start} swapCount: ${Forge.sFrameCount.count}`)
|
|
1749
1835
|
if (vertical) {
|
|
1750
1836
|
slideDivTop.value = -visibleInfo.start;
|
|
1751
1837
|
} else {
|
|
@@ -1760,14 +1846,34 @@ export const setup = (
|
|
|
1760
1846
|
.boxPosition(walls.left, walls.top, walls.right, walls.bottom)
|
|
1761
1847
|
.then([actorController.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
|
|
1762
1848
|
actorController
|
|
1763
|
-
.
|
|
1764
|
-
.
|
|
1849
|
+
.condition(touchCountGroup, false)
|
|
1850
|
+
.touchCount(touchCount)
|
|
1851
|
+
.then([
|
|
1852
|
+
actorController
|
|
1853
|
+
.action()
|
|
1854
|
+
.teleportTo(0, 0)
|
|
1855
|
+
])
|
|
1856
|
+
]);
|
|
1857
|
+
//下一帧删除touchCount
|
|
1858
|
+
actorController.run([
|
|
1859
|
+
actorController.condition().onNextTick().then([
|
|
1860
|
+
actorController.state().removeConditionByGroup(touchCountGroup),
|
|
1861
|
+
])
|
|
1862
|
+
])
|
|
1765
1863
|
}
|
|
1766
1864
|
|
|
1767
|
-
const onTouchDown = (data) => {
|
|
1865
|
+
const onTouchDown = (data, customData, nexusCustomData) => {
|
|
1866
|
+
touchRecorder.reset();
|
|
1867
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
1868
|
+
touchRecorder.setTouchCount(touchCount);
|
|
1869
|
+
if (mode.getMode() == FOCUS_MODE) {
|
|
1870
|
+
//模式切换, 更新boxPosition
|
|
1871
|
+
updateTouchBoxCondition();
|
|
1872
|
+
}
|
|
1768
1873
|
mode.touchStart();
|
|
1769
1874
|
mode.flingEnd();
|
|
1770
|
-
|
|
1875
|
+
// console.log("touchtest", `${props.name} animId:${debugAnimId} viewId:${debugViewId}`,
|
|
1876
|
+
// "onTouchDown", data, customData, nexusCustomData)
|
|
1771
1877
|
const t = 100;
|
|
1772
1878
|
const offsetThreshold = {
|
|
1773
1879
|
left: vertical ? undefined : t,
|
|
@@ -1775,6 +1881,7 @@ export const setup = (
|
|
|
1775
1881
|
top: vertical ? t : undefined,
|
|
1776
1882
|
bottom: vertical ? t : undefined,
|
|
1777
1883
|
}
|
|
1884
|
+
|
|
1778
1885
|
actorController.run([
|
|
1779
1886
|
actorController
|
|
1780
1887
|
.condition(undefined, false)
|
|
@@ -1789,13 +1896,12 @@ export const setup = (
|
|
|
1789
1896
|
//blur item
|
|
1790
1897
|
onItemBlur(getItemById(focusId));
|
|
1791
1898
|
|
|
1792
|
-
// visibleInfo.start = getVisibleStart(data);
|
|
1793
1899
|
templateItemAdder.tryAddItemByPosition(visibleInfo.end + visibleInfo.range);
|
|
1794
1900
|
|
|
1795
1901
|
const updater = pageUpdater.update(
|
|
1796
1902
|
metroTemplate,
|
|
1797
|
-
visibleInfo.startWithPadding -
|
|
1798
|
-
visibleInfo.endWithPadding +
|
|
1903
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
1904
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
1799
1905
|
0,
|
|
1800
1906
|
false,
|
|
1801
1907
|
permanentItemList
|
|
@@ -1829,46 +1935,58 @@ export const setup = (
|
|
|
1829
1935
|
//只点击, 没有移动或者fling
|
|
1830
1936
|
updateRenderItems(false, false);
|
|
1831
1937
|
mode.touchEnd();
|
|
1938
|
+
} else {
|
|
1939
|
+
if (touchRecorder.moved && !mode.duringFling()) {
|
|
1940
|
+
mergeTouchSlideToSlideDiv(touchRecorder.touchCount);
|
|
1941
|
+
updateRenderItems(false, false);
|
|
1942
|
+
mode.touchEnd()
|
|
1943
|
+
}
|
|
1832
1944
|
}
|
|
1833
1945
|
}
|
|
1834
1946
|
|
|
1835
|
-
const
|
|
1947
|
+
const exportOnTouchRelease = props.touchFlag > 0 ? onTouchRelease : undefined;
|
|
1948
|
+
|
|
1949
|
+
const onDragStart = (data, customData, nexusCustomData) => {
|
|
1950
|
+
touchRecorder.move();
|
|
1836
1951
|
mode.dragStart()
|
|
1837
1952
|
visibleInfo.start = getVisibleStart(data);
|
|
1838
1953
|
}
|
|
1839
1954
|
|
|
1840
|
-
const onDragEnd = (data) => {
|
|
1955
|
+
const onDragEnd = (data, customData, nexusCustomData) => {
|
|
1841
1956
|
visibleInfo.start = getVisibleStart(data);
|
|
1842
1957
|
actorController.run([
|
|
1843
1958
|
actorController.state().removeConditionByGroup(reachAnchorGroup),
|
|
1844
1959
|
]);
|
|
1845
|
-
mergeTouchSlideToSlideDiv();
|
|
1846
|
-
updateRenderItems(false, false);
|
|
1847
|
-
mode.touchEnd()
|
|
1848
1960
|
}
|
|
1849
1961
|
|
|
1850
|
-
const onFlingStart = (data) => {
|
|
1962
|
+
const onFlingStart = (data, customData, nexusCustomData) => {
|
|
1963
|
+
touchRecorder.move();
|
|
1851
1964
|
mode.flingStart();
|
|
1852
1965
|
visibleInfo.start = getVisibleStart(data);
|
|
1853
1966
|
updateRenderItems(true, true);
|
|
1854
1967
|
}
|
|
1855
1968
|
|
|
1856
|
-
const onFlingProgress = (data) => {
|
|
1969
|
+
const onFlingProgress = (data, customData, nexusCustomData) => {
|
|
1857
1970
|
visibleInfo.start = getVisibleStart(data);
|
|
1858
1971
|
updateRenderItems(true, true);
|
|
1859
1972
|
}
|
|
1860
1973
|
|
|
1861
|
-
const onFlingEnd = (data) => {
|
|
1974
|
+
const onFlingEnd = (data, customData, nexusCustomData) => {
|
|
1862
1975
|
visibleInfo.start = getVisibleStart(data);
|
|
1863
1976
|
//记录拖拽的距离
|
|
1864
1977
|
if (mode.duringFling()) {
|
|
1865
|
-
|
|
1978
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
1979
|
+
mergeTouchSlideToSlideDiv(touchCount);
|
|
1866
1980
|
updateRenderItems(false, false);
|
|
1867
1981
|
mode.flingEnd();
|
|
1868
1982
|
mode.touchEnd();
|
|
1869
1983
|
}
|
|
1870
1984
|
}
|
|
1871
1985
|
|
|
1986
|
+
const onFlingDrop = (data, customData, nexusCustomData) => {
|
|
1987
|
+
visibleInfo.start = getVisibleStart(data);
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1872
1990
|
const getTouchWall = () => {
|
|
1873
1991
|
const boxSize = metroTemplate.getBoundingBoxSize();
|
|
1874
1992
|
let wall = {
|
|
@@ -1880,9 +1998,15 @@ export const setup = (
|
|
|
1880
1998
|
if (vertical) {
|
|
1881
1999
|
wall.top = -boxSize.height + props.height - slideDivTop.value;
|
|
1882
2000
|
wall.bottom = -slideDivTop.value;
|
|
2001
|
+
if (wall.top > wall.bottom) {
|
|
2002
|
+
wall.top = wall.bottom;
|
|
2003
|
+
}
|
|
1883
2004
|
} else {
|
|
1884
2005
|
wall.left = -boxSize.width + props.width - slideDivLeft.value;
|
|
1885
2006
|
wall.right = -slideDivLeft.value;
|
|
2007
|
+
if (wall.left > wall.right) {
|
|
2008
|
+
wall.left = wall.right;
|
|
2009
|
+
}
|
|
1886
2010
|
}
|
|
1887
2011
|
return wall;
|
|
1888
2012
|
}
|
|
@@ -1891,8 +2015,8 @@ export const setup = (
|
|
|
1891
2015
|
templateItemAdder.tryAddItemByPosition(visibleInfo.start + visibleInfo.range);
|
|
1892
2016
|
const updater = pageUpdater.update(
|
|
1893
2017
|
metroTemplate,
|
|
1894
|
-
|
|
1895
|
-
|
|
2018
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
2019
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
1896
2020
|
0,
|
|
1897
2021
|
true,
|
|
1898
2022
|
permanentItemList
|
|
@@ -1900,9 +2024,10 @@ export const setup = (
|
|
|
1900
2024
|
applyTmp ? updater.applyTmp() : updater.apply();
|
|
1901
2025
|
}
|
|
1902
2026
|
|
|
1903
|
-
const
|
|
2027
|
+
const updateTouchBoxCondition = () => {
|
|
1904
2028
|
if (actorController != null) {
|
|
1905
2029
|
const walls = getTouchWall();
|
|
2030
|
+
|
|
1906
2031
|
//更新wall设置
|
|
1907
2032
|
actorController.run([
|
|
1908
2033
|
actorController.state().removeConditionByGroup(wallConditionGroup),
|
|
@@ -1914,12 +2039,32 @@ export const setup = (
|
|
|
1914
2039
|
}
|
|
1915
2040
|
}
|
|
1916
2041
|
|
|
2042
|
+
const touchRecorder = {
|
|
2043
|
+
moved: false,
|
|
2044
|
+
touchCount: -1,
|
|
2045
|
+
reset: function () {
|
|
2046
|
+
this.moved = false;
|
|
2047
|
+
this.touchCount = -1;
|
|
2048
|
+
},
|
|
2049
|
+
move: function () {
|
|
2050
|
+
this.moved = true;
|
|
2051
|
+
},
|
|
2052
|
+
setTouchCount: function (count) {
|
|
2053
|
+
this.touchCount = count;
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
|
|
2057
|
+
//TODO debug
|
|
2058
|
+
// let debugAnimId = -1;
|
|
2059
|
+
// let debugViewId = -1
|
|
1917
2060
|
const initTouch = () => {
|
|
1918
2061
|
actorController = new ActorControl();
|
|
1919
2062
|
const divView = touchDiv.value.jsvGetProxyView();
|
|
1920
2063
|
actorController.bindForgeView(divView, true);
|
|
1921
2064
|
divView.DragEnables?.(4 | 0x08 | 0x10); // 只激活drag
|
|
1922
|
-
|
|
2065
|
+
// debugAnimId = actorController.debugGetAnimId();
|
|
2066
|
+
// debugViewId = divView.ViewId;
|
|
2067
|
+
// console.log("testtest", props.name, `animId:${debugAnimId} viewId:${debugViewId}`);
|
|
1923
2068
|
const walls = getTouchWall();
|
|
1924
2069
|
//注册回调
|
|
1925
2070
|
actorController.run([
|
|
@@ -1927,10 +2072,10 @@ export const setup = (
|
|
|
1927
2072
|
.condition(undefined, true)
|
|
1928
2073
|
.onTouchDown()
|
|
1929
2074
|
.then([onTouchDown]),
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2075
|
+
actorController
|
|
2076
|
+
.condition(undefined, true)
|
|
2077
|
+
.onDragStart()
|
|
2078
|
+
.then([onDragStart]),
|
|
1934
2079
|
actorController
|
|
1935
2080
|
.condition(undefined, true)
|
|
1936
2081
|
.onDragEnd()
|
|
@@ -1947,6 +2092,10 @@ export const setup = (
|
|
|
1947
2092
|
.condition(undefined, true)
|
|
1948
2093
|
.onFlingEnd()
|
|
1949
2094
|
.then([onFlingEnd]),
|
|
2095
|
+
actorController
|
|
2096
|
+
.condition(undefined, true)
|
|
2097
|
+
.onFlingDrop()
|
|
2098
|
+
.then([onFlingDrop]),
|
|
1950
2099
|
actorController
|
|
1951
2100
|
.condition(undefined, true)
|
|
1952
2101
|
.onTouchRelease()
|
|
@@ -1960,7 +2109,7 @@ export const setup = (
|
|
|
1960
2109
|
}
|
|
1961
2110
|
|
|
1962
2111
|
//init
|
|
1963
|
-
pageUpdater = new PageUpdater(_updatePage);
|
|
2112
|
+
pageUpdater = new PageUpdater(_updatePage, props.name);
|
|
1964
2113
|
visibleInfo.range = vertical
|
|
1965
2114
|
? widgetRectInfo.contentHeight
|
|
1966
2115
|
: widgetRectInfo.contentWidth;
|
|
@@ -1998,13 +2147,14 @@ export const setup = (
|
|
|
1998
2147
|
if (item) {
|
|
1999
2148
|
init_focus_id = props.initFocusId;
|
|
2000
2149
|
if (item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
|
|
2001
|
-
cur_visible_start = _calculateVisibleStart(item.templateInfo,
|
|
2150
|
+
cur_visible_start = _calculateVisibleStart(item.templateInfo, 0);
|
|
2002
2151
|
}
|
|
2003
2152
|
}
|
|
2004
2153
|
}
|
|
2005
2154
|
focusId = init_focus_id;
|
|
2006
2155
|
visibleInfo.start = cur_visible_start;
|
|
2007
2156
|
|
|
2157
|
+
//保证创建速度, 你描画一屏
|
|
2008
2158
|
const initUpdater = pageUpdater.update(
|
|
2009
2159
|
metroTemplate,
|
|
2010
2160
|
visibleInfo.startWithPadding,
|
|
@@ -2014,6 +2164,21 @@ export const setup = (
|
|
|
2014
2164
|
permanentItemList
|
|
2015
2165
|
);
|
|
2016
2166
|
initUpdater.apply();
|
|
2167
|
+
//延时加载剩余屏
|
|
2168
|
+
const delayLoadHandler = setTimeout(() => {
|
|
2169
|
+
const updateHandler = pageUpdater.update(
|
|
2170
|
+
metroTemplate,
|
|
2171
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
2172
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
2173
|
+
focusId,
|
|
2174
|
+
false,
|
|
2175
|
+
permanentItemList
|
|
2176
|
+
);
|
|
2177
|
+
updateHandler.apply();
|
|
2178
|
+
}, 200);
|
|
2179
|
+
const tryCancelDelayLoad = () => {
|
|
2180
|
+
clearTimeout(delayLoadHandler);
|
|
2181
|
+
}
|
|
2017
2182
|
|
|
2018
2183
|
onMounted(() => {
|
|
2019
2184
|
_changeFocusId(focusId, false);
|
|
@@ -2038,6 +2203,7 @@ export const setup = (
|
|
|
2038
2203
|
onUpdated(() => { });
|
|
2039
2204
|
|
|
2040
2205
|
onBeforeUnmount(() => {
|
|
2206
|
+
tryCancelDelayLoad();
|
|
2041
2207
|
mounted = false;
|
|
2042
2208
|
});
|
|
2043
2209
|
|
|
@@ -2051,7 +2217,7 @@ export const setup = (
|
|
|
2051
2217
|
exportObject,
|
|
2052
2218
|
setZIndex,
|
|
2053
2219
|
onTouchDown,
|
|
2054
|
-
onTouchRelease,
|
|
2220
|
+
onTouchRelease: exportOnTouchRelease,
|
|
2055
2221
|
currentFocusIndex,
|
|
2056
2222
|
modeForExport,
|
|
2057
2223
|
}
|