@shijiu/jsview-vue 2.3.151-test.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/browser/BrowserAudio.mjs +200 -0
- package/bin/browser/BrowserJsvLatex.mjs +61 -0
- package/bin/export-sfc.mjs +8 -9
- package/bin/jsview-vue-common.mjs +9 -35
- package/bin/jsview-vue.mjs +22246 -23643
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue.d.ts +9 -71
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +18 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/Const.d.ts +4 -1
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +10 -7
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +19 -178
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +19 -178
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +24 -3
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +7 -1
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +25 -5
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/SlotComponent.vue.d.ts +9 -47
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/TaskManager.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/Utils.d.ts +2 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +1 -1
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue.d.ts +40 -0
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.d.ts +24 -0
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.d.ts +19 -0
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.d.ts +42 -0
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +6 -4
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +9 -7
- package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +17 -7
- package/bin/types/utils/JsViewEngineWidget/index.d.ts +3 -1
- package/bin/types/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue.d.ts +140 -7
- package/bin/types/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue.d.ts +12 -11
- package/bin/types/utils/JsViewPlugin/JsvAudio/Events.d.ts +10 -10
- package/bin/types/utils/JsViewPlugin/JsvAudio/JsvAudio.vue.d.ts +204 -17
- package/bin/types/utils/JsViewPlugin/JsvAudio/JsvAudioProxy.vue.d.ts +2 -1
- package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +11 -11
- package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +11 -11
- package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +0 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +75 -12
- package/bin/types/utils/JsViewPlugin/JsvLatex/GetVersion.d.ts +14 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +88 -13
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +1 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +5 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/version.d.mts +39 -12
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +120 -17
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.d.ts +62 -0
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue.d.ts +108 -29
- package/bin/types/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer-0.9.vue.d.ts → JsvPlayerBrowser-0.9.vue.d.ts} +8 -7
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-wasm.vue.d.ts +614 -0
- package/bin/types/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer.vue.d.ts → JsvPlayerBrowser.vue.d.ts} +36 -34
- package/bin/types/utils/JsViewPlugin/JsvPlayer/index-0.9.d.ts +89 -30
- package/bin/types/utils/JsViewPlugin/JsvPlayer/index.d.ts +89 -30
- package/bin/types/utils/JsViewPlugin/JsvPlayer/version.d.mts +11 -11
- package/bin/types/utils/JsViewVueTools/BlobApi.d.ts +38 -0
- package/bin/types/utils/JsViewVueTools/DebugTool.d.ts +1 -1
- package/bin/types/utils/JsViewVueTools/DefaultKeyMap.d.ts +7 -7
- package/bin/types/utils/JsViewVueTools/FeatureActive.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvInteractionMode.d.ts +6 -0
- package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +3 -3
- package/bin/types/utils/JsViewVueTools/JsvTextTools.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.d.ts +43 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.d.ts +54 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +13 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +2 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +76 -26
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.d.ts +49 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/index.d.ts +2 -0
- package/bin/types/utils/JsViewVueTools/index.d.ts +4 -1
- package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +10 -98
- package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +10 -114
- package/bin/types/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue.d.ts +20 -61
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +44 -13
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +12 -11
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +5 -5
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +16 -10
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +21 -17
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +19 -16
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.d.ts +7 -7
- package/bin/types/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +12 -66
- package/bin/types/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +73 -12
- package/bin/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +59 -10
- package/bin/types/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue.d.ts +41 -81
- package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +17 -100
- package/bin/types/utils/JsViewVueWidget/JsvEnableRenderBreak.vue.d.ts +13 -50
- package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +50 -70
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue.d.ts +32 -68
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +57 -74
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue.d.ts +41 -71
- package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +83 -14
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +151 -18
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +79 -83
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvFreeMoveActor.vue.d.ts +70 -0
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +20 -0
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +108 -5
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +88 -3
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +6 -1
- package/bin/types/utils/JsViewVueWidget/JsvGrid.vue.d.ts +19 -18
- package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +34 -11
- package/bin/types/utils/JsViewVueWidget/JsvInput/EditViewOperator.d.ts +4 -1
- package/bin/types/utils/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +193 -6
- package/bin/types/utils/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +54 -11
- package/bin/types/utils/JsViewVueWidget/JsvMarquee.vue.d.ts +89 -11
- package/bin/types/utils/JsViewVueWidget/JsvMaskClipDiv.vue.d.ts +9 -8
- package/bin/types/utils/JsViewVueWidget/JsvMindMap/Geometry.d.ts +2 -2
- package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +170 -138
- package/bin/types/utils/JsViewVueWidget/JsvMindMap/rtree.d.ts +5 -5
- package/bin/types/utils/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +48 -72
- package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +139 -20
- package/bin/types/utils/JsViewVueWidget/JsvPieChart.vue.d.ts +56 -8
- package/bin/types/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +20 -11
- package/bin/types/utils/JsViewVueWidget/JsvProgressBar.vue.d.ts +63 -11
- package/bin/types/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +8 -7
- package/bin/types/utils/JsViewVueWidget/JsvRadarChart.vue.d.ts +95 -12
- package/bin/types/utils/JsViewVueWidget/JsvRipple/Constant.d.ts +2 -2
- package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +51 -78
- package/bin/types/utils/JsViewVueWidget/JsvScaleTextBox.vue.d.ts +5 -4
- package/bin/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +84 -193
- package/bin/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +23 -148
- package/bin/types/utils/JsViewVueWidget/JsvSector.vue.d.ts +56 -9
- package/bin/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +22 -67
- package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +44 -10
- package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +47 -14
- package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue.d.ts +26 -67
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/Indicator.vue.d.ts +7 -6
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +147 -109
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +173 -16
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +216 -139
- package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue.d.ts +7 -6
- package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +101 -96
- package/bin/types/utils/JsViewVueWidget/JsvTextBox.vue.d.ts +89 -74
- package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +21 -20
- package/bin/types/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue.d.ts +43 -70
- package/bin/types/utils/JsViewVueWidget/JsvVideo.vue.d.ts +6 -5
- package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +62 -82
- package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +95 -74
- package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvPosterDiv.vue.d.ts +51 -0
- package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvPosterImage.vue.d.ts +105 -0
- package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue.d.ts +51 -0
- package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue.d.ts +105 -0
- package/bin/types/utils/JsViewVueWidget/index.d.ts +5 -3
- package/package.json +2 -2
- package/tools/jsview-vue-build.mjs +13 -9
- package/tsconfig.json +2 -2
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +32 -16
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +24 -2
- package/utils/JsViewEngineWidget/MetroWidget/Const.ts +5 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +183 -89
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +269 -122
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +989 -357
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +41 -23
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +138 -41
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +1 -0
- package/utils/JsViewEngineWidget/MetroWidget/Utils.ts +6 -0
- package/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.ts +2 -1
- package/utils/JsViewEngineWidget/RectUtils.js +1 -1
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue +50 -0
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.ts +260 -0
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.ts +32 -0
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.ts +236 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +342 -174
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +101 -27
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +12 -5
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +109 -41
- package/utils/JsViewEngineWidget/WidgetCommon.ts +17 -7
- package/utils/JsViewEngineWidget/index.ts +7 -2
- package/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.js +46 -46
- package/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue +54 -41
- package/utils/JsViewPlugin/JsvLatex/GetVersion.js +65 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatex.vue +54 -12
- package/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.js +10 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue +15 -2
- package/utils/JsViewPlugin/JsvLatex/PluginLoader.js +63 -31
- package/utils/JsViewPlugin/JsvLatex/version.mjs +26 -13
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +2 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +402 -23
- package/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.js +100 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +363 -468
- package/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer.vue → JsvPlayerBrowser-wasm.vue} +60 -10
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +511 -0
- package/utils/JsViewPlugin/JsvPlayer/index-0.9.js +52 -10
- package/utils/JsViewPlugin/JsvPlayer/index.js +58 -9
- package/utils/JsViewPlugin/JsvPlayer/package.json +8 -0
- package/utils/JsViewVueTools/BlobApi.ts +55 -0
- package/utils/JsViewVueTools/FeatureActive.ts +3 -0
- package/utils/JsViewVueTools/ForgeHandles.ts +3 -0
- package/utils/JsViewVueTools/JsvInteractionMode.js +16 -0
- package/utils/JsViewVueTools/JsvPreDownloader.ts +2 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +25 -18
- package/utils/JsViewVueTools/JsvTextTools.ts +9 -1
- package/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.ts +180 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +1 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.ts +304 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -0
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +16 -1
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +154 -69
- package/utils/JsViewVueTools/JsvTextureStore/Store.ts +1 -1
- package/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.ts +92 -0
- package/utils/JsViewVueTools/JsvTextureStore/index.js +2 -0
- package/utils/JsViewVueTools/index.js +3 -1
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +111 -86
- package/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue +11 -2
- package/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue +1 -1
- package/utils/JsViewVueWidget/JsvEnableRenderBreak.vue +6 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +11 -5
- package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +3 -1
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +23 -11
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +242 -25
- package/utils/JsViewVueWidget/JsvFreeMoveActor/{FreeMoveActor.vue → JsvFreeMoveActor.vue} +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +11 -5
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +118 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +56 -14
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +2 -1
- package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +11 -2
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +30 -2
- package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +24 -7
- package/utils/JsViewVueWidget/JsvMarquee.vue +1 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +12 -10
- package/utils/JsViewVueWidget/JsvNinePatch.vue +13 -8
- package/utils/JsViewVueWidget/JsvPieChart.vue +93 -70
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +32 -29
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +2 -1
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +25 -3
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +0 -3
- package/utils/JsViewVueWidget/JsvSector.vue +66 -28
- package/utils/JsViewVueWidget/JsvTextBox.vue +30 -1
- package/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue +56 -14
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +8 -6
- package/utils/JsViewVueWidget/TypesDiv/JsvPosterDiv.vue +54 -0
- package/utils/JsViewVueWidget/TypesDiv/JsvPosterImage.vue +88 -0
- package/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue +177 -0
- package/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue +267 -0
- package/utils/JsViewVueWidget/index.js +6 -2
- package/bin/browser/BrowserAudio.vue.mjs +0 -258
- package/bin/browser/BrowserJsvLatex.vue.mjs +0 -145
- package/bin/types/utils/JsViewPlugin/JsvLatex/version.d.ts +0 -10
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.d.ts +0 -7
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +0 -78
- package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +0 -63
- package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +0 -78
- package/utils/JsViewPlugin/JsvLatex/version.js +0 -24
- package/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.ts +0 -36
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +0 -56
- package/utils/JsViewVueWidget/JsvPosterImage.vue +0 -105
- /package/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer-0.9.vue → JsvPlayerBrowser-0.9.vue} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fence, GapInfo } from "./Fence";
|
|
2
|
-
import { MetroTemplate, TemplateItem, MeasureInfo } from "./MetroTemplate"
|
|
2
|
+
import { MetroTemplate, TemplateItem, MeasureInfo } from "./MetroTemplate";
|
|
3
3
|
import { RangesModel, SingleRangeModel } from "../RangeModel";
|
|
4
4
|
import { VERTICAL, HORIZONTAL, FocusMoveType } from "../WidgetCommon";
|
|
5
5
|
|
|
@@ -7,29 +7,29 @@ const TAG = "CommonTemplateParser";
|
|
|
7
7
|
|
|
8
8
|
/** neighbor related interface */
|
|
9
9
|
interface Edge {
|
|
10
|
-
position: number
|
|
11
|
-
range: RangesModel
|
|
10
|
+
position: number;
|
|
11
|
+
range: RangesModel;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface EdgeInfo {
|
|
15
|
-
index: number
|
|
15
|
+
index: number;
|
|
16
16
|
edgeObj: {
|
|
17
|
-
leftEdge: Edge | null
|
|
18
|
-
rightEdge: Edge | null
|
|
19
|
-
topEdge: Edge | null
|
|
20
|
-
bottomEdge: Edge | null
|
|
21
|
-
}
|
|
17
|
+
leftEdge: Edge | null;
|
|
18
|
+
rightEdge: Edge | null;
|
|
19
|
+
topEdge: Edge | null;
|
|
20
|
+
bottomEdge: Edge | null;
|
|
21
|
+
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** get visible list related interface */
|
|
25
25
|
interface VisibleSearchConfigCommon {
|
|
26
|
-
resultStartIdx: number
|
|
27
|
-
resultEndIdx: number
|
|
28
|
-
enableBackwardSearching: boolean
|
|
29
|
-
enableForwardSearching: boolean
|
|
30
|
-
checkingStartLinePos: number
|
|
31
|
-
checkingEndLinePos: number
|
|
32
|
-
}
|
|
26
|
+
resultStartIdx: number;
|
|
27
|
+
resultEndIdx: number;
|
|
28
|
+
enableBackwardSearching: boolean;
|
|
29
|
+
enableForwardSearching: boolean;
|
|
30
|
+
checkingStartLinePos: number;
|
|
31
|
+
checkingEndLinePos: number;
|
|
32
|
+
}
|
|
33
33
|
|
|
34
34
|
interface VisibleSearchConfig {
|
|
35
35
|
searchDirect: number;
|
|
@@ -45,8 +45,7 @@ interface VisibleSearchConfig {
|
|
|
45
45
|
firstEndLineBlockIdx: number;
|
|
46
46
|
searchToBorder: boolean;
|
|
47
47
|
common: VisibleSearchConfigCommon;
|
|
48
|
-
}
|
|
49
|
-
|
|
48
|
+
}
|
|
50
49
|
|
|
51
50
|
function left(item: TemplateItem) {
|
|
52
51
|
return item.left;
|
|
@@ -63,16 +62,28 @@ function bottom(item: TemplateItem) {
|
|
|
63
62
|
|
|
64
63
|
class CommonMetroTemplate extends MetroTemplate {
|
|
65
64
|
private _FenceStack: Array<Fence>;
|
|
66
|
-
private _FenceEdge: { StartX: number
|
|
65
|
+
private _FenceEdge: { StartX: number; StartY: number };
|
|
67
66
|
private _NotOccupiedEdgeList: Array<EdgeInfo>;
|
|
68
67
|
|
|
69
|
-
constructor(
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
constructor(
|
|
69
|
+
direction: Symbol,
|
|
70
|
+
lineMax: number,
|
|
71
|
+
pageSize: number,
|
|
72
|
+
layoutType: string,
|
|
73
|
+
supportHistoryPath: boolean,
|
|
74
|
+
errorLogger: Function
|
|
75
|
+
) {
|
|
76
|
+
super(
|
|
77
|
+
direction,
|
|
78
|
+
lineMax,
|
|
79
|
+
pageSize,
|
|
80
|
+
layoutType,
|
|
81
|
+
supportHistoryPath,
|
|
82
|
+
errorLogger
|
|
83
|
+
);
|
|
72
84
|
this._FenceStack = [new Fence(0, 0, this.lineMax, 0)];
|
|
73
85
|
this._FenceEdge = { StartX: 0, StartY: 0 }; // 新的未占用边列表生成
|
|
74
86
|
this._NotOccupiedEdgeList = []; // 未占用边列表
|
|
75
|
-
|
|
76
87
|
}
|
|
77
88
|
|
|
78
89
|
public calculateNeighborWhenAddStop(): void {
|
|
@@ -140,8 +151,11 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
140
151
|
return found;
|
|
141
152
|
}
|
|
142
153
|
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
private _GetValidNeighborIndex(
|
|
155
|
+
srcItemId: number,
|
|
156
|
+
lastItemId: number,
|
|
157
|
+
neighborDirection: string
|
|
158
|
+
) {
|
|
145
159
|
const templateList = this.templateList;
|
|
146
160
|
let validId = -1;
|
|
147
161
|
const item = templateList[lastItemId];
|
|
@@ -203,10 +217,9 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
203
217
|
(item.neighborIndexList as any)[direction].length > 0 &&
|
|
204
218
|
!this._CheckIdsHasFocusable((item.neighborIndexList as any)[direction])
|
|
205
219
|
) {
|
|
206
|
-
const lastItemId =
|
|
207
|
-
(item.neighborIndexList as any)[direction][
|
|
220
|
+
const lastItemId = (item.neighborIndexList as any)[direction][
|
|
208
221
|
(item.neighborIndexList as any)[direction].length - 1
|
|
209
|
-
|
|
222
|
+
];
|
|
210
223
|
const idx = this._GetValidNeighborIndex(item.id, lastItemId, direction); // 查找其左右邻居
|
|
211
224
|
if (idx !== -1) {
|
|
212
225
|
(item.neighborIndexList as any)[direction] = []; // 清除无效项
|
|
@@ -216,7 +229,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
216
229
|
}
|
|
217
230
|
|
|
218
231
|
public addItemInner(itemObj: MeasureInfo): TemplateItem {
|
|
219
|
-
const templateItem: any =
|
|
232
|
+
const templateItem: any = this.getTemplateItem(itemObj);
|
|
220
233
|
// Layout template items
|
|
221
234
|
const fenceStack = this._FenceStack;
|
|
222
235
|
const itemWidth = templateItem.width;
|
|
@@ -263,6 +276,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
263
276
|
itemKeyPos = gapInfo.GapStart;
|
|
264
277
|
itemSecondPos = topFence.AheadOffset;
|
|
265
278
|
} else {
|
|
279
|
+
this.errorLogger(TAG, "parse template error");
|
|
266
280
|
throw new Error(
|
|
267
281
|
`${TAG} item size ${itemWidth}x${itemHeight} is greater than widget line max ${this.lineMax}`
|
|
268
282
|
);
|
|
@@ -305,8 +319,9 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
305
319
|
positionKey = "top";
|
|
306
320
|
sizeKey = "height";
|
|
307
321
|
}
|
|
308
|
-
const curPageStart =
|
|
309
|
-
|
|
322
|
+
const curPageStart = (this.templateList as any)[curPageHeadIndex][
|
|
323
|
+
positionKey
|
|
324
|
+
];
|
|
310
325
|
if (
|
|
311
326
|
templateItem[positionKey] + templateItem[sizeKey] >
|
|
312
327
|
curPageStart + this.pageSize
|
|
@@ -328,10 +343,14 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
328
343
|
let pre: number, cur: number;
|
|
329
344
|
if (this.direction === VERTICAL) {
|
|
330
345
|
cur = templateItem.height + templateItem.top;
|
|
331
|
-
pre =
|
|
346
|
+
pre =
|
|
347
|
+
this.templateList[this.tailItemIndex].height +
|
|
348
|
+
this.templateList[this.tailItemIndex].top;
|
|
332
349
|
} else {
|
|
333
350
|
cur = templateItem.width + templateItem.left;
|
|
334
|
-
pre =
|
|
351
|
+
pre =
|
|
352
|
+
this.templateList[this.tailItemIndex].width +
|
|
353
|
+
this.templateList[this.tailItemIndex].left;
|
|
335
354
|
}
|
|
336
355
|
if (cur >= pre) {
|
|
337
356
|
this.tailItemIndex = templateItem.index;
|
|
@@ -407,8 +426,12 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
407
426
|
}
|
|
408
427
|
|
|
409
428
|
/** get next item functions */
|
|
410
|
-
public getNextItem(
|
|
411
|
-
|
|
429
|
+
public getNextItem(
|
|
430
|
+
baseId: number,
|
|
431
|
+
vOffset: number,
|
|
432
|
+
hOffset: number,
|
|
433
|
+
moveType: number
|
|
434
|
+
): TemplateItem | null {
|
|
412
435
|
if (vOffset === 0 && hOffset === 0)
|
|
413
436
|
console.log("GetNextItem(): offset is 0");
|
|
414
437
|
// Forge.ThrowError("GetNextItem(): offset is 0");
|
|
@@ -436,11 +459,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
436
459
|
|
|
437
460
|
if (nextTemplateItem === null) {
|
|
438
461
|
// 在次方向的焦点移动才会loop
|
|
439
|
-
if (
|
|
440
|
-
isVertical &&
|
|
441
|
-
moveType & FocusMoveType.ROW_LOOP &&
|
|
442
|
-
hOffset != 0
|
|
443
|
-
) {
|
|
462
|
+
if (isVertical && moveType & FocusMoveType.ROW_LOOP && hOffset != 0) {
|
|
444
463
|
nextTemplateItem = this._GetNextLoopItem(
|
|
445
464
|
itemIndex,
|
|
446
465
|
hOffset,
|
|
@@ -459,19 +478,19 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
459
478
|
}
|
|
460
479
|
}
|
|
461
480
|
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
481
|
+
if (vOffset != 0 && moveType & FocusMoveType.ROW_FIND_NEAR) {
|
|
482
|
+
let rowNear = this._GetDirectionNearItem(
|
|
483
|
+
itemIndex,
|
|
484
|
+
vOffset > 0 ? "bottom" : "top"
|
|
485
|
+
);
|
|
467
486
|
if (rowNear) {
|
|
468
487
|
nextTemplateItem = rowNear;
|
|
469
488
|
}
|
|
470
|
-
} else if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
489
|
+
} else if (hOffset != 0 && moveType & FocusMoveType.COLUMN_FIND_NEAR) {
|
|
490
|
+
let colNear = this._GetDirectionNearItem(
|
|
491
|
+
itemIndex,
|
|
492
|
+
hOffset > 0 ? "right" : "left"
|
|
493
|
+
);
|
|
475
494
|
if (colNear) {
|
|
476
495
|
nextTemplateItem = colNear;
|
|
477
496
|
}
|
|
@@ -480,25 +499,36 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
480
499
|
return nextTemplateItem;
|
|
481
500
|
}
|
|
482
501
|
|
|
483
|
-
private _GetDirectionNearItem(
|
|
502
|
+
private _GetDirectionNearItem(
|
|
503
|
+
index: number,
|
|
504
|
+
direction: string,
|
|
505
|
+
mustFocusable: boolean = true
|
|
506
|
+
) {
|
|
484
507
|
const SEARCH_RANGE = 100;
|
|
485
508
|
let searchMin = Math.max(0, index - SEARCH_RANGE);
|
|
486
|
-
let searchMax = Math.min(
|
|
509
|
+
let searchMax = Math.min(
|
|
510
|
+
this.templateList.length - 1,
|
|
511
|
+
index + SEARCH_RANGE
|
|
512
|
+
);
|
|
487
513
|
let targetItem = this.templateList[index];
|
|
488
514
|
let tl = left(targetItem);
|
|
489
515
|
let tr = right(targetItem);
|
|
490
516
|
let tt = top(targetItem);
|
|
491
517
|
let tb = bottom(targetItem);
|
|
492
518
|
let info: {
|
|
493
|
-
item: TemplateItem | null
|
|
494
|
-
minMainDistance: number
|
|
495
|
-
minSubDistance: number
|
|
519
|
+
item: TemplateItem | null;
|
|
520
|
+
minMainDistance: number;
|
|
521
|
+
minSubDistance: number;
|
|
496
522
|
} = {
|
|
497
523
|
item: null,
|
|
498
524
|
minMainDistance: -1,
|
|
499
525
|
minSubDistance: -1,
|
|
500
526
|
};
|
|
501
|
-
const compare = (
|
|
527
|
+
const compare = (
|
|
528
|
+
item: TemplateItem,
|
|
529
|
+
getMainDistance: (i: TemplateItem) => number,
|
|
530
|
+
getSubDistance: (i: TemplateItem) => number
|
|
531
|
+
) => {
|
|
502
532
|
if (mustFocusable && !item.focusable) return;
|
|
503
533
|
const mainDistance = getMainDistance(item);
|
|
504
534
|
if (mainDistance <= 0) return;
|
|
@@ -507,11 +537,14 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
507
537
|
info.minMainDistance = mainDistance;
|
|
508
538
|
info.minSubDistance = subDistance;
|
|
509
539
|
info.item = item;
|
|
510
|
-
} else if (
|
|
540
|
+
} else if (
|
|
541
|
+
mainDistance === info.minMainDistance &&
|
|
542
|
+
subDistance < info.minSubDistance
|
|
543
|
+
) {
|
|
511
544
|
info.minSubDistance = subDistance;
|
|
512
545
|
info.item = item;
|
|
513
546
|
}
|
|
514
|
-
}
|
|
547
|
+
};
|
|
515
548
|
|
|
516
549
|
for (let i = searchMin; i <= searchMax; i++) {
|
|
517
550
|
const item = this.templateList[i];
|
|
@@ -519,37 +552,83 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
519
552
|
let ir = right(item);
|
|
520
553
|
let it = top(item);
|
|
521
554
|
let ib = bottom(item);
|
|
522
|
-
switch(direction) {
|
|
555
|
+
switch (direction) {
|
|
523
556
|
case "left":
|
|
524
|
-
compare(
|
|
525
|
-
|
|
557
|
+
compare(
|
|
558
|
+
item,
|
|
559
|
+
(item) => {
|
|
560
|
+
return tl - il;
|
|
561
|
+
},
|
|
526
562
|
(item) => {
|
|
527
|
-
return Math.min(
|
|
528
|
-
|
|
563
|
+
return Math.min(
|
|
564
|
+
Math.abs(tt - it),
|
|
565
|
+
Math.abs(tb - ib),
|
|
566
|
+
Math.abs(tt - ib),
|
|
567
|
+
Math.abs(tb - it)
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
);
|
|
529
571
|
break;
|
|
530
572
|
case "right":
|
|
531
|
-
compare(
|
|
532
|
-
|
|
533
|
-
(item) => {
|
|
573
|
+
compare(
|
|
574
|
+
item,
|
|
575
|
+
(item) => {
|
|
576
|
+
return ir - tr;
|
|
577
|
+
},
|
|
578
|
+
(item) => {
|
|
579
|
+
return Math.min(
|
|
580
|
+
Math.abs(tt - it),
|
|
581
|
+
Math.abs(tb - ib),
|
|
582
|
+
Math.abs(tt - ib),
|
|
583
|
+
Math.abs(tb - it)
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
);
|
|
534
587
|
break;
|
|
535
588
|
case "top":
|
|
536
|
-
compare(
|
|
537
|
-
|
|
538
|
-
(item) => {
|
|
589
|
+
compare(
|
|
590
|
+
item,
|
|
591
|
+
(item) => {
|
|
592
|
+
return tt - it;
|
|
593
|
+
},
|
|
594
|
+
(item) => {
|
|
595
|
+
return Math.min(
|
|
596
|
+
Math.abs(tl - il),
|
|
597
|
+
Math.abs(tr - ir),
|
|
598
|
+
Math.abs(tl - ir),
|
|
599
|
+
Math.abs(tr - il)
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
);
|
|
539
603
|
break;
|
|
540
604
|
case "bottom":
|
|
541
|
-
compare(
|
|
542
|
-
|
|
543
|
-
(item) => {
|
|
605
|
+
compare(
|
|
606
|
+
item,
|
|
607
|
+
(item) => {
|
|
608
|
+
return ib - tb;
|
|
609
|
+
},
|
|
610
|
+
(item) => {
|
|
611
|
+
return Math.min(
|
|
612
|
+
Math.abs(tl - il),
|
|
613
|
+
Math.abs(tr - ir),
|
|
614
|
+
Math.abs(tl - ir),
|
|
615
|
+
Math.abs(tr - il)
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
);
|
|
544
619
|
break;
|
|
545
620
|
}
|
|
546
621
|
}
|
|
547
622
|
return info.item;
|
|
548
623
|
}
|
|
549
624
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
625
|
+
private getNextItemInner(
|
|
626
|
+
index: number,
|
|
627
|
+
offset: number,
|
|
628
|
+
vertical: boolean,
|
|
629
|
+
useHistory: boolean,
|
|
630
|
+
checkAnchor: number = -1
|
|
631
|
+
): any {
|
|
553
632
|
const templateList: any = this.templateList;
|
|
554
633
|
const baseItem = templateList[index];
|
|
555
634
|
if (checkAnchor < 0) {
|
|
@@ -563,14 +642,14 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
563
642
|
checkAnchor =
|
|
564
643
|
baseItem.left +
|
|
565
644
|
baseItem.findNextAnchor.bottom *
|
|
566
|
-
|
|
645
|
+
(baseItem.width + baseItem.marginRight);
|
|
567
646
|
}
|
|
568
647
|
} else {
|
|
569
648
|
if (baseItem.findNextAnchor.top) {
|
|
570
649
|
checkAnchor =
|
|
571
650
|
baseItem.left +
|
|
572
651
|
baseItem.findNextAnchor.top *
|
|
573
|
-
|
|
652
|
+
(baseItem.width + baseItem.marginRight);
|
|
574
653
|
}
|
|
575
654
|
}
|
|
576
655
|
} else {
|
|
@@ -579,14 +658,14 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
579
658
|
checkAnchor =
|
|
580
659
|
baseItem.top +
|
|
581
660
|
baseItem.findNextAnchor.right *
|
|
582
|
-
|
|
661
|
+
(baseItem.height + baseItem.marginBottom);
|
|
583
662
|
}
|
|
584
663
|
} else {
|
|
585
664
|
if (baseItem.findNextAnchor.left) {
|
|
586
665
|
checkAnchor =
|
|
587
666
|
baseItem.top +
|
|
588
667
|
baseItem.findNextAnchor.left *
|
|
589
|
-
|
|
668
|
+
(baseItem.height + baseItem.marginBottom);
|
|
590
669
|
}
|
|
591
670
|
}
|
|
592
671
|
}
|
|
@@ -597,9 +676,15 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
597
676
|
} else {
|
|
598
677
|
// checkAncher可能在baseItem的范围之外, 将其调整至自身范围内
|
|
599
678
|
if (vertical) {
|
|
600
|
-
checkAnchor = Math.max(
|
|
679
|
+
checkAnchor = Math.max(
|
|
680
|
+
Math.min(checkAnchor, baseItem.left + baseItem.width - 1),
|
|
681
|
+
baseItem.left
|
|
682
|
+
);
|
|
601
683
|
} else {
|
|
602
|
-
checkAnchor = Math.max(
|
|
684
|
+
checkAnchor = Math.max(
|
|
685
|
+
Math.min(checkAnchor, baseItem.top + baseItem.height - 1),
|
|
686
|
+
baseItem.top
|
|
687
|
+
);
|
|
603
688
|
}
|
|
604
689
|
}
|
|
605
690
|
|
|
@@ -656,8 +741,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
656
741
|
nextIndex = neighborList[i];
|
|
657
742
|
const checkingItem = templateList[nextIndex];
|
|
658
743
|
if (
|
|
659
|
-
checkAnchor <=
|
|
660
|
-
checkingItem[posKey] + checkingItem[sizeKey] - 1 &&
|
|
744
|
+
checkAnchor <= checkingItem[posKey] + checkingItem[sizeKey] - 1 &&
|
|
661
745
|
checkAnchor >= checkingItem[posKey]
|
|
662
746
|
) {
|
|
663
747
|
if (
|
|
@@ -667,8 +751,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
667
751
|
) {
|
|
668
752
|
// horizontal lastItemIndex bottom 不记历史路径
|
|
669
753
|
templateList[index].pathHistory[direction] = nextIndex; // 更新历史路径
|
|
670
|
-
templateList[nextIndex].pathHistory[pathHistoryDirection] =
|
|
671
|
-
index; // 更新历史路径
|
|
754
|
+
templateList[nextIndex].pathHistory[pathHistoryDirection] = index; // 更新历史路径
|
|
672
755
|
}
|
|
673
756
|
found = true;
|
|
674
757
|
break;
|
|
@@ -715,7 +798,13 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
715
798
|
if (found) {
|
|
716
799
|
if (!templateList[nextIndex].focusable) {
|
|
717
800
|
// 如果是占位符,则查找占位符的下一个
|
|
718
|
-
return this.getNextItemInner(
|
|
801
|
+
return this.getNextItemInner(
|
|
802
|
+
nextIndex,
|
|
803
|
+
offset,
|
|
804
|
+
vertical,
|
|
805
|
+
false,
|
|
806
|
+
checkAnchor
|
|
807
|
+
);
|
|
719
808
|
}
|
|
720
809
|
return templateList[nextIndex];
|
|
721
810
|
}
|
|
@@ -736,7 +825,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
736
825
|
);
|
|
737
826
|
}
|
|
738
827
|
|
|
739
|
-
private _GetNearestItem(
|
|
828
|
+
private _GetNearestItem(
|
|
829
|
+
targetItemIndex: number,
|
|
830
|
+
itemIndexList: Array<number>
|
|
831
|
+
) {
|
|
740
832
|
let nearestIndex = -1,
|
|
741
833
|
minDistance = Number.POSITIVE_INFINITY;
|
|
742
834
|
let targetItem = this.templateList[targetItemIndex];
|
|
@@ -750,23 +842,34 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
750
842
|
return nearestIndex;
|
|
751
843
|
}
|
|
752
844
|
|
|
753
|
-
private _FindNearestByDirection(
|
|
845
|
+
private _FindNearestByDirection(
|
|
846
|
+
itemIndexList: Array<number>,
|
|
847
|
+
direction: string
|
|
848
|
+
) {
|
|
754
849
|
return itemIndexList.reduce((acc, cur) => {
|
|
755
850
|
const curItem = this.templateList[cur];
|
|
756
851
|
const accItem = this.templateList[acc];
|
|
757
|
-
if(direction == "left") {
|
|
852
|
+
if (direction == "left") {
|
|
758
853
|
return curItem.left < accItem.left ? cur : acc;
|
|
759
854
|
} else if (direction == "right") {
|
|
760
|
-
return curItem.left + curItem.width > accItem.left + accItem.width
|
|
855
|
+
return curItem.left + curItem.width > accItem.left + accItem.width
|
|
856
|
+
? cur
|
|
857
|
+
: acc;
|
|
761
858
|
} else if (direction == "top") {
|
|
762
859
|
return curItem.top < accItem.top ? cur : acc;
|
|
763
860
|
} else {
|
|
764
|
-
return curItem.top + curItem.height > accItem.top + accItem.height
|
|
861
|
+
return curItem.top + curItem.height > accItem.top + accItem.height
|
|
862
|
+
? cur
|
|
863
|
+
: acc;
|
|
765
864
|
}
|
|
766
865
|
}, itemIndexList[0]);
|
|
767
866
|
}
|
|
768
867
|
|
|
769
|
-
private _GetNextLoopItem(
|
|
868
|
+
private _GetNextLoopItem(
|
|
869
|
+
index: number,
|
|
870
|
+
offset: number,
|
|
871
|
+
isVertical: boolean
|
|
872
|
+
): TemplateItem | null {
|
|
770
873
|
const templateList = this.templateList;
|
|
771
874
|
const baseItem = templateList[index];
|
|
772
875
|
let searchDirection = isVertical ? "right" : "bottom";
|
|
@@ -782,7 +885,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
782
885
|
//目前的算法针对规整的列表, 瀑布流这种不对齐, 以及列表中存在非focusable项, 行为不可控
|
|
783
886
|
|
|
784
887
|
let curIndex = index;
|
|
785
|
-
let nextLevelNeighborList = this._GetTotalNeighbor(
|
|
888
|
+
let nextLevelNeighborList = this._GetTotalNeighbor(
|
|
889
|
+
curIndex,
|
|
890
|
+
startDirection
|
|
891
|
+
);
|
|
786
892
|
while (!nextLevelNeighborList || nextLevelNeighborList.length == 0) {
|
|
787
893
|
//查询同级的邻居
|
|
788
894
|
const sameLevelList = this._GetTotalNeighbor(curIndex, searchDirection);
|
|
@@ -821,8 +927,11 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
821
927
|
return focusableTarget >= 0 ? templateList[focusableTarget] : null;
|
|
822
928
|
}
|
|
823
929
|
|
|
824
|
-
public updateItemSize(
|
|
825
|
-
|
|
930
|
+
public updateItemSize(
|
|
931
|
+
index: number,
|
|
932
|
+
newSize: { width: number; height: number }
|
|
933
|
+
): void {
|
|
934
|
+
this.errorLogger(TAG, "updateItemSize is not supported.");
|
|
826
935
|
}
|
|
827
936
|
|
|
828
937
|
static intersects(s0: number, e0: number, s1: number, e1: number): boolean {
|
|
@@ -835,7 +944,8 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
835
944
|
public getVisibleItemList(
|
|
836
945
|
visibleStart: number,
|
|
837
946
|
visibleEnd: number,
|
|
838
|
-
baseId: number
|
|
947
|
+
baseId: number
|
|
948
|
+
): [number, number] {
|
|
839
949
|
if (visibleStart > visibleEnd || this.templateList.length == 0) {
|
|
840
950
|
// No visible item
|
|
841
951
|
return [-1, -1];
|
|
@@ -843,22 +953,30 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
843
953
|
|
|
844
954
|
visibleStart = Math.round(visibleStart);
|
|
845
955
|
visibleEnd = Math.round(visibleEnd);
|
|
846
|
-
let searchBaseItemIdx =
|
|
956
|
+
let searchBaseItemIdx =
|
|
957
|
+
typeof baseId == "number" ? this.id2Index(baseId) : 0;
|
|
847
958
|
if (searchBaseItemIdx < 0) searchBaseItemIdx = 0;
|
|
848
959
|
const vertical = this.direction === VERTICAL;
|
|
849
960
|
const sizeKey = vertical ? "height" : "width";
|
|
850
|
-
const posKey = vertical ? "top" : "left"
|
|
961
|
+
const posKey = vertical ? "top" : "left";
|
|
851
962
|
|
|
852
963
|
const visible = (s: number, e: number) => {
|
|
853
964
|
return CommonMetroTemplate.intersects(visibleStart, visibleEnd, s, e);
|
|
854
|
-
}
|
|
965
|
+
};
|
|
855
966
|
|
|
856
967
|
let baseItem = this.templateList[searchBaseItemIdx];
|
|
968
|
+
if (!baseItem) {
|
|
969
|
+
baseItem = this.templateList[0];
|
|
970
|
+
}
|
|
857
971
|
|
|
858
972
|
//寻找首个在范围内的item
|
|
859
|
-
let startIndex = 0,
|
|
973
|
+
let startIndex = 0,
|
|
974
|
+
endIndex = this.templateList.length - 1;
|
|
860
975
|
|
|
861
|
-
while (
|
|
976
|
+
while (
|
|
977
|
+
baseItem &&
|
|
978
|
+
!visible(baseItem[posKey], baseItem[posKey] + baseItem[sizeKey])
|
|
979
|
+
) {
|
|
862
980
|
if (baseItem[posKey] < visibleStart) {
|
|
863
981
|
startIndex = baseItem.index;
|
|
864
982
|
} else {
|
|
@@ -867,10 +985,14 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
867
985
|
if (Math.abs(startIndex - endIndex) <= 1) {
|
|
868
986
|
const startItem = this.templateList[startIndex];
|
|
869
987
|
const endItem = this.templateList[endIndex];
|
|
870
|
-
if (
|
|
988
|
+
if (
|
|
989
|
+
visible(startItem[posKey], startItem[posKey] + startItem[sizeKey])
|
|
990
|
+
) {
|
|
871
991
|
baseItem = startItem;
|
|
872
992
|
break;
|
|
873
|
-
} else if (
|
|
993
|
+
} else if (
|
|
994
|
+
visible(endItem[posKey], endItem[posKey] + endItem[sizeKey])
|
|
995
|
+
) {
|
|
874
996
|
baseItem = endItem;
|
|
875
997
|
break;
|
|
876
998
|
} else {
|
|
@@ -882,9 +1004,14 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
882
1004
|
top: tailItem.top,
|
|
883
1005
|
width: tailItem.width,
|
|
884
1006
|
height: tailItem.height,
|
|
885
|
-
}
|
|
1007
|
+
};
|
|
886
1008
|
}
|
|
887
|
-
console.log(
|
|
1009
|
+
console.log(
|
|
1010
|
+
"MetroWidget: can not find visible item",
|
|
1011
|
+
visibleStart,
|
|
1012
|
+
visibleEnd,
|
|
1013
|
+
tailInfo
|
|
1014
|
+
);
|
|
888
1015
|
return [-1, -1];
|
|
889
1016
|
}
|
|
890
1017
|
} else {
|
|
@@ -903,23 +1030,29 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
903
1030
|
if (n && n.length > 0) {
|
|
904
1031
|
for (let i of n) {
|
|
905
1032
|
let item = this.templateList[i];
|
|
906
|
-
if (
|
|
1033
|
+
if (
|
|
1034
|
+
visible(item[posKey], item[posKey] + item[sizeKey]) &&
|
|
1035
|
+
!visibleItem.has(i)
|
|
1036
|
+
) {
|
|
907
1037
|
visibleItem.add(i);
|
|
908
1038
|
addVisibleNeighbor(item);
|
|
909
1039
|
}
|
|
910
1040
|
}
|
|
911
1041
|
}
|
|
912
1042
|
}
|
|
913
|
-
}
|
|
1043
|
+
};
|
|
914
1044
|
addVisibleNeighbor(baseItem);
|
|
915
|
-
return [
|
|
916
|
-
Math.min(...visibleItem),
|
|
917
|
-
Math.max(...visibleItem),
|
|
918
|
-
]
|
|
1045
|
+
return [Math.min(...visibleItem), Math.max(...visibleItem)];
|
|
919
1046
|
}
|
|
920
1047
|
|
|
921
1048
|
/** neighbor calculate functions */
|
|
922
|
-
private _TryCalculateNeighborItem(
|
|
1049
|
+
private _TryCalculateNeighborItem(
|
|
1050
|
+
index: number,
|
|
1051
|
+
xPos: number,
|
|
1052
|
+
yPos: number,
|
|
1053
|
+
width: number,
|
|
1054
|
+
height: number
|
|
1055
|
+
) {
|
|
923
1056
|
const curNotOccupiedEdge: EdgeInfo = {
|
|
924
1057
|
index,
|
|
925
1058
|
edgeObj: {
|
|
@@ -1011,7 +1144,8 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1011
1144
|
// 临时邻居不触发fence edge
|
|
1012
1145
|
// 超过fenceedge范围,不作为对比相
|
|
1013
1146
|
if (
|
|
1014
|
-
!tmpNeighbor &&
|
|
1147
|
+
!tmpNeighbor &&
|
|
1148
|
+
crossEdgeObj.bottomEdge != null &&
|
|
1015
1149
|
crossEdgeObj.bottomEdge.position > this._FenceEdge.StartY
|
|
1016
1150
|
) {
|
|
1017
1151
|
continue;
|
|
@@ -1026,7 +1160,8 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1026
1160
|
// 临时邻居不触发fence edge
|
|
1027
1161
|
// 超过fenceedge范围,不作为对比相
|
|
1028
1162
|
if (
|
|
1029
|
-
!tmpNeighbor &&
|
|
1163
|
+
!tmpNeighbor &&
|
|
1164
|
+
crossEdgeObj.rightEdge &&
|
|
1030
1165
|
crossEdgeObj.rightEdge.position > this._FenceEdge.StartX
|
|
1031
1166
|
) {
|
|
1032
1167
|
continue;
|
|
@@ -1051,18 +1186,17 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1051
1186
|
//更新每个方向找到的邻居
|
|
1052
1187
|
if (neighbor[key] !== -1) {
|
|
1053
1188
|
const targetItem = this._NotOccupiedEdgeList[neighbor[key]];
|
|
1054
|
-
this._TryUpdateItemNeighbor(
|
|
1055
|
-
tmpNeighbor,
|
|
1056
|
-
key,
|
|
1057
|
-
crossItem,
|
|
1058
|
-
targetItem
|
|
1059
|
-
);
|
|
1189
|
+
this._TryUpdateItemNeighbor(tmpNeighbor, key, crossItem, targetItem);
|
|
1060
1190
|
}
|
|
1061
1191
|
}
|
|
1062
1192
|
}
|
|
1063
1193
|
}
|
|
1064
1194
|
|
|
1065
|
-
private _IfBlockedByOtherNeighbor(
|
|
1195
|
+
private _IfBlockedByOtherNeighbor(
|
|
1196
|
+
direction: string,
|
|
1197
|
+
crossItem: EdgeInfo,
|
|
1198
|
+
targetItem: EdgeInfo
|
|
1199
|
+
) {
|
|
1066
1200
|
//检查是否被其他neighbor遮挡
|
|
1067
1201
|
let positionKey = "top";
|
|
1068
1202
|
let sizeKey = "height";
|
|
@@ -1091,8 +1225,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1091
1225
|
|
|
1092
1226
|
let valid = true;
|
|
1093
1227
|
if (crossTemplateItem && targetTemplateItem) {
|
|
1094
|
-
const crossNeighborList =
|
|
1095
|
-
crossTemplateItem.neighborIndexList[direction];
|
|
1228
|
+
const crossNeighborList = crossTemplateItem.neighborIndexList[direction];
|
|
1096
1229
|
const targetStart = targetTemplateItem[positionKey];
|
|
1097
1230
|
const targetEnd = targetStart + targetTemplateItem[sizeKey] - 1;
|
|
1098
1231
|
for (let i = crossNeighborList.length - 1; i >= 0; i--) {
|
|
@@ -1105,12 +1238,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1105
1238
|
if (itemStart <= targetEnd && itemEnd >= targetStart) {
|
|
1106
1239
|
//有重叠, 检查两个item那个离 cross item 更近
|
|
1107
1240
|
if (
|
|
1108
|
-
Math.abs(
|
|
1109
|
-
item[subPositionKey] - crossTemplateItem[subPositionKey]
|
|
1110
|
-
) <
|
|
1241
|
+
Math.abs(item[subPositionKey] - crossTemplateItem[subPositionKey]) <
|
|
1111
1242
|
Math.abs(
|
|
1112
1243
|
targetTemplateItem[subPositionKey] -
|
|
1113
|
-
|
|
1244
|
+
crossTemplateItem[subPositionKey]
|
|
1114
1245
|
)
|
|
1115
1246
|
) {
|
|
1116
1247
|
//已有的neighbor更近
|
|
@@ -1126,7 +1257,11 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1126
1257
|
return valid;
|
|
1127
1258
|
}
|
|
1128
1259
|
|
|
1129
|
-
private _CheckNeighborItemMatching(
|
|
1260
|
+
private _CheckNeighborItemMatching(
|
|
1261
|
+
direction: string,
|
|
1262
|
+
crossItem: EdgeInfo,
|
|
1263
|
+
targetItem: EdgeInfo
|
|
1264
|
+
) {
|
|
1130
1265
|
const crossEdgeObj: any = crossItem.edgeObj;
|
|
1131
1266
|
const targetEdgeObj: any = targetItem.edgeObj;
|
|
1132
1267
|
let targetEdgeName = "rightEdge";
|
|
@@ -1164,14 +1299,11 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1164
1299
|
// targetEdgeObj[targetEdgeName].range.Clone().Ranges
|
|
1165
1300
|
// );
|
|
1166
1301
|
|
|
1167
|
-
const targetEdgeRangeClone =
|
|
1168
|
-
targetEdgeObj[targetEdgeName].range.Clone();
|
|
1302
|
+
const targetEdgeRangeClone = targetEdgeObj[targetEdgeName].range.Clone();
|
|
1169
1303
|
targetEdgeObj[targetEdgeName].range.ExcludeRanges(
|
|
1170
1304
|
crossEdgeObj[crossEdgeName].range
|
|
1171
1305
|
);
|
|
1172
|
-
crossEdgeObj[crossEdgeName].range.ExcludeRanges(
|
|
1173
|
-
targetEdgeRangeClone
|
|
1174
|
-
);
|
|
1306
|
+
crossEdgeObj[crossEdgeName].range.ExcludeRanges(targetEdgeRangeClone);
|
|
1175
1307
|
|
|
1176
1308
|
// console.log(
|
|
1177
1309
|
// "cchtest after exclude",
|
|
@@ -1209,15 +1341,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1209
1341
|
continue;
|
|
1210
1342
|
}
|
|
1211
1343
|
// 左边最近项
|
|
1212
|
-
if (
|
|
1213
|
-
crossEdgeObj.leftEdge !== null &&
|
|
1214
|
-
targetEdgeObj.rightEdge !== null
|
|
1215
|
-
) {
|
|
1344
|
+
if (crossEdgeObj.leftEdge !== null && targetEdgeObj.rightEdge !== null) {
|
|
1216
1345
|
if (
|
|
1217
1346
|
crossEdgeObj.leftEdge.position >= targetEdgeObj.rightEdge.position &&
|
|
1218
|
-
crossEdgeObj.leftEdge.range.IsInterAct(
|
|
1219
|
-
targetEdgeObj.rightEdge.range
|
|
1220
|
-
)
|
|
1347
|
+
crossEdgeObj.leftEdge.range.IsInterAct(targetEdgeObj.rightEdge.range)
|
|
1221
1348
|
) {
|
|
1222
1349
|
// 在其左侧,且有交叉,才为neighbor
|
|
1223
1350
|
// 计算最短距离
|
|
@@ -1238,15 +1365,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1238
1365
|
}
|
|
1239
1366
|
}
|
|
1240
1367
|
// 右边最近项
|
|
1241
|
-
if (
|
|
1242
|
-
crossEdgeObj.rightEdge !== null &&
|
|
1243
|
-
targetEdgeObj.leftEdge !== null
|
|
1244
|
-
) {
|
|
1368
|
+
if (crossEdgeObj.rightEdge !== null && targetEdgeObj.leftEdge !== null) {
|
|
1245
1369
|
if (
|
|
1246
1370
|
crossEdgeObj.rightEdge.position <= targetEdgeObj.leftEdge.position &&
|
|
1247
|
-
crossEdgeObj.rightEdge.range.IsInterAct(
|
|
1248
|
-
targetEdgeObj.leftEdge.range
|
|
1249
|
-
)
|
|
1371
|
+
crossEdgeObj.rightEdge.range.IsInterAct(targetEdgeObj.leftEdge.range)
|
|
1250
1372
|
) {
|
|
1251
1373
|
// 在其左侧,且有交叉,才为neighbor
|
|
1252
1374
|
// 计算最短距离
|
|
@@ -1268,15 +1390,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1268
1390
|
}
|
|
1269
1391
|
|
|
1270
1392
|
// 上边最近项
|
|
1271
|
-
if (
|
|
1272
|
-
crossEdgeObj.topEdge !== null &&
|
|
1273
|
-
targetEdgeObj.bottomEdge !== null
|
|
1274
|
-
) {
|
|
1393
|
+
if (crossEdgeObj.topEdge !== null && targetEdgeObj.bottomEdge !== null) {
|
|
1275
1394
|
if (
|
|
1276
1395
|
crossEdgeObj.topEdge.position >= targetEdgeObj.bottomEdge.position &&
|
|
1277
|
-
crossEdgeObj.topEdge.range.IsInterAct(
|
|
1278
|
-
targetEdgeObj.bottomEdge.range
|
|
1279
|
-
)
|
|
1396
|
+
crossEdgeObj.topEdge.range.IsInterAct(targetEdgeObj.bottomEdge.range)
|
|
1280
1397
|
) {
|
|
1281
1398
|
// 在其左侧,且有交叉,才为neighbor
|
|
1282
1399
|
// 计算最短距离
|
|
@@ -1297,15 +1414,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1297
1414
|
}
|
|
1298
1415
|
}
|
|
1299
1416
|
// 下边的最近项
|
|
1300
|
-
if (
|
|
1301
|
-
crossEdgeObj.bottomEdge !== null &&
|
|
1302
|
-
targetEdgeObj.topEdge !== null
|
|
1303
|
-
) {
|
|
1417
|
+
if (crossEdgeObj.bottomEdge !== null && targetEdgeObj.topEdge !== null) {
|
|
1304
1418
|
if (
|
|
1305
1419
|
crossEdgeObj.bottomEdge.position <= targetEdgeObj.topEdge.position &&
|
|
1306
|
-
crossEdgeObj.bottomEdge.range.IsInterAct(
|
|
1307
|
-
targetEdgeObj.topEdge.range
|
|
1308
|
-
)
|
|
1420
|
+
crossEdgeObj.bottomEdge.range.IsInterAct(targetEdgeObj.topEdge.range)
|
|
1309
1421
|
) {
|
|
1310
1422
|
// 在其左侧,且有交叉,才为neighbor
|
|
1311
1423
|
// 计算最短距离
|
|
@@ -1335,7 +1447,12 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1335
1447
|
};
|
|
1336
1448
|
}
|
|
1337
1449
|
|
|
1338
|
-
private _TryUpdateItemNeighbor(
|
|
1450
|
+
private _TryUpdateItemNeighbor(
|
|
1451
|
+
tmpNeighbor: boolean,
|
|
1452
|
+
direction: string,
|
|
1453
|
+
crossItem: EdgeInfo,
|
|
1454
|
+
targetItem: EdgeInfo
|
|
1455
|
+
) {
|
|
1339
1456
|
const keyMap: any = {
|
|
1340
1457
|
target: {
|
|
1341
1458
|
left: "right",
|
|
@@ -1353,7 +1470,10 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1353
1470
|
let crossNeighborKey = keyMap.cross[direction];
|
|
1354
1471
|
let targetNeighborKey = keyMap.target[direction];
|
|
1355
1472
|
if (!crossNeighborKey || !targetNeighborKey) {
|
|
1356
|
-
|
|
1473
|
+
this.errorLogger(
|
|
1474
|
+
"_TryUpdateItemNeighbor: undefined direction",
|
|
1475
|
+
direction
|
|
1476
|
+
);
|
|
1357
1477
|
}
|
|
1358
1478
|
|
|
1359
1479
|
const targetIndex = targetItem.index;
|
|
@@ -1366,24 +1486,72 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
1366
1486
|
templateList[targetIndex].neighborIndexList[targetNeighborKey].push(
|
|
1367
1487
|
crossItemIndex
|
|
1368
1488
|
);
|
|
1369
|
-
templateList[crossItemIndex].neighborIndexList[
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
templateList[targetIndex].tmpNeighborIndexList[targetNeighborKey] =
|
|
1489
|
+
templateList[crossItemIndex].neighborIndexList[crossNeighborKey].push(
|
|
1490
|
+
targetIndex
|
|
1491
|
+
);
|
|
1492
|
+
templateList[targetIndex].tmpNeighborIndexList[targetNeighborKey] = [];
|
|
1493
|
+
templateList[crossItemIndex].tmpNeighborIndexList[crossNeighborKey] =
|
|
1373
1494
|
[];
|
|
1374
|
-
templateList[crossItemIndex].tmpNeighborIndexList[
|
|
1375
|
-
crossNeighborKey
|
|
1376
|
-
] = [];
|
|
1377
1495
|
} else {
|
|
1378
|
-
templateList[targetIndex].tmpNeighborIndexList[
|
|
1379
|
-
|
|
1380
|
-
|
|
1496
|
+
templateList[targetIndex].tmpNeighborIndexList[targetNeighborKey].push(
|
|
1497
|
+
crossItemIndex
|
|
1498
|
+
);
|
|
1381
1499
|
templateList[crossItemIndex].tmpNeighborIndexList[
|
|
1382
1500
|
crossNeighborKey
|
|
1383
1501
|
].push(targetIndex);
|
|
1384
1502
|
}
|
|
1385
1503
|
}
|
|
1386
1504
|
}
|
|
1505
|
+
|
|
1506
|
+
public removeItemTo(index: number): void {
|
|
1507
|
+
if (index < 0 || index >= this.templateList.length) {
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
this.templateList.splice(index);
|
|
1511
|
+
//TODO 删除时需要计算fence和neighbor,这里通过一个新的对象重新计算来实现
|
|
1512
|
+
const tmpMetroTemplate = new CommonMetroTemplate(
|
|
1513
|
+
this.direction,
|
|
1514
|
+
this.lineMax,
|
|
1515
|
+
this.pageSize,
|
|
1516
|
+
this.layoutType,
|
|
1517
|
+
this.supportHistoryPath,
|
|
1518
|
+
this.errorLogger
|
|
1519
|
+
);
|
|
1520
|
+
for (let i of this.templateList) {
|
|
1521
|
+
tmpMetroTemplate.addItemInner(i);
|
|
1522
|
+
}
|
|
1523
|
+
tmpMetroTemplate.calculateNeighborWhenAddStop();
|
|
1524
|
+
|
|
1525
|
+
this._FenceStack = tmpMetroTemplate._FenceStack;
|
|
1526
|
+
this._FenceEdge = tmpMetroTemplate._FenceEdge;
|
|
1527
|
+
this._NotOccupiedEdgeList = tmpMetroTemplate._NotOccupiedEdgeList;
|
|
1528
|
+
//更新邻居信息
|
|
1529
|
+
for (let i of this.templateList) {
|
|
1530
|
+
i.neighborIndexList =
|
|
1531
|
+
tmpMetroTemplate.templateList[i.index].neighborIndexList;
|
|
1532
|
+
i.tmpNeighborIndexList =
|
|
1533
|
+
tmpMetroTemplate.templateList[i.index].tmpNeighborIndexList;
|
|
1534
|
+
i.pathHistory.left =
|
|
1535
|
+
i.pathHistory.left >= index ? -1 : i.pathHistory.left;
|
|
1536
|
+
i.pathHistory.right =
|
|
1537
|
+
i.pathHistory.right >= index ? -1 : i.pathHistory.right;
|
|
1538
|
+
i.pathHistory.top = i.pathHistory.top >= index ? -1 : i.pathHistory.top;
|
|
1539
|
+
i.pathHistory.bottom =
|
|
1540
|
+
i.pathHistory.bottom >= index ? -1 : i.pathHistory.bottom;
|
|
1541
|
+
}
|
|
1542
|
+
//更新idsMap
|
|
1543
|
+
for (let i = this.idsMap.length - 1; i >= 0; --i) {
|
|
1544
|
+
if (this.idsMap[i] >= index) {
|
|
1545
|
+
this.idsMap.splice(i, 1);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
this.tailItemIndex = this.templateList.length - 1;
|
|
1549
|
+
for (let uid in this.uidMap) {
|
|
1550
|
+
if ((this.uidMap as any)[uid].index >= index) {
|
|
1551
|
+
delete (this.uidMap as any)[uid];
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1387
1555
|
}
|
|
1388
1556
|
|
|
1389
|
-
export { CommonMetroTemplate };
|
|
1557
|
+
export { CommonMetroTemplate };
|