@shijiu/jsview-vue 2.1.482-test.0 → 2.2.128
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 -1
- package/bin/browser/BrowserApic2.vue.mjs +2 -1
- package/bin/browser/BrowserApicLib.mjs +2 -1
- package/bin/browser/BrowserQrcode.vue.mjs +3 -1
- package/bin/browser/BrowserTextureAnim.vue.mjs +15 -7
- package/bin/jsview-vue.mjs +1734 -916
- 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/Slide.d.ts +21 -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 +91 -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 +143 -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/ConstSymbol.d.ts +2 -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/ForgeConstDefine.d.ts +11 -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 +279 -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/CapturedTexture/CapturedTexture.d.ts +11 -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 +23 -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/ActionRefObject.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +65 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorState.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +15 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +78 -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/SetAction.d.ts +71 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +95 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +62 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +12 -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 +69 -0
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +19 -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/JsvScrollBox/JsvScrollBox.vue.d.ts +176 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +7 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +1 -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 +38 -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 +7 -4
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +28 -6
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +568 -369
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +4 -3
- package/utils/JsViewEngineWidget/MetroWidget/Slide.ts +56 -0
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +51 -10
- package/utils/JsViewEngineWidget/MetroWidget/TokenGenerator.ts +10 -0
- package/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.ts +1 -1
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +21 -21
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +13 -7
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +35 -45
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +6 -6
- package/utils/JsViewEngineWidget/WidgetCommon.ts +34 -5
- package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +13 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +470 -338
- package/utils/JsViewVueTools/ConstSymbol.ts +3 -0
- package/utils/JsViewVueTools/ForgeConstDefine.ts +11 -0
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +166 -48
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +62 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +41 -7
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +15 -1
- package/utils/JsViewVueTools/index.js +2 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue +6 -6
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +5 -6
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.js +5 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +23 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.ts +4 -4
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +6 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +43 -9
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +24 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +58 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +56 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +3 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +6 -1
- package/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue +1 -1
- package/utils/JsViewVueWidget/JsvMindMap/rtree.js +1 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +121 -68
- package/utils/JsViewVueWidget/JsvNinePatch.vue +4 -1
- package/utils/JsViewVueWidget/JsvPosterImage.vue +22 -9
- package/utils/JsViewVueWidget/JsvQrcode/BrowserQrcode.vue +6 -2
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +309 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.ts +15 -0
- package/utils/JsViewVueWidget/JsvScrollBox/index.js +2 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +24 -4
- package/utils/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue +27 -9
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -0
- package/utils/JsViewVueWidget/index.js +1 -0
- 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
|
@@ -27,7 +27,9 @@ import { RenderItem } from "./RenderItem";
|
|
|
27
27
|
import { VisibleInfo } from "./VisibleInfo";
|
|
28
28
|
import { WidgetRectInfo } from "./WidgetRectInfo";
|
|
29
29
|
import ActorControl from "../../JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts";
|
|
30
|
-
import { TaskType, SlideAnimWrapper, TaskManager, AnimationManager } from "./TaskManager.ts";
|
|
30
|
+
import { TaskType, SlideAnimWrapper, TaskManager, AnimationManager, SlideTaskType } from "./TaskManager.ts";
|
|
31
|
+
import { getDirectionByRect, RectCache } from "./Slide.ts";
|
|
32
|
+
import { ForgeConst } from "../../JsViewVueTools/ForgeConstDefine.ts";
|
|
31
33
|
|
|
32
34
|
const TAG = "MetroWidget";
|
|
33
35
|
|
|
@@ -108,6 +110,19 @@ export const setup = (
|
|
|
108
110
|
FLING: 3,
|
|
109
111
|
};
|
|
110
112
|
|
|
113
|
+
let innerKeepTraceRange = 0;
|
|
114
|
+
if (typeof props.keepTraceRange == "number" && props.keepTraceRange > 0) {
|
|
115
|
+
innerKeepTraceRange = props.keepTraceRange;
|
|
116
|
+
} else {
|
|
117
|
+
if (props.touchFlag > 0) {
|
|
118
|
+
//触控默认3屏
|
|
119
|
+
innerKeepTraceRange = 3;
|
|
120
|
+
} else {
|
|
121
|
+
//按键模式默认0屏
|
|
122
|
+
innerKeepTraceRange = 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
111
126
|
const modeForExport = ref(FOCUS_MODE);
|
|
112
127
|
const mode = {
|
|
113
128
|
_mode: FOCUS_MODE,
|
|
@@ -160,7 +175,6 @@ export const setup = (
|
|
|
160
175
|
let preEdgeRect = null;
|
|
161
176
|
let isFocus = false;
|
|
162
177
|
let vertical = props.direction == VERTICAL;
|
|
163
|
-
let preAnchorItemIndex = -1;
|
|
164
178
|
let templateItemAdder = null;
|
|
165
179
|
let permanentItemList = [];
|
|
166
180
|
let mounted = false;
|
|
@@ -169,8 +183,8 @@ export const setup = (
|
|
|
169
183
|
let childSlideEventLock = false;
|
|
170
184
|
let onKeyDownLock = false;
|
|
171
185
|
let visibleInfo = new VisibleInfo();
|
|
172
|
-
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;
|
|
@@ -182,125 +196,181 @@ export const setup = (
|
|
|
182
196
|
&& item.templateInfo[pos_key] + item.templateInfo[size_key] - 1 < visibleInfo.end;
|
|
183
197
|
}
|
|
184
198
|
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
199
|
+
//tools
|
|
200
|
+
const lastOfArray = (array) => {
|
|
201
|
+
if (array instanceof Array && array.length > 0) {
|
|
202
|
+
return array[array.length - 1]
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const onAddTask = (allTask) => {
|
|
188
208
|
let resizeTaskMap = {};
|
|
189
|
-
let slideTask = null;
|
|
190
209
|
//统一处理itemResize和slide动画
|
|
191
210
|
let minIndex = Infinity;
|
|
192
|
-
let slideInfo = null;
|
|
193
211
|
let mergeTmp = false;
|
|
194
212
|
let anchorInfo = null;
|
|
195
|
-
let duration = 200;
|
|
196
|
-
let easing = null;
|
|
197
213
|
|
|
198
214
|
let pos_key = vertical ? "top" : "left";
|
|
199
215
|
let size_key = vertical ? "height" : "width";
|
|
200
|
-
let doAnim = false;
|
|
201
216
|
|
|
202
|
-
let existOnFocusChange = false;
|
|
203
217
|
let targetVisibleStart = visibleInfo.start;
|
|
218
|
+
let slideDoAnim = false;
|
|
204
219
|
|
|
205
|
-
|
|
206
|
-
taskList.forEach(i => {
|
|
207
|
-
if (i.type == TaskType.SLIDE) {
|
|
208
|
-
slideTask = i;
|
|
209
|
-
mergeTmp = mergeTmp || i.params?.updateParam?.mergeTmp;
|
|
210
|
-
if (!isNaN(i.params?.target)) {
|
|
211
|
-
targetVisibleStart = -i.params.target;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
220
|
+
mRectCache.cacheManually();
|
|
215
221
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
222
|
+
/**
|
|
223
|
+
* 处理resize
|
|
224
|
+
*/
|
|
225
|
+
let resizeAnimInfo = {
|
|
226
|
+
doAnim: false,
|
|
227
|
+
duration: 200,
|
|
228
|
+
easing: "",
|
|
229
|
+
}
|
|
230
|
+
let resizeList = allTask.resize.concat();
|
|
231
|
+
if (resizeList.length > 0) {
|
|
232
|
+
//resize
|
|
233
|
+
resizeList.forEach(task => {
|
|
219
234
|
resizeTaskMap[task.params.index] = task;
|
|
220
|
-
resizeList.push(task);
|
|
221
235
|
const { index, animInfo } = task.params;
|
|
222
|
-
|
|
236
|
+
if (animInfo) {
|
|
237
|
+
resizeAnimInfo.doAnim = true;
|
|
238
|
+
resizeAnimInfo.duration = animInfo.duration ?? resizeAnimInfo.duration;
|
|
239
|
+
resizeAnimInfo.easing = animInfo.duration ?? "";
|
|
240
|
+
}
|
|
223
241
|
minIndex = Math.min(minIndex, index);
|
|
224
242
|
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
metroTemplate.updateItemSize(task.params.index, {
|
|
244
|
+
width: task.params.width,
|
|
245
|
+
height: task.params.height,
|
|
246
|
+
})
|
|
247
|
+
});
|
|
227
248
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
249
|
+
//使用上一帧的状态计算anchorPosition
|
|
250
|
+
if (resizeTaskMap[id2Index(focusId)]) {
|
|
251
|
+
const task = resizeTaskMap[id2Index(focusId)];
|
|
252
|
+
const animInfo = task.params.animInfo;
|
|
253
|
+
if (typeof animInfo?.anchor == "number") {
|
|
254
|
+
const preRect = getItemById(focusId)?.templateInfo?.layoutCache.getPreRect();
|
|
255
|
+
if (preRect) {
|
|
256
|
+
anchorInfo = {
|
|
257
|
+
anchorPosition: preRect[pos_key] + preRect[size_key] * animInfo.anchor - 1 - visibleInfo.start,
|
|
258
|
+
anchor: animInfo.anchor,
|
|
259
|
+
}
|
|
234
260
|
}
|
|
235
261
|
}
|
|
236
|
-
} else if (task.type == TaskType.ON_FOCUS_CHANGE) {
|
|
237
|
-
existOnFocusChange = true;
|
|
238
262
|
}
|
|
239
263
|
}
|
|
240
264
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
265
|
+
/**
|
|
266
|
+
* 获取slide的targetRect
|
|
267
|
+
* 多个slide task取最后一个
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
/* 两种改变方式: 直接指定Position; 通过targetRect计算 */
|
|
271
|
+
let targetRect = null;
|
|
272
|
+
let direction = undefined;
|
|
273
|
+
|
|
274
|
+
let validSlideTask = false;
|
|
275
|
+
if (allTask.slide.length > 0) {
|
|
276
|
+
validSlideTask = true;
|
|
277
|
+
//有滚动时, 取消延时加载
|
|
278
|
+
tryCancelDelayLoad();
|
|
279
|
+
let slideTask = lastOfArray(allTask.slide);
|
|
280
|
+
slideDoAnim = slideTask.params.doAnim;
|
|
281
|
+
switch (slideTask.subType) {
|
|
282
|
+
case SlideTaskType.SLIDE_BY_DIV: {
|
|
283
|
+
const div = slideTask.params.div;
|
|
284
|
+
const item_layout = div.jsvGetRelativePosition(toRaw(locateDiv.value));
|
|
285
|
+
let fakeItem = {
|
|
286
|
+
templateInfo: {
|
|
287
|
+
left: item_layout.left,
|
|
288
|
+
top: item_layout.top,
|
|
289
|
+
width: item_layout.width,
|
|
290
|
+
height: item_layout.height,
|
|
291
|
+
centerYPos: Math.floor(item_layout.top + item_layout.height / 2),
|
|
292
|
+
centerXPos: Math.floor(item_layout.left + item_layout.width / 2),
|
|
293
|
+
index: id2Index(focusId),
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
templateItemAdder.tryAddItemByPosition(vertical ? fakeItem.templateInfo.top : fakeItem.templateInfo.left);
|
|
297
|
+
targetRect = fakeItem.templateInfo;
|
|
298
|
+
} break;
|
|
299
|
+
case SlideTaskType.SLIDE_BY_POS: {
|
|
300
|
+
const position = slideTask.params.position;
|
|
301
|
+
templateItemAdder.tryAddItemByPosition(position);
|
|
302
|
+
targetVisibleStart = position;
|
|
303
|
+
} break;
|
|
304
|
+
case SlideTaskType.SLIDE_BY_ITEM: {
|
|
305
|
+
const index = slideTask.params.index;
|
|
306
|
+
templateItemAdder.tryAddItemByIndex(index);
|
|
307
|
+
const targetItem = getItemByIndex(index);
|
|
308
|
+
if (targetItem) {
|
|
309
|
+
if (typeof slideTask.params.direction != "undefined") {
|
|
310
|
+
direction = slideTask.params.direction;
|
|
311
|
+
}
|
|
312
|
+
targetRect = targetItem.templateInfo;
|
|
313
|
+
} else {
|
|
314
|
+
//无效的滚动
|
|
315
|
+
validSlideTask = false;
|
|
316
|
+
}
|
|
317
|
+
} break;
|
|
318
|
+
case SlideTaskType.SLIDE_BY_RECT: {
|
|
319
|
+
if (typeof slideTask.params.direction != "undefined") {
|
|
320
|
+
direction = slideTask.params.direction;
|
|
321
|
+
}
|
|
322
|
+
targetRect = slideTask.params.rect;
|
|
323
|
+
} break;
|
|
324
|
+
default:
|
|
325
|
+
break;
|
|
245
326
|
}
|
|
246
|
-
}
|
|
247
327
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (templateCacheFrameCount != Forge.sFrameCount.count) {
|
|
253
|
-
metroTemplate.cacheLayout(minIndex, minIndex + 20);
|
|
254
|
-
templateCacheFrameCount = Forge.sFrameCount.count;
|
|
255
|
-
}
|
|
256
|
-
//resize
|
|
257
|
-
resizeList.forEach(task => {
|
|
258
|
-
metroTemplate.updateItemSize(task.params.index, {
|
|
259
|
-
width: task.params.width,
|
|
260
|
-
height: task.params.height,
|
|
261
|
-
})
|
|
262
|
-
});
|
|
263
|
-
//保持anchor
|
|
328
|
+
mergeTmp = mergeTmp || slideTask.params?.updateParam?.mergeTmp;
|
|
329
|
+
}
|
|
330
|
+
if (!validSlideTask && resizeList.length > 0) {
|
|
331
|
+
//没有slide任务时, 采用resize的slide位置计算
|
|
264
332
|
if (anchorInfo) {
|
|
333
|
+
//保持anchor
|
|
265
334
|
const focusItem = getItemById(focusId);
|
|
266
335
|
const start = focusItem.templateInfo[pos_key] + focusItem.templateInfo[size_key] * anchorInfo.anchor - 1 - anchorInfo.anchorPosition;
|
|
267
|
-
targetVisibleStart = normalizeVisibleStart(start, focusItem.templateInfo);
|
|
336
|
+
targetVisibleStart = normalizeVisibleStart(start, focusItem.templateInfo, focusItem.templateInfo.index);
|
|
268
337
|
} else {
|
|
269
|
-
|
|
338
|
+
targetRect = getItemById(focusId).templateInfo;
|
|
270
339
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
340
|
+
slideDoAnim = resizeAnimInfo.doAnim;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (targetRect) {
|
|
344
|
+
const v = visibleInfo.copy();
|
|
345
|
+
let preInfo = null;
|
|
346
|
+
if (resizeList.length > 0) {
|
|
347
|
+
//存在resize时, 需要调整targetRect
|
|
348
|
+
preInfo = mRectCache.getPreRect();
|
|
349
|
+
if (preInfo) {
|
|
350
|
+
v.start = targetRect.left - preInfo.left + v.start;
|
|
351
|
+
preInfo.left += (v.start - visibleInfo.start);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
targetVisibleStart = _calculateVisibleStart(targetRect, direction, targetRect, v, preInfo);
|
|
355
|
+
} else {
|
|
356
|
+
//resize通过anchor直接设置了visibleStart
|
|
357
|
+
if (resizeList.length > 0) {
|
|
358
|
+
let tRect = getItemById(focusId)?.templateInfo;
|
|
359
|
+
if (tRect) {
|
|
360
|
+
mRectCache.cache({
|
|
361
|
+
left: tRect.left,
|
|
362
|
+
top: tRect.top,
|
|
363
|
+
width: tRect.width,
|
|
364
|
+
height: tRect.height,
|
|
365
|
+
frameCount: Forge.sFrameCount.count,
|
|
366
|
+
})
|
|
299
367
|
}
|
|
300
368
|
}
|
|
301
369
|
}
|
|
302
370
|
|
|
371
|
+
let needSlide = false;
|
|
303
372
|
if (targetVisibleStart != visibleInfo.start) {
|
|
373
|
+
needSlide = true;
|
|
304
374
|
taskManager.run(() => {
|
|
305
375
|
const preVisibleStart = visibleInfo.start;
|
|
306
376
|
visibleInfo.start = targetVisibleStart;
|
|
@@ -309,13 +379,14 @@ export const setup = (
|
|
|
309
379
|
}
|
|
310
380
|
});
|
|
311
381
|
}
|
|
382
|
+
|
|
312
383
|
//updatePage
|
|
313
384
|
let updateHandler
|
|
314
385
|
taskManager.run(() => {
|
|
315
386
|
updateHandler = pageUpdater.update(
|
|
316
387
|
metroTemplate,
|
|
317
|
-
visibleInfo.startWithPadding -
|
|
318
|
-
visibleInfo.endWithPadding +
|
|
388
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
389
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
319
390
|
focusId,
|
|
320
391
|
mergeTmp,
|
|
321
392
|
permanentItemList
|
|
@@ -328,39 +399,41 @@ export const setup = (
|
|
|
328
399
|
// resize item 动画
|
|
329
400
|
if (resizeList.length > 0) {
|
|
330
401
|
updateHandler.applyTmp();
|
|
331
|
-
if (doAnim) {
|
|
402
|
+
if (resizeAnimInfo.doAnim) {
|
|
332
403
|
const visibleIndexList = Array.from(pageUpdater.getTmpRange());
|
|
333
404
|
//创建item slide anim
|
|
334
405
|
for (let index of visibleIndexList) {
|
|
335
406
|
const renderItem = getItemByIndex(index);
|
|
336
407
|
const { left, top } = renderItem.templateInfo;
|
|
337
408
|
if (index >= minIndex) {
|
|
338
|
-
const layoutCache = renderItem.templateInfo.layoutCache;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
resizeTaskMap[index]
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
409
|
+
const layoutCache = renderItem.templateInfo.layoutCache.getPreRect();
|
|
410
|
+
if (layoutCache) {
|
|
411
|
+
const doItemSlide = (div) => {
|
|
412
|
+
taskManager.run(() => {
|
|
413
|
+
const cancel = animationManager.startSlideAnim(
|
|
414
|
+
div,
|
|
415
|
+
[layoutCache.left - left, layoutCache.top - top],
|
|
416
|
+
[0, 0],
|
|
417
|
+
resizeTaskMap[index] ?
|
|
418
|
+
resizeTaskMap[index].params.animInfo
|
|
419
|
+
: { duration: resizeAnimInfo.duration }
|
|
420
|
+
)
|
|
421
|
+
return () => {
|
|
422
|
+
cancel()
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
354
426
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
427
|
+
if (renderItem.mounted.value) {
|
|
428
|
+
doItemSlide(renderItem.rootDiv);
|
|
429
|
+
} else {
|
|
430
|
+
taskManager.run(() => {
|
|
431
|
+
const unregister = renderItem.addDivMountedListener((div) => {
|
|
432
|
+
doItemSlide(div);
|
|
433
|
+
});
|
|
434
|
+
return unregister;
|
|
361
435
|
});
|
|
362
|
-
|
|
363
|
-
});
|
|
436
|
+
}
|
|
364
437
|
}
|
|
365
438
|
}
|
|
366
439
|
}
|
|
@@ -368,13 +441,22 @@ export const setup = (
|
|
|
368
441
|
}
|
|
369
442
|
|
|
370
443
|
//处理滚动动画
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
444
|
+
if (needSlide) {
|
|
445
|
+
let animInfo = undefined;
|
|
446
|
+
if (slideDoAnim) {
|
|
447
|
+
animInfo = {
|
|
448
|
+
easing: null,//resizeAnimInfo.doAnim ? resizeAnimInfo.easing : '' /* innerSlideSetting.Easing */,
|
|
449
|
+
duration: resizeAnimInfo.doAnim ? resizeAnimInfo.duration : innerSlideSetting.Duration,
|
|
450
|
+
speed: innerSlideSetting.Speed,
|
|
451
|
+
onStart: null,
|
|
452
|
+
onEnd: null,
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
executeSlide(visibleInfo.start, animInfo, updateHandler)
|
|
374
456
|
}
|
|
375
457
|
|
|
376
458
|
//回调
|
|
377
|
-
if (
|
|
459
|
+
if (resizeList.length > 0 && props.onAllItemResizeDone) {
|
|
378
460
|
taskManager.run(() => {
|
|
379
461
|
const handler = setTimeout(() => {
|
|
380
462
|
props.onAllItemResizeDone();
|
|
@@ -384,7 +466,7 @@ export const setup = (
|
|
|
384
466
|
}
|
|
385
467
|
})
|
|
386
468
|
}
|
|
387
|
-
if ((
|
|
469
|
+
if ((needSlide || allTask.focus.length > 0) && props.onFocusRectChange) {
|
|
388
470
|
taskManager.run(() => {
|
|
389
471
|
const handler = setTimeout(() => {
|
|
390
472
|
props.onFocusRectChange();
|
|
@@ -395,22 +477,21 @@ export const setup = (
|
|
|
395
477
|
})
|
|
396
478
|
}
|
|
397
479
|
}
|
|
398
|
-
const taskManager = new TaskManager(
|
|
480
|
+
const taskManager = new TaskManager(onAddTask);
|
|
399
481
|
const animationManager = new AnimationManager();
|
|
400
482
|
|
|
401
|
-
const executeSlide = (
|
|
483
|
+
const executeSlide = (target, animObj, updateHandler) => {
|
|
402
484
|
let preLeft = slideDivLeft.value;
|
|
403
485
|
let preTop = slideDivTop.value;
|
|
404
486
|
taskManager.run(() => {
|
|
405
|
-
slideDivLeft.value = vertical ? 0 : -
|
|
406
|
-
slideDivTop.value = vertical ? -
|
|
487
|
+
slideDivLeft.value = vertical ? 0 : -target;
|
|
488
|
+
slideDivTop.value = vertical ? -target : 0;
|
|
407
489
|
return () => {
|
|
408
490
|
slideDivLeft.value = preLeft;
|
|
409
491
|
slideDivTop.value = preTop;
|
|
410
492
|
}
|
|
411
493
|
});
|
|
412
|
-
|
|
413
|
-
if (slideInfo.animObj) {
|
|
494
|
+
if (animObj) {
|
|
414
495
|
updateHandler.applyTmp();
|
|
415
496
|
taskManager.run(() => {
|
|
416
497
|
const from = vertical ? [0, preTop - slideDivTop.value] : [preLeft - slideDivLeft.value, 0];
|
|
@@ -419,7 +500,7 @@ export const setup = (
|
|
|
419
500
|
from,
|
|
420
501
|
[0, 0],
|
|
421
502
|
{
|
|
422
|
-
...
|
|
503
|
+
...animObj,
|
|
423
504
|
onEnd: () => {
|
|
424
505
|
updateHandler.apply()
|
|
425
506
|
}
|
|
@@ -440,26 +521,27 @@ export const setup = (
|
|
|
440
521
|
clearTimeout(handler);
|
|
441
522
|
}
|
|
442
523
|
})
|
|
443
|
-
return viewSlid
|
|
444
524
|
}
|
|
445
525
|
|
|
446
526
|
const updateItemSize = (index, newSize, animInfo) => {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
527
|
+
const item = getItemByIndex(index);
|
|
528
|
+
if (item && (item.templateInfo.width !== newSize.width || item.templateInfo.height !== newSize.height)) {
|
|
529
|
+
taskManager.addTask(TaskType.RESIZE_ITEM,
|
|
530
|
+
{
|
|
531
|
+
index,
|
|
532
|
+
width: newSize.width,
|
|
533
|
+
height: newSize.height,
|
|
534
|
+
animInfo,
|
|
535
|
+
preRect: {
|
|
536
|
+
left: item.templateInfo.left,
|
|
537
|
+
top: item.templateInfo.top,
|
|
538
|
+
width: item.templateInfo.width,
|
|
539
|
+
height: item.templateInfo.height,
|
|
540
|
+
},
|
|
541
|
+
});
|
|
542
|
+
}
|
|
454
543
|
}
|
|
455
544
|
|
|
456
|
-
const _slideTo = (target, animObj, updateParam = { mergeTmp: false }) => {
|
|
457
|
-
if (slideLock) {
|
|
458
|
-
return
|
|
459
|
-
};
|
|
460
|
-
taskManager.addTask(TaskType.SLIDE, { target: -target, animObj, updateParam });
|
|
461
|
-
};
|
|
462
|
-
|
|
463
545
|
let callFocusAfterUpdate = false;
|
|
464
546
|
|
|
465
547
|
//methods
|
|
@@ -675,27 +757,6 @@ export const setup = (
|
|
|
675
757
|
enterFocusRect = rect;
|
|
676
758
|
};
|
|
677
759
|
|
|
678
|
-
const slideTo = (position, doAnim) => {
|
|
679
|
-
//有外部触发的滚动时, 取消load
|
|
680
|
-
tryCancelDelayLoad();
|
|
681
|
-
templateItemAdder.tryAddItemByPosition(position);
|
|
682
|
-
if (
|
|
683
|
-
typeof position !== "undefined" &&
|
|
684
|
-
position != null
|
|
685
|
-
) {
|
|
686
|
-
let animObj = null;
|
|
687
|
-
if (doAnim) {
|
|
688
|
-
animObj = {
|
|
689
|
-
easing: props.slideSetting.Easing,
|
|
690
|
-
onStart: null,
|
|
691
|
-
speed: props.slideSetting.Speed,
|
|
692
|
-
duration: props.slideSetting.Duration,
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
_slideTo(position, animObj);
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
|
|
699
760
|
const setZIndex = (index, normalZIndex, focusZIndex) => {
|
|
700
761
|
const targetItem = getItemByIndex(index);
|
|
701
762
|
if (targetItem) {
|
|
@@ -708,45 +769,63 @@ export const setup = (
|
|
|
708
769
|
}
|
|
709
770
|
}
|
|
710
771
|
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
772
|
+
const slideToInner = (position, doAnim, updateParam = { mergeTmp: false }) => {
|
|
773
|
+
if (slideLock || position == (vertical ? slideDivTop.value : slideDivLeft.value)) {
|
|
774
|
+
return
|
|
775
|
+
};
|
|
776
|
+
taskManager.addTask(TaskType.SLIDE, { position, doAnim, updateParam }, SlideTaskType.SLIDE_BY_POS);
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
const slideTo = (position, doAnim) => {
|
|
780
|
+
if (typeof position == "number") {
|
|
781
|
+
slideToInner(position, doAnim);
|
|
718
782
|
}
|
|
719
783
|
};
|
|
720
784
|
|
|
785
|
+
const slideToItemInner = (index, doAnim, direction = undefined, preItem = undefined) => {
|
|
786
|
+
taskManager.addTask(
|
|
787
|
+
TaskType.SLIDE,
|
|
788
|
+
{
|
|
789
|
+
index,
|
|
790
|
+
doAnim,
|
|
791
|
+
direction,
|
|
792
|
+
preItem,
|
|
793
|
+
},
|
|
794
|
+
SlideTaskType.SLIDE_BY_ITEM);
|
|
795
|
+
};
|
|
796
|
+
const slideToItem = (index, doAnim) => {
|
|
797
|
+
slideToItemInner(index, doAnim)
|
|
798
|
+
}
|
|
799
|
+
|
|
721
800
|
const slideToDiv = (div, doAnim) => {
|
|
722
|
-
|
|
723
|
-
|
|
801
|
+
slideToDivInner(div, doAnim);
|
|
802
|
+
}
|
|
803
|
+
const slideToDivInner = (div, doAnim, direction = undefined) => {
|
|
724
804
|
if (div) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
top: item_layout.top,
|
|
732
|
-
width: item_layout.width,
|
|
733
|
-
height: item_layout.height,
|
|
734
|
-
centerYPos: Math.floor(item_layout.top + item_layout.height / 2),
|
|
735
|
-
centerXPos: Math.floor(item_layout.left + item_layout.width / 2),
|
|
736
|
-
index: id2Index(focusId),
|
|
805
|
+
taskManager.addTask(
|
|
806
|
+
TaskType.SLIDE,
|
|
807
|
+
{
|
|
808
|
+
div,
|
|
809
|
+
doAnim,
|
|
810
|
+
direction,
|
|
737
811
|
},
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
812
|
+
SlideTaskType.SLIDE_BY_DIV);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
const slideToRect = (rect, doAnim, direction = undefined) => {
|
|
816
|
+
if (rect
|
|
817
|
+
&& typeof rect.left == 'number'
|
|
818
|
+
&& typeof rect.top == 'number'
|
|
819
|
+
&& typeof rect.width == 'number'
|
|
820
|
+
&& typeof rect.height == 'number') {
|
|
821
|
+
taskManager.addTask(
|
|
822
|
+
TaskType.SLIDE,
|
|
823
|
+
{
|
|
824
|
+
rect,
|
|
825
|
+
doAnim,
|
|
826
|
+
direction,
|
|
827
|
+
},
|
|
828
|
+
SlideTaskType.SLIDE_BY_RECT);
|
|
750
829
|
}
|
|
751
830
|
}
|
|
752
831
|
|
|
@@ -822,15 +901,22 @@ export const setup = (
|
|
|
822
901
|
}
|
|
823
902
|
const updater = pageUpdater.update(
|
|
824
903
|
metroTemplate,
|
|
825
|
-
visibleInfo.startWithPadding -
|
|
826
|
-
visibleInfo.endWithPadding +
|
|
904
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
905
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
827
906
|
focusId,
|
|
828
907
|
false,
|
|
829
908
|
permanentItemList
|
|
830
909
|
);
|
|
831
910
|
updater.apply();
|
|
832
911
|
onItemFocus(getItemById(focusId), null);
|
|
833
|
-
|
|
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();
|
|
834
920
|
};
|
|
835
921
|
|
|
836
922
|
const getVisibleItems = () => {
|
|
@@ -886,6 +972,14 @@ export const setup = (
|
|
|
886
972
|
slideLock = false;
|
|
887
973
|
}
|
|
888
974
|
|
|
975
|
+
const setSlideSetting = (setting) => {
|
|
976
|
+
if (!setting) {
|
|
977
|
+
innerSlideSetting = props.slideSetting;
|
|
978
|
+
} else {
|
|
979
|
+
innerSlideSetting = setting;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
889
983
|
const exportObject = {
|
|
890
984
|
lockSlide,
|
|
891
985
|
unlockSlide,
|
|
@@ -907,6 +1001,7 @@ export const setup = (
|
|
|
907
1001
|
getCurrentFocusIndex,
|
|
908
1002
|
getCurMode,
|
|
909
1003
|
getTemplatePosition,
|
|
1004
|
+
setSlideSetting
|
|
910
1005
|
};
|
|
911
1006
|
|
|
912
1007
|
const _calculateNearestItemByRect = (visibleSet, enter_rect_info) => {
|
|
@@ -1160,6 +1255,8 @@ export const setup = (
|
|
|
1160
1255
|
metroTemplate.getTailItemIndex()
|
|
1161
1256
|
)?.templateInfo;
|
|
1162
1257
|
if (lastTemplateInfo) {
|
|
1258
|
+
let preTouchW = touchDivSize.width;
|
|
1259
|
+
let preTouchH = touchDivSize.height;
|
|
1163
1260
|
if (vertical) {
|
|
1164
1261
|
touchDivSize.width = props.width;
|
|
1165
1262
|
touchDivSize.height = lastTemplateInfo.top + lastTemplateInfo.height - 1;
|
|
@@ -1167,7 +1264,9 @@ export const setup = (
|
|
|
1167
1264
|
touchDivSize.width = lastTemplateInfo.left + lastTemplateInfo.width - 1;
|
|
1168
1265
|
touchDivSize.height = props.height;
|
|
1169
1266
|
}
|
|
1170
|
-
|
|
1267
|
+
if (preTouchW !== touchDivSize.width || preTouchH !== touchDivSize.height) {
|
|
1268
|
+
updateTouchBoxCondition();
|
|
1269
|
+
}
|
|
1171
1270
|
}
|
|
1172
1271
|
}
|
|
1173
1272
|
|
|
@@ -1294,16 +1393,11 @@ export const setup = (
|
|
|
1294
1393
|
},
|
|
1295
1394
|
};
|
|
1296
1395
|
|
|
1297
|
-
let cur_slide = _calculateVisibleStart(fakeItem.templateInfo, direction);
|
|
1396
|
+
let cur_slide = _calculateVisibleStart(fakeItem.templateInfo, direction, fakeItem.templateInfo, visibleInfo);
|
|
1298
1397
|
if (cur_slide != visibleInfo.start) {
|
|
1299
|
-
|
|
1398
|
+
slideToInner(
|
|
1300
1399
|
cur_slide,
|
|
1301
|
-
|
|
1302
|
-
easing: "",
|
|
1303
|
-
onStart: null,
|
|
1304
|
-
speed: props.slideSetting.Speed,
|
|
1305
|
-
duration: props.slideSetting.Duration,
|
|
1306
|
-
},
|
|
1400
|
+
true,
|
|
1307
1401
|
{
|
|
1308
1402
|
mergeTmp: true
|
|
1309
1403
|
});
|
|
@@ -1315,7 +1409,7 @@ export const setup = (
|
|
|
1315
1409
|
|
|
1316
1410
|
const _changeFocusId = (id, cache_pre = true) => {
|
|
1317
1411
|
preFocusId = cache_pre ? focusId : -1;
|
|
1318
|
-
focusId = id;
|
|
1412
|
+
focusId = id >= 0 && id < metroTemplate.size ? id : 0;
|
|
1319
1413
|
currentFocusIndex.value = id2Index(id);
|
|
1320
1414
|
taskManager.addTask(TaskType.ON_FOCUS_CHANGE);
|
|
1321
1415
|
}
|
|
@@ -1402,28 +1496,23 @@ export const setup = (
|
|
|
1402
1496
|
onItemBlur(preFocusItem);
|
|
1403
1497
|
onItemFocus(next_focus_item, preEdgeRect);
|
|
1404
1498
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
permanentItemList
|
|
1423
|
-
);
|
|
1424
|
-
//不做滚动时,保证获焦的item创建. 为了避免提前隐藏, 使用applyTmp
|
|
1425
|
-
updater.applyTmp();
|
|
1426
|
-
}
|
|
1499
|
+
if (next_focus_item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
|
|
1500
|
+
slideToItemInner(
|
|
1501
|
+
next_focus_item.index,
|
|
1502
|
+
true,
|
|
1503
|
+
vertical ? vertical_direction : horizontal_direction,
|
|
1504
|
+
preFocusItem);
|
|
1505
|
+
} else {
|
|
1506
|
+
const updater = pageUpdater.update(
|
|
1507
|
+
metroTemplate,
|
|
1508
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
1509
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
1510
|
+
next_focus_item.id,
|
|
1511
|
+
false,
|
|
1512
|
+
permanentItemList
|
|
1513
|
+
);
|
|
1514
|
+
//不做滚动时,保证获焦的item创建. 为了避免提前隐藏, 使用applyTmp
|
|
1515
|
+
updater.applyTmp();
|
|
1427
1516
|
}
|
|
1428
1517
|
} else {
|
|
1429
1518
|
//到达边缘
|
|
@@ -1471,67 +1560,93 @@ export const setup = (
|
|
|
1471
1560
|
}
|
|
1472
1561
|
};
|
|
1473
1562
|
|
|
1474
|
-
const normalizeVisibleStart = (origin,
|
|
1563
|
+
const normalizeVisibleStart = (origin, targetRect = undefined, index = undefined) => {
|
|
1475
1564
|
let pos_key = vertical ? "top" : "left";
|
|
1476
1565
|
let size_key = vertical ? "height" : "width";
|
|
1477
|
-
let
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1566
|
+
let visibleStart = origin;
|
|
1567
|
+
|
|
1568
|
+
if ((innerSlideSetting.BoundaryProtect & SlideSetting.START_PROTECT) > 0) {
|
|
1569
|
+
if (visibleInfo.start >= 0) {
|
|
1570
|
+
let boundary = 0;
|
|
1571
|
+
//首个元素是占位符时, 在保证获焦区域完全展示的前提下要保证首个不可获焦元素的完全展示
|
|
1572
|
+
const headTemplateInfo = getItemByIndex(0).templateInfo;
|
|
1573
|
+
if (
|
|
1574
|
+
targetRect
|
|
1575
|
+
&& (!headTemplateInfo.focusable || index == headTemplateInfo.index)
|
|
1576
|
+
&& targetRect[pos_key] + targetRect[size_key] <=
|
|
1577
|
+
visibleInfo.range
|
|
1578
|
+
) {
|
|
1579
|
+
boundary = headTemplateInfo[size_key];
|
|
1580
|
+
}
|
|
1581
|
+
visibleStart = visibleStart < boundary ? 0 : visibleStart;
|
|
1582
|
+
} else {
|
|
1583
|
+
// 以最后一个item的位置作为动态的保护边界
|
|
1584
|
+
visibleStart = visibleStart < visibleInfo.start ? visibleInfo.start : visibleStart;
|
|
1489
1585
|
}
|
|
1490
|
-
visible_start = visible_start < boundary ? 0 : visible_start;
|
|
1491
1586
|
}
|
|
1492
|
-
if ((
|
|
1587
|
+
if ((innerSlideSetting.BoundaryProtect & SlideSetting.END_PROTECT) > 0) {
|
|
1493
1588
|
let lastTemplateInfo = getItemByIndex(metroTemplate.getTailItemIndex()).templateInfo;
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1589
|
+
const lastEnd = lastTemplateInfo[pos_key] + lastTemplateInfo[size_key];
|
|
1590
|
+
const lastVisibleStart = Math.max(lastEnd - visibleInfo.range, 0);
|
|
1591
|
+
//边界必须大于等于0, 同时若最后一个缩进时, 边界采用最后一个item的位置
|
|
1592
|
+
if (visibleInfo.end <= lastEnd) {
|
|
1593
|
+
let boundary = lastVisibleStart;
|
|
1594
|
+
if (
|
|
1595
|
+
targetRect
|
|
1596
|
+
&& (!lastTemplateInfo.focusable || index == lastTemplateInfo.index)
|
|
1597
|
+
&& targetRect[pos_key] - lastVisibleStart >= 0
|
|
1598
|
+
) {
|
|
1599
|
+
boundary = lastTemplateInfo[pos_key] - visibleInfo.range;
|
|
1600
|
+
}
|
|
1601
|
+
visibleStart = visibleStart > boundary ? lastVisibleStart : visibleStart;
|
|
1602
|
+
} else {
|
|
1603
|
+
// 以最后一个item的位置作为动态的保护边界
|
|
1604
|
+
visibleStart = visibleStart > visibleInfo.start ? visibleInfo.start : visibleStart;
|
|
1507
1605
|
}
|
|
1508
|
-
visible_start =
|
|
1509
|
-
visible_start > boundary ? last_visible_start : visible_start;
|
|
1510
1606
|
}
|
|
1511
|
-
return
|
|
1607
|
+
return visibleStart;
|
|
1512
1608
|
}
|
|
1513
1609
|
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1610
|
+
const mRectCache = new RectCache();
|
|
1611
|
+
const _calculateVisibleStart = (targetRect, _direction, templateInfo, visibleInfo, preInfo = null) => {
|
|
1612
|
+
if (!targetRect) {
|
|
1516
1613
|
console.error("MetroWidget: _calculateVisibleStart target item is null");
|
|
1517
1614
|
return 0;
|
|
1518
1615
|
}
|
|
1616
|
+
const curRect = {
|
|
1617
|
+
left: targetRect.left,
|
|
1618
|
+
top: targetRect.top,
|
|
1619
|
+
width: targetRect.width,
|
|
1620
|
+
height: targetRect.height,
|
|
1621
|
+
frameCount: Forge.sFrameCount.count,
|
|
1622
|
+
}
|
|
1623
|
+
mRectCache.cache(curRect);
|
|
1624
|
+
let preRect = mRectCache.getPreRect();
|
|
1625
|
+
if (preInfo) {
|
|
1626
|
+
preRect = preInfo;
|
|
1627
|
+
}
|
|
1628
|
+
let direction = _direction;
|
|
1629
|
+
if (typeof direction != "number") {
|
|
1630
|
+
//通过preRect确定direction
|
|
1631
|
+
let d = getDirectionByRect(curRect, preRect);
|
|
1632
|
+
direction = vertical ? d.vertical : d.horizontal;
|
|
1633
|
+
}
|
|
1519
1634
|
|
|
1520
|
-
preSlideDirection = direction;
|
|
1521
|
-
preAnchorItemIndex = targetTemplateInfo.index;
|
|
1522
1635
|
let pos_key = vertical ? "top" : "left";
|
|
1523
1636
|
let size_key = vertical ? "height" : "width";
|
|
1524
1637
|
let center_key = vertical ? "centerYPos" : "centerXPos";
|
|
1525
1638
|
let new_visible_start = visibleInfo.start;
|
|
1526
1639
|
|
|
1527
1640
|
let needCalculate = true;
|
|
1528
|
-
|
|
1641
|
+
|
|
1642
|
+
switch (innerSlideSetting.Type) {
|
|
1529
1643
|
case SlideSetting.Type.FIX_POSITION:
|
|
1644
|
+
//TODO 当item的size和widget的size相同时, 滚动速度会出现未预期的变化
|
|
1530
1645
|
//FIX_POSITION 模式会将当前 item 的中心固定到指定位置
|
|
1531
1646
|
|
|
1532
1647
|
//首页不滚动
|
|
1533
|
-
if (
|
|
1534
|
-
if (
|
|
1648
|
+
if (innerSlideSetting.FixFirstPage) {
|
|
1649
|
+
if (targetRect[pos_key] + targetRect[size_key] - 1 < visibleInfo.range) {
|
|
1535
1650
|
new_visible_start = 0;
|
|
1536
1651
|
needCalculate = false;
|
|
1537
1652
|
}
|
|
@@ -1539,88 +1654,116 @@ export const setup = (
|
|
|
1539
1654
|
|
|
1540
1655
|
if (needCalculate) {
|
|
1541
1656
|
new_visible_start = Math.ceil(
|
|
1542
|
-
|
|
1543
|
-
visibleInfo.range *
|
|
1657
|
+
targetRect[pos_key] + targetRect[size_key] / 2 -
|
|
1658
|
+
visibleInfo.range * innerSlideSetting.FixPercent
|
|
1544
1659
|
);
|
|
1545
1660
|
}
|
|
1546
1661
|
break;
|
|
1547
1662
|
case SlideSetting.Type.WHOLE_PAGE:
|
|
1548
|
-
if (typeof
|
|
1663
|
+
if (!templateInfo || typeof templateInfo.pageHeadIndex == "undefined") {
|
|
1549
1664
|
//TODO 子控制滚动时whole page滚动
|
|
1550
1665
|
console.error(
|
|
1551
1666
|
"child controlled whole page slide type is not supported."
|
|
1552
1667
|
);
|
|
1553
1668
|
} else {
|
|
1554
|
-
new_visible_start = getItemByIndex(
|
|
1669
|
+
new_visible_start = getItemByIndex(templateInfo.pageHeadIndex)
|
|
1555
1670
|
.templateInfo[pos_key];
|
|
1556
1671
|
}
|
|
1557
1672
|
|
|
1558
1673
|
break;
|
|
1559
1674
|
case SlideSetting.Type.SEAMLESS:
|
|
1560
1675
|
//首页不滚动
|
|
1561
|
-
if (
|
|
1562
|
-
if (
|
|
1676
|
+
if (innerSlideSetting.FixFirstPage) {
|
|
1677
|
+
if (targetRect[pos_key] + targetRect[size_key] - 1 < visibleInfo.range) {
|
|
1563
1678
|
new_visible_start = 0;
|
|
1564
1679
|
needCalculate = false;
|
|
1565
1680
|
}
|
|
1566
1681
|
}
|
|
1682
|
+
|
|
1567
1683
|
if (needCalculate) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1684
|
+
/**
|
|
1685
|
+
* seamless滚动规则:
|
|
1686
|
+
* 0-start: 焦点往右时不处理, 往左的时候更新position以保持焦点的start位置一致
|
|
1687
|
+
* end-1.0: 焦点往左时不处理, 往右的时候更新position以保持焦点的end位置一致
|
|
1688
|
+
* 重合区域: 保持焦点的中心位置一致
|
|
1689
|
+
*/
|
|
1690
|
+
const itemStart = targetRect[pos_key];
|
|
1691
|
+
const itemEnd = targetRect[pos_key] + targetRect[size_key] - 1;
|
|
1692
|
+
const itemMainSize = targetRect[size_key];
|
|
1693
|
+
|
|
1694
|
+
if (preRect) {
|
|
1695
|
+
const rect0Start = visibleInfo.start;
|
|
1696
|
+
const rect0End = visibleInfo.start + visibleInfo.range * innerSlideSetting.StartPercent;
|
|
1697
|
+
const rect0Range = rect0End - rect0Start + 1
|
|
1698
|
+
const rect1Start = visibleInfo.start + visibleInfo.range * innerSlideSetting.EndPercent;
|
|
1699
|
+
const rect1End = visibleInfo.start + visibleInfo.range - 1;
|
|
1700
|
+
const rect1Range = rect1End - rect1Start + 1;
|
|
1701
|
+
|
|
1702
|
+
let target0 = Math.min(preRect[pos_key], rect0End);
|
|
1703
|
+
let target1 = Math.max(preRect[pos_key] + preRect[size_key] - 1, rect1Start);
|
|
1704
|
+
|
|
1705
|
+
let rect0Result = undefined;
|
|
1706
|
+
let rect1Result = undefined;
|
|
1707
|
+
|
|
1708
|
+
//item的head对齐rect0的end
|
|
1709
|
+
if (itemStart < rect0End) {
|
|
1710
|
+
if (target0 < rect0Start) {
|
|
1711
|
+
//preRect位置错误或者item的尺寸大于区域范围(保证item完整显示)
|
|
1712
|
+
// rect0Result = itemStart;
|
|
1713
|
+
} else {
|
|
1714
|
+
if (direction <= 0) {
|
|
1715
|
+
//inRect0, 只处理往左/往上
|
|
1716
|
+
rect0Result = visibleInfo.start + (itemStart - target0)
|
|
1717
|
+
}
|
|
1597
1718
|
}
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
targetTemplateInfo[size_key] -
|
|
1611
|
-
visibleInfo.range * props.slideSetting.EndPercent;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
//item的头部对齐rect1的start
|
|
1722
|
+
if (itemEnd > rect1Start) {
|
|
1723
|
+
if (target1 > rect1End) {
|
|
1724
|
+
//preRect位置错误或者item的尺寸大于区域范围(保证item完整显示)
|
|
1725
|
+
// rect1Result = itemEnd - visibleInfo.range;
|
|
1726
|
+
} else {
|
|
1727
|
+
if (direction >= 0) {
|
|
1728
|
+
//inRect1, 只处理往右/往下
|
|
1729
|
+
rect1Result = visibleInfo.start + (itemEnd - target1);
|
|
1730
|
+
}
|
|
1612
1731
|
}
|
|
1613
1732
|
}
|
|
1733
|
+
|
|
1734
|
+
if (typeof rect0Result !== "undefined" && typeof rect1Result !== "undefined") {
|
|
1735
|
+
//重叠区域
|
|
1736
|
+
new_visible_start = rect0Result;
|
|
1737
|
+
} else if (typeof rect0Result !== "undefined") {
|
|
1738
|
+
new_visible_start = rect0Result;
|
|
1739
|
+
} else if (typeof rect1Result !== "undefined") {
|
|
1740
|
+
new_visible_start = rect1Result;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
//保证item处于safe area范围
|
|
1745
|
+
const headSafeArea = innerSlideSetting.HeadSafeArea * visibleInfo.range;
|
|
1746
|
+
const tailSafeArea = innerSlideSetting.TailSafeArea * visibleInfo.range;
|
|
1747
|
+
if (itemMainSize > visibleInfo.range - headSafeArea - tailSafeArea) {
|
|
1748
|
+
// 大item
|
|
1749
|
+
new_visible_start = Math.round(itemStart - (visibleInfo.range - itemMainSize) / 2)
|
|
1750
|
+
} else {
|
|
1751
|
+
if (itemStart < new_visible_start + headSafeArea) {
|
|
1752
|
+
new_visible_start = itemStart - headSafeArea;
|
|
1753
|
+
} else if (itemEnd > new_visible_start + visibleInfo.range - 1 - tailSafeArea) {
|
|
1754
|
+
new_visible_start = itemEnd - visibleInfo.range + tailSafeArea;
|
|
1755
|
+
}
|
|
1614
1756
|
}
|
|
1615
1757
|
}
|
|
1616
1758
|
break;
|
|
1617
1759
|
default:
|
|
1618
1760
|
console.error(
|
|
1619
1761
|
"MetroWidget: undefined slide type",
|
|
1620
|
-
|
|
1762
|
+
innerSlideSetting.Type
|
|
1621
1763
|
);
|
|
1622
1764
|
}
|
|
1623
|
-
|
|
1765
|
+
|
|
1766
|
+
new_visible_start = normalizeVisibleStart(new_visible_start, targetRect, templateInfo?.index);
|
|
1624
1767
|
return Math.round(new_visible_start);
|
|
1625
1768
|
};
|
|
1626
1769
|
|
|
@@ -1656,6 +1799,7 @@ export const setup = (
|
|
|
1656
1799
|
console.log(`MetroWidget: ${props.name} get focus while data is empty.`);
|
|
1657
1800
|
return;
|
|
1658
1801
|
}
|
|
1802
|
+
|
|
1659
1803
|
let focus_id =
|
|
1660
1804
|
typeof enterFocusId !== "undefined" &&
|
|
1661
1805
|
enterFocusId >= 0 &&
|
|
@@ -1681,18 +1825,30 @@ export const setup = (
|
|
|
1681
1825
|
onItemBlur(getItemById(preFocusId));
|
|
1682
1826
|
props.onBlur?.();
|
|
1683
1827
|
isFocus = false;
|
|
1828
|
+
mRectCache.clean()
|
|
1684
1829
|
};
|
|
1685
1830
|
|
|
1686
1831
|
const _updatePage = (rangeSet) => {
|
|
1832
|
+
let cur = id2Index(focusId);
|
|
1833
|
+
if (cur >= 0) {
|
|
1834
|
+
rangeSet.add(cur)
|
|
1835
|
+
}
|
|
1687
1836
|
const tmpArray = Array.from(rangeSet);
|
|
1688
|
-
|
|
1837
|
+
let newArray = tmpArray.map((item) => {
|
|
1689
1838
|
return getItemByIndex(item);
|
|
1690
1839
|
});
|
|
1840
|
+
const newItemList = newArray.filter((i) => { return !renderData.value?.includes(i) });
|
|
1841
|
+
renderData.value = newArray;
|
|
1691
1842
|
if (props.enableItemRenderBreak) {
|
|
1692
1843
|
itemRender.value = false;
|
|
1693
|
-
|
|
1844
|
+
const f = () => {
|
|
1845
|
+
// 关闭强制TriggerManualBlock,改为vue内部通过dom的任务数来确定是否执行打断
|
|
1846
|
+
// if (newItemList.length > 12 && props.enableItemRenderBreak) {
|
|
1847
|
+
// window.JsView?.triggerManualBlocker?.();
|
|
1848
|
+
// }
|
|
1694
1849
|
itemRender.value = true;
|
|
1695
|
-
}
|
|
1850
|
+
};
|
|
1851
|
+
nextTick(f);
|
|
1696
1852
|
}
|
|
1697
1853
|
};
|
|
1698
1854
|
|
|
@@ -1747,8 +1903,19 @@ export const setup = (
|
|
|
1747
1903
|
}
|
|
1748
1904
|
}
|
|
1749
1905
|
|
|
1906
|
+
const getTouchCount = (nexusCustomData) => {
|
|
1907
|
+
let touchCount = -1;
|
|
1908
|
+
if (nexusCustomData) {
|
|
1909
|
+
try {
|
|
1910
|
+
touchCount = JSON.parse(nexusCustomData).tc;
|
|
1911
|
+
} catch (e) {
|
|
1912
|
+
touchCount = -1;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
return touchCount;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1750
1918
|
const mergeTouchSlideToSlideDiv = (touchCount) => {
|
|
1751
|
-
// console.log("touchtest", props.name, `touchToDiv div: ${slideDivTop.value}, visibleStart:${visibleInfo.start} swapCount: ${Forge.sFrameCount.count}`)
|
|
1752
1919
|
if (vertical) {
|
|
1753
1920
|
slideDivTop.value = -visibleInfo.start;
|
|
1754
1921
|
} else {
|
|
@@ -1780,6 +1947,13 @@ export const setup = (
|
|
|
1780
1947
|
}
|
|
1781
1948
|
|
|
1782
1949
|
const onTouchDown = (data, customData, nexusCustomData) => {
|
|
1950
|
+
touchRecorder.reset();
|
|
1951
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
1952
|
+
touchRecorder.setTouchCount(touchCount);
|
|
1953
|
+
if (mode.getMode() == FOCUS_MODE) {
|
|
1954
|
+
//模式切换, 更新boxPosition
|
|
1955
|
+
updateTouchBoxCondition();
|
|
1956
|
+
}
|
|
1783
1957
|
mode.touchStart();
|
|
1784
1958
|
mode.flingEnd();
|
|
1785
1959
|
// console.log("touchtest", `${props.name} animId:${debugAnimId} viewId:${debugViewId}`,
|
|
@@ -1791,6 +1965,7 @@ export const setup = (
|
|
|
1791
1965
|
top: vertical ? t : undefined,
|
|
1792
1966
|
bottom: vertical ? t : undefined,
|
|
1793
1967
|
}
|
|
1968
|
+
|
|
1794
1969
|
actorController.run([
|
|
1795
1970
|
actorController
|
|
1796
1971
|
.condition(undefined, false)
|
|
@@ -1809,8 +1984,8 @@ export const setup = (
|
|
|
1809
1984
|
|
|
1810
1985
|
const updater = pageUpdater.update(
|
|
1811
1986
|
metroTemplate,
|
|
1812
|
-
visibleInfo.startWithPadding -
|
|
1813
|
-
visibleInfo.endWithPadding +
|
|
1987
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
1988
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
1814
1989
|
0,
|
|
1815
1990
|
false,
|
|
1816
1991
|
permanentItemList
|
|
@@ -1828,7 +2003,7 @@ export const setup = (
|
|
|
1828
2003
|
anchorPos += anchorSpacing;
|
|
1829
2004
|
}
|
|
1830
2005
|
const reachConditionList = anchorPosList.map(pos => {
|
|
1831
|
-
actorController
|
|
2006
|
+
return actorController
|
|
1832
2007
|
.condition(reachAnchorGroup)
|
|
1833
2008
|
.reachPosition(pos, undefined)
|
|
1834
2009
|
.then([(data) => { updateRenderItems(true, true) }])
|
|
@@ -1844,35 +2019,32 @@ export const setup = (
|
|
|
1844
2019
|
//只点击, 没有移动或者fling
|
|
1845
2020
|
updateRenderItems(false, false);
|
|
1846
2021
|
mode.touchEnd();
|
|
2022
|
+
} else {
|
|
2023
|
+
if (touchRecorder.moved && !mode.duringFling()) {
|
|
2024
|
+
mergeTouchSlideToSlideDiv(touchRecorder.touchCount);
|
|
2025
|
+
updateRenderItems(false, false);
|
|
2026
|
+
mode.touchEnd()
|
|
2027
|
+
}
|
|
1847
2028
|
}
|
|
1848
2029
|
}
|
|
1849
2030
|
|
|
2031
|
+
const exportOnTouchRelease = props.touchFlag > 0 ? onTouchRelease : undefined;
|
|
2032
|
+
|
|
1850
2033
|
const onDragStart = (data, customData, nexusCustomData) => {
|
|
2034
|
+
touchRecorder.move();
|
|
1851
2035
|
mode.dragStart()
|
|
1852
2036
|
visibleInfo.start = getVisibleStart(data);
|
|
1853
2037
|
}
|
|
1854
2038
|
|
|
1855
2039
|
const onDragEnd = (data, customData, nexusCustomData) => {
|
|
1856
2040
|
visibleInfo.start = getVisibleStart(data);
|
|
1857
|
-
// console.log("touchtest", props.name + " animId:" + debugAnimId,
|
|
1858
|
-
// `onDragEnd ${visibleInfo.start}`)
|
|
1859
2041
|
actorController.run([
|
|
1860
2042
|
actorController.state().removeConditionByGroup(reachAnchorGroup),
|
|
1861
2043
|
]);
|
|
1862
|
-
let touchCount = -1;
|
|
1863
|
-
if (nexusCustomData) {
|
|
1864
|
-
try {
|
|
1865
|
-
touchCount = JSON.parse(nexusCustomData).tc;
|
|
1866
|
-
} catch (e) {
|
|
1867
|
-
touchCount = -1;
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
mergeTouchSlideToSlideDiv(touchCount);
|
|
1871
|
-
updateRenderItems(false, false);
|
|
1872
|
-
mode.touchEnd()
|
|
1873
2044
|
}
|
|
1874
2045
|
|
|
1875
2046
|
const onFlingStart = (data, customData, nexusCustomData) => {
|
|
2047
|
+
touchRecorder.move();
|
|
1876
2048
|
mode.flingStart();
|
|
1877
2049
|
visibleInfo.start = getVisibleStart(data);
|
|
1878
2050
|
updateRenderItems(true, true);
|
|
@@ -1885,17 +2057,9 @@ export const setup = (
|
|
|
1885
2057
|
|
|
1886
2058
|
const onFlingEnd = (data, customData, nexusCustomData) => {
|
|
1887
2059
|
visibleInfo.start = getVisibleStart(data);
|
|
1888
|
-
// console.log("touchtest", props.name, `onFlingEnd ${visibleInfo.start}`, data, customData, nexusCustomData)
|
|
1889
2060
|
//记录拖拽的距离
|
|
1890
2061
|
if (mode.duringFling()) {
|
|
1891
|
-
let touchCount =
|
|
1892
|
-
if (nexusCustomData) {
|
|
1893
|
-
try {
|
|
1894
|
-
touchCount = JSON.parse(nexusCustomData).tc;
|
|
1895
|
-
} catch (e) {
|
|
1896
|
-
touchCount = -1;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
2062
|
+
let touchCount = getTouchCount(nexusCustomData);
|
|
1899
2063
|
mergeTouchSlideToSlideDiv(touchCount);
|
|
1900
2064
|
updateRenderItems(false, false);
|
|
1901
2065
|
mode.flingEnd();
|
|
@@ -1903,6 +2067,10 @@ export const setup = (
|
|
|
1903
2067
|
}
|
|
1904
2068
|
}
|
|
1905
2069
|
|
|
2070
|
+
const onFlingDrop = (data, customData, nexusCustomData) => {
|
|
2071
|
+
visibleInfo.start = getVisibleStart(data);
|
|
2072
|
+
}
|
|
2073
|
+
|
|
1906
2074
|
const getTouchWall = () => {
|
|
1907
2075
|
const boxSize = metroTemplate.getBoundingBoxSize();
|
|
1908
2076
|
let wall = {
|
|
@@ -1914,9 +2082,15 @@ export const setup = (
|
|
|
1914
2082
|
if (vertical) {
|
|
1915
2083
|
wall.top = -boxSize.height + props.height - slideDivTop.value;
|
|
1916
2084
|
wall.bottom = -slideDivTop.value;
|
|
2085
|
+
if (wall.top > wall.bottom) {
|
|
2086
|
+
wall.top = wall.bottom;
|
|
2087
|
+
}
|
|
1917
2088
|
} else {
|
|
1918
2089
|
wall.left = -boxSize.width + props.width - slideDivLeft.value;
|
|
1919
2090
|
wall.right = -slideDivLeft.value;
|
|
2091
|
+
if (wall.left > wall.right) {
|
|
2092
|
+
wall.left = wall.right;
|
|
2093
|
+
}
|
|
1920
2094
|
}
|
|
1921
2095
|
return wall;
|
|
1922
2096
|
}
|
|
@@ -1925,8 +2099,8 @@ export const setup = (
|
|
|
1925
2099
|
templateItemAdder.tryAddItemByPosition(visibleInfo.start + visibleInfo.range);
|
|
1926
2100
|
const updater = pageUpdater.update(
|
|
1927
2101
|
metroTemplate,
|
|
1928
|
-
visibleInfo.startWithPadding -
|
|
1929
|
-
visibleInfo.endWithPadding +
|
|
2102
|
+
visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
2103
|
+
visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
1930
2104
|
0,
|
|
1931
2105
|
true,
|
|
1932
2106
|
permanentItemList
|
|
@@ -1934,9 +2108,10 @@ export const setup = (
|
|
|
1934
2108
|
applyTmp ? updater.applyTmp() : updater.apply();
|
|
1935
2109
|
}
|
|
1936
2110
|
|
|
1937
|
-
const
|
|
2111
|
+
const updateTouchBoxCondition = () => {
|
|
1938
2112
|
if (actorController != null) {
|
|
1939
2113
|
const walls = getTouchWall();
|
|
2114
|
+
|
|
1940
2115
|
//更新wall设置
|
|
1941
2116
|
actorController.run([
|
|
1942
2117
|
actorController.state().removeConditionByGroup(wallConditionGroup),
|
|
@@ -1948,6 +2123,21 @@ export const setup = (
|
|
|
1948
2123
|
}
|
|
1949
2124
|
}
|
|
1950
2125
|
|
|
2126
|
+
const touchRecorder = {
|
|
2127
|
+
moved: false,
|
|
2128
|
+
touchCount: -1,
|
|
2129
|
+
reset: function () {
|
|
2130
|
+
this.moved = false;
|
|
2131
|
+
this.touchCount = -1;
|
|
2132
|
+
},
|
|
2133
|
+
move: function () {
|
|
2134
|
+
this.moved = true;
|
|
2135
|
+
},
|
|
2136
|
+
setTouchCount: function (count) {
|
|
2137
|
+
this.touchCount = count;
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
|
|
1951
2141
|
//TODO debug
|
|
1952
2142
|
// let debugAnimId = -1;
|
|
1953
2143
|
// let debugViewId = -1
|
|
@@ -1955,10 +2145,14 @@ export const setup = (
|
|
|
1955
2145
|
actorController = new ActorControl();
|
|
1956
2146
|
const divView = touchDiv.value.jsvGetProxyView();
|
|
1957
2147
|
actorController.bindForgeView(divView, true);
|
|
1958
|
-
divView.DragEnables?.(
|
|
2148
|
+
divView.DragEnables?.(
|
|
2149
|
+
ForgeConst.DragFlags.TOUCH_RECV_MOVE_BIT |
|
|
2150
|
+
ForgeConst.DragFlags.TOUCH_RECV_FLING_BIT |
|
|
2151
|
+
ForgeConst.DragFlags.TOUCH_RECV_FIRST_START |
|
|
2152
|
+
ForgeConst.DragFlags.TOUCH_RECV_LAST_END);
|
|
1959
2153
|
// debugAnimId = actorController.debugGetAnimId();
|
|
1960
2154
|
// debugViewId = divView.ViewId;
|
|
1961
|
-
// console.log("
|
|
2155
|
+
// console.log("testtest", props.name, `animId:${debugAnimId} viewId:${debugViewId}`);
|
|
1962
2156
|
const walls = getTouchWall();
|
|
1963
2157
|
//注册回调
|
|
1964
2158
|
actorController.run([
|
|
@@ -1966,10 +2160,10 @@ export const setup = (
|
|
|
1966
2160
|
.condition(undefined, true)
|
|
1967
2161
|
.onTouchDown()
|
|
1968
2162
|
.then([onTouchDown]),
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
2163
|
+
actorController
|
|
2164
|
+
.condition(undefined, true)
|
|
2165
|
+
.onDragStart()
|
|
2166
|
+
.then([onDragStart]),
|
|
1973
2167
|
actorController
|
|
1974
2168
|
.condition(undefined, true)
|
|
1975
2169
|
.onDragEnd()
|
|
@@ -1986,6 +2180,10 @@ export const setup = (
|
|
|
1986
2180
|
.condition(undefined, true)
|
|
1987
2181
|
.onFlingEnd()
|
|
1988
2182
|
.then([onFlingEnd]),
|
|
2183
|
+
actorController
|
|
2184
|
+
.condition(undefined, true)
|
|
2185
|
+
.onFlingDrop()
|
|
2186
|
+
.then([onFlingDrop]),
|
|
1989
2187
|
actorController
|
|
1990
2188
|
.condition(undefined, true)
|
|
1991
2189
|
.onTouchRelease()
|
|
@@ -2029,7 +2227,7 @@ export const setup = (
|
|
|
2029
2227
|
}
|
|
2030
2228
|
|
|
2031
2229
|
let init_focus_id = 0;
|
|
2032
|
-
let
|
|
2230
|
+
let initVisibleStart = 0;
|
|
2033
2231
|
|
|
2034
2232
|
if (typeof props.initFocusId == "number") {
|
|
2035
2233
|
templateItemAdder.tryAddItemById(props.initFocusId);
|
|
@@ -2037,18 +2235,19 @@ export const setup = (
|
|
|
2037
2235
|
if (item) {
|
|
2038
2236
|
init_focus_id = props.initFocusId;
|
|
2039
2237
|
if (item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
|
|
2040
|
-
|
|
2238
|
+
initVisibleStart = _calculateVisibleStart(item.templateInfo, 0, item.templateInfo, visibleInfo);
|
|
2041
2239
|
}
|
|
2042
2240
|
}
|
|
2043
2241
|
}
|
|
2044
2242
|
focusId = init_focus_id;
|
|
2045
|
-
visibleInfo.start = cur_visible_start;
|
|
2046
2243
|
|
|
2047
|
-
|
|
2244
|
+
let initVisibleInfo = visibleInfo.copy();
|
|
2245
|
+
initVisibleInfo.start = initVisibleStart;
|
|
2246
|
+
//保证创建速度, 先描画一屏
|
|
2048
2247
|
const initUpdater = pageUpdater.update(
|
|
2049
2248
|
metroTemplate,
|
|
2050
|
-
|
|
2051
|
-
|
|
2249
|
+
initVisibleInfo.startWithPadding,
|
|
2250
|
+
initVisibleInfo.endWithPadding,
|
|
2052
2251
|
0,
|
|
2053
2252
|
false,
|
|
2054
2253
|
permanentItemList
|
|
@@ -2058,8 +2257,8 @@ export const setup = (
|
|
|
2058
2257
|
const delayLoadHandler = setTimeout(() => {
|
|
2059
2258
|
const updateHandler = pageUpdater.update(
|
|
2060
2259
|
metroTemplate,
|
|
2061
|
-
|
|
2062
|
-
|
|
2260
|
+
initVisibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
|
|
2261
|
+
initVisibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
|
|
2063
2262
|
focusId,
|
|
2064
2263
|
false,
|
|
2065
2264
|
permanentItemList
|
|
@@ -2073,8 +2272,8 @@ export const setup = (
|
|
|
2073
2272
|
onMounted(() => {
|
|
2074
2273
|
_changeFocusId(focusId, false);
|
|
2075
2274
|
mounted = true;
|
|
2076
|
-
if (
|
|
2077
|
-
|
|
2275
|
+
if (initVisibleStart) {
|
|
2276
|
+
slideToInner(initVisibleStart, false);
|
|
2078
2277
|
}
|
|
2079
2278
|
if (isFocus && !alreadyCallItemFocus) {
|
|
2080
2279
|
onItemFocus(getItemById(focusId), preEdgeRect);
|
|
@@ -2107,7 +2306,7 @@ export const setup = (
|
|
|
2107
2306
|
exportObject,
|
|
2108
2307
|
setZIndex,
|
|
2109
2308
|
onTouchDown,
|
|
2110
|
-
onTouchRelease,
|
|
2309
|
+
onTouchRelease: exportOnTouchRelease,
|
|
2111
2310
|
currentFocusIndex,
|
|
2112
2311
|
modeForExport,
|
|
2113
2312
|
}
|