@shijiu/jsview-vue 2.2.201 → 2.2.373
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 -13
- package/bin/browser/BrowserApic2.vue.mjs +2 -13
- package/bin/browser/BrowserApicLib.mjs +24 -24
- package/bin/browser/BrowserAudio.vue.mjs +2 -10
- package/bin/browser/BrowserJsvFragShaderView.vue.mjs +21 -5
- package/bin/browser/BrowserJsvLatex.vue.mjs +39 -16
- package/bin/browser/BrowserPreload.vue.mjs +1 -5
- package/bin/browser/BrowserQrcode.vue.mjs +1 -5
- package/bin/browser/BrowserSpray.vue.mjs +2 -12
- package/bin/browser/BrowserTextureAnim.vue.mjs +2 -12
- package/bin/export-sfc.mjs +3 -3
- package/bin/jsview-vue-common.mjs +3 -3
- package/bin/jsview-vue.mjs +3216 -2086
- package/bin/types/JsViewEngineWidget/CheckType.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue.d.ts +37 -33
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +15 -2
- package/bin/types/JsViewEngineWidget/MetroWidget/Const.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +14 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +280 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +7 -1
- package/bin/types/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/Slide.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/SlotComponent.vue.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/VisibleInfo.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/RangeModel.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/Fence.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/index.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/WidgetCommon.d.ts +4 -0
- package/bin/types/JsViewEngineWidget/index.d.ts +5 -1
- package/bin/types/JsViewPlugin/JsvAccount/JsvAccount.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/AudioProxy.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/CheckType.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/Events.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/JsvAudio.vue.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/JsvAudioProxy.vue.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/PluginLoader.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/ScreenLockManager.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/index.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvAudio/version.d.ts +5 -0
- package/bin/types/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvLatex/Color.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +24 -0
- package/bin/types/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvLatex/PluginLoader.d.ts +4 -0
- package/bin/types/JsViewPlugin/JsvLatex/index.d.ts +5 -0
- package/bin/types/JsViewPlugin/JsvLatex/version.d.ts +4 -0
- package/bin/types/JsViewPlugin/index.d.ts +4 -0
- package/bin/types/JsViewVueTools/ConstSymbol.d.ts +4 -0
- package/bin/types/JsViewVueTools/DebugContentShellJBridge.d.ts +4 -0
- package/bin/types/JsViewVueTools/DebugTool.d.ts +4 -0
- package/bin/types/JsViewVueTools/DefaultKeyMap.d.ts +4 -0
- package/bin/types/JsViewVueTools/FeatureActive.d.ts +14 -0
- package/bin/types/JsViewVueTools/ForgeConstDefine.d.ts +4 -0
- package/bin/types/JsViewVueTools/ForgeHandles.d.ts +7 -3
- package/bin/types/JsViewVueTools/JsvDemoTester.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvDynamicCssStyle.d.ts +20 -1
- package/bin/types/JsViewVueTools/JsvDynamicKeyFrames.d.ts +21 -2
- package/bin/types/JsViewVueTools/JsvFederationTools.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvHashHistory.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvImpactTracer.d.ts +8 -4
- package/bin/types/JsViewVueTools/JsvPerformance.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvPreDownloader.d.ts +24 -2
- package/bin/types/JsViewVueTools/JsvRefTaker.d.ts +28 -3
- package/bin/types/JsViewVueTools/JsvRuntimeBridge.d.ts +50 -0
- package/bin/types/JsViewVueTools/JsvStyleClass.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvStyleSheetsDeclarer.d.ts +21 -1
- package/bin/types/JsViewVueTools/JsvTextTools.d.ts +85 -27
- package/bin/types/JsViewVueTools/JsvTextureDefines.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvTextureLoadTool.d.ts +67 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +30 -4
- package/bin/types/JsViewVueTools/JsvTextureStore/Store.d.ts +4 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/Texture.d.ts +4 -0
- package/bin/types/JsViewVueTools/NinePatchHelper.d.ts +5 -1
- package/bin/types/JsViewVueTools/TextureManagerTools.d.ts +11 -0
- package/bin/types/JsViewVueTools/TypeCheckAndSet.d.ts +4 -0
- package/bin/types/JsViewVueTools/index.d.ts +7 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/ActorControlBase.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/JsvActorMove.vue.d.ts +38 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvActorMove/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +27 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +28 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/GifData.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/NormalLoopTool.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/WebpData.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvClipDiv/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/ArcLineManager.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +21 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvDragBox/JsvDragBox.vue.d.ts +109 -0
- package/bin/types/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvDriftScope/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvEnableRenderBreak.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFilterView.vue.d.ts +19 -0
- package/bin/types/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue.d.ts +34 -0
- package/bin/types/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue.d.ts +106 -0
- package/bin/types/JsViewVueWidget/JsvFlexCell/index.d.ts +6 -2
- package/bin/types/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +48 -1
- package/bin/types/JsViewVueWidget/JsvFragShaderView/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +25 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +22 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/NexusNode.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvGrid.vue.d.ts +73 -0
- package/bin/types/JsViewVueWidget/JsvHole.d.ts +17 -0
- package/bin/types/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +14 -34
- package/bin/types/JsViewVueWidget/JsvInput/EditViewOperator.d.ts +48 -0
- package/bin/types/JsViewVueWidget/JsvInput/EditVisibleArea.d.ts +27 -0
- package/bin/types/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +64 -209
- package/bin/types/JsViewVueWidget/JsvInput/SharedDefine.d.ts +17 -0
- package/bin/types/JsViewVueWidget/JsvInput/SystemTextTools.d.ts +14 -0
- package/bin/types/JsViewVueWidget/JsvInput/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +20 -0
- package/bin/types/JsViewVueWidget/JsvLine/LineManager.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvLine/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvMarquee.vue.d.ts +21 -0
- package/bin/types/JsViewVueWidget/JsvMaskClipDiv.vue.d.ts +20 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/Constant.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/DataTree.d.ts +7 -1
- package/bin/types/JsViewVueWidget/JsvMindMap/Geometry.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +90 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvMindMap/rtree.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +24 -0
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +30 -0
- package/bin/types/JsViewVueWidget/JsvPieChart.vue.d.ts +17 -0
- package/bin/types/JsViewVueWidget/JsvPosterDiv.vue.d.ts +17 -0
- package/bin/types/JsViewVueWidget/JsvPosterImage.vue.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvPreload/BrowserPreload.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +42 -0
- package/bin/types/JsViewVueWidget/JsvPreload/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvProgressBar.vue.d.ts +19 -0
- package/bin/types/JsViewVueWidget/JsvQrcode/BrowserQrcode.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +25 -0
- package/bin/types/JsViewVueWidget/JsvQrcode/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvRadarChart.vue.d.ts +24 -0
- package/bin/types/JsViewVueWidget/JsvRipple/Constant.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +45 -0
- package/bin/types/JsViewVueWidget/JsvRipple/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScaleTextBox.vue.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSector.vue.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvSoundPool.d.ts +42 -0
- package/bin/types/JsViewVueWidget/JsvSpray/BrowserSpray.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +40 -0
- package/bin/types/JsViewVueWidget/JsvSpray/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +52 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue.d.ts +16 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/JsvSpriteTools.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/SpriteController.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSpriteAnim/sAnimationToken.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +39 -0
- package/bin/types/JsViewVueWidget/JsvSwiper/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +24 -0
- package/bin/types/JsViewVueWidget/JsvSwiper3D/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvTextBox.vue.d.ts +26 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/CommonType.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +7 -2
- package/bin/types/JsViewVueWidget/JsvTextureAnim/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvTouchModeSwitcher.vue.d.ts +100 -0
- package/bin/types/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +25 -0
- package/bin/types/JsViewVueWidget/JsvVisibleSensor/index.d.ts +4 -0
- package/bin/types/JsViewVueWidget/index.d.ts +6 -0
- package/bin/types/index.d.ts +4 -0
- package/index.d.ts +8 -0
- package/package.json +1 -1
- package/tools/config/toolkit.mjs +81 -0
- package/tools/config/tsconfig.json +1 -0
- package/tools/config/vite.config.ts +24 -14
- package/tools/jsview-vue-build.mjs +66 -21
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +6 -2
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +3 -1
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +12 -5
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +208 -84
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +15 -9
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +2 -2
- package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
- package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
- package/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.js +13 -3
- package/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue +27 -6
- package/utils/JsViewPlugin/JsvLatex/JsvLatex.vue +34 -28
- package/utils/JsViewPlugin/JsvLatex/index.js +22 -0
- package/utils/JsViewVueTools/FeatureActive.ts +84 -0
- package/utils/JsViewVueTools/ForgeHandles.ts +7 -3
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +2 -0
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.ts +2 -0
- package/utils/JsViewVueTools/JsvImpactTracer.js +2 -0
- package/utils/JsViewVueTools/JsvPreDownloader.ts +2 -1
- package/utils/JsViewVueTools/JsvRefTaker.js +1 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +67 -1
- package/utils/JsViewVueTools/JsvStyleClass.js +2 -0
- package/utils/JsViewVueTools/JsvStyleSheetsDeclarer.js +2 -0
- package/utils/JsViewVueTools/JsvTextTools.ts +223 -0
- package/utils/JsViewVueTools/JsvTextureLoadTool.ts +233 -0
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +4 -1
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +7 -3
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +1 -0
- package/utils/JsViewVueTools/TextureManagerTools.ts +17 -0
- package/utils/JsViewVueTools/index.js +3 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue +10 -2
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +12 -1
- package/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue +4 -2
- package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +2 -0
- package/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue +219 -0
- package/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue +11 -9
- package/utils/JsViewVueWidget/JsvFilterView.vue +2 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +5 -2
- package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +145 -0
- package/utils/JsViewVueWidget/JsvFlexCell/index.js +2 -5
- package/utils/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue +39 -12
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +210 -62
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +9 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue +2 -0
- package/utils/JsViewVueWidget/JsvGrid.vue +2 -0
- package/utils/JsViewVueWidget/JsvHole.js +2 -0
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +49 -45
- package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +320 -0
- package/utils/JsViewVueWidget/JsvInput/EditVisibleArea.ts +222 -0
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +281 -681
- package/utils/JsViewVueWidget/JsvInput/SharedDefine.ts +17 -0
- package/utils/JsViewVueWidget/JsvInput/SystemTextTools.ts +47 -0
- package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +2 -0
- package/utils/JsViewVueWidget/JsvMarquee.vue +2 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +2 -0
- package/utils/JsViewVueWidget/JsvMindMap/DataTree.ts +14 -1
- package/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue +277 -117
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +91 -68
- package/utils/JsViewVueWidget/JsvNinePatch.vue +5 -0
- package/utils/JsViewVueWidget/JsvPieChart.vue +2 -0
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +2 -0
- package/utils/JsViewVueWidget/JsvPosterImage.vue +2 -0
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -0
- package/utils/JsViewVueWidget/JsvProgressBar.vue +2 -0
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +10 -11
- package/utils/JsViewVueWidget/JsvRadarChart.vue +2 -0
- package/utils/JsViewVueWidget/JsvRipple/Constant.js +2 -2
- package/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue +3 -1
- package/utils/JsViewVueWidget/JsvScaleTextBox.vue +2 -0
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +9 -0
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +9 -0
- package/utils/JsViewVueWidget/JsvSector.vue +2 -0
- package/utils/JsViewVueWidget/JsvSoundPool.js +2 -0
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +30 -13
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +2 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue +2 -0
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +2 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +2 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +2 -4
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +44 -41
- package/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue +101 -0
- package/utils/JsViewVueWidget/JsvVideo.vue +2 -2
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +2 -0
- package/utils/JsViewVueWidget/index.js +2 -0
- package/utils/JsViewVueTools/JsvTextTools.js +0 -89
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define.mjs";
|
|
2
|
+
import { EditVisibleArea } from "./EditVisibleArea";
|
|
3
|
+
import { FontStyleDefine, InputType } from "./SharedDefine";
|
|
4
|
+
import { getTextDisplayWidth } from "./SystemTextTools";
|
|
5
|
+
|
|
6
|
+
export const CHAR_CODE_OF_0 = "0".charCodeAt(0);
|
|
7
|
+
export const CHAR_CODE_OF_9 = "9".charCodeAt(0);
|
|
8
|
+
|
|
9
|
+
function ifDigital(char: string) {
|
|
10
|
+
let char_code = char.charCodeAt(0);
|
|
11
|
+
return CHAR_CODE_OF_0 <= char_code && char_code <= CHAR_CODE_OF_9
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare interface CursorOperater {
|
|
15
|
+
startBlink: () => void;
|
|
16
|
+
stopBlink: (show: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare type TextChangedFunc = (final_text: string, dsp_text: string) => void;
|
|
20
|
+
declare type CursorMovedFunc = (new_text_start_index: number, new_cursor_left: number) => void;
|
|
21
|
+
declare type TextOverflowFunc = (origin_text: string, new_text: string) => void;
|
|
22
|
+
|
|
23
|
+
export class EditViewOperator {
|
|
24
|
+
private _EditViewHandle: any = null;
|
|
25
|
+
private _CursorHandle: CursorOperater | null = null;
|
|
26
|
+
private _EditViewId: number = -1;
|
|
27
|
+
private _CursorResumeTimeoutToken: number = -1;
|
|
28
|
+
|
|
29
|
+
private _InputType: number = 0;
|
|
30
|
+
private _FontStyle: FontStyleDefine | null = null
|
|
31
|
+
private _TextLeft: number = 0; // 文字在可视区域内的左坐标, 超出部分被视觉上clip掉
|
|
32
|
+
private _MaxInputLenth: number = 128;
|
|
33
|
+
private _TextReadOnly: boolean = false;
|
|
34
|
+
private _CurrentFullText: string = "";
|
|
35
|
+
private _CurrentDspText: string = "";
|
|
36
|
+
private _CurrentDspWith: number = 0;
|
|
37
|
+
|
|
38
|
+
private _CurrentCursorOffset: number = 0; // 相对可视区域的左边缘的焦点显示位置
|
|
39
|
+
|
|
40
|
+
private _IsFocus: boolean = false;
|
|
41
|
+
|
|
42
|
+
private _EditVisibleArea?: EditVisibleArea;
|
|
43
|
+
|
|
44
|
+
// Callback
|
|
45
|
+
private _OnTextChangedCallback: TextChangedFunc;
|
|
46
|
+
private _OnCursorMoved: CursorMovedFunc;
|
|
47
|
+
private _TextOverflowFunc: TextOverflowFunc | undefined;
|
|
48
|
+
|
|
49
|
+
constructor(
|
|
50
|
+
text_changed_callback: TextChangedFunc,
|
|
51
|
+
cursor_moved: CursorMovedFunc,
|
|
52
|
+
text_overflow: TextOverflowFunc | undefined = undefined
|
|
53
|
+
) {
|
|
54
|
+
this._OnTextChangedCallback = text_changed_callback;
|
|
55
|
+
this._OnCursorMoved = cursor_moved;
|
|
56
|
+
this._TextOverflowFunc = text_overflow;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 当前是否为焦点
|
|
60
|
+
// 焦点状态显示光标并激活输入状态
|
|
61
|
+
updateFocus(is_focus: boolean) {
|
|
62
|
+
if (is_focus) {
|
|
63
|
+
if (!this._IsFocus) {
|
|
64
|
+
// 非聚焦转化为聚焦状态
|
|
65
|
+
this._IsFocus = true;
|
|
66
|
+
this._CursorHandle?.startBlink();
|
|
67
|
+
if (this._EditViewHandle && !this._TextReadOnly) {
|
|
68
|
+
this._EditViewHandle.showIme(
|
|
69
|
+
this._InputType,
|
|
70
|
+
this._CurrentFullText,
|
|
71
|
+
this._CurrentCursorOffset
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
if (this._IsFocus) {
|
|
77
|
+
// 变为非聚焦状态
|
|
78
|
+
this._IsFocus = false;
|
|
79
|
+
// console.log("Input Blur");
|
|
80
|
+
if (this._EditViewHandle && !this._TextReadOnly) {
|
|
81
|
+
this._EditViewHandle.hideIme();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
showSoftIme() {
|
|
88
|
+
this._EditViewHandle.showIme(
|
|
89
|
+
this._InputType,
|
|
90
|
+
this._CurrentFullText,
|
|
91
|
+
this._CurrentCursorOffset
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
updateInputConfig(
|
|
96
|
+
box_width: number, box_height: number,
|
|
97
|
+
cursor_width: number,
|
|
98
|
+
font_style: FontStyleDefine,
|
|
99
|
+
input_type: number, max_input_lenth: number,
|
|
100
|
+
text_read_only: boolean) {
|
|
101
|
+
|
|
102
|
+
// format fontStyle
|
|
103
|
+
this._FontStyle = {
|
|
104
|
+
fontSize: !font_style.fontSize || isNaN(font_style.fontSize) ? Forge.TextUtils.sDefaultFontSize : font_style.fontSize,
|
|
105
|
+
fontFamily: !font_style.fontFamily ? Forge.TextUtils.sDefaultFontSize : font_style.fontFamily,
|
|
106
|
+
textAlign: font_style.textAlign,
|
|
107
|
+
fontStyle: font_style.fontStyle,
|
|
108
|
+
fontWeight: font_style.fontWeight
|
|
109
|
+
}
|
|
110
|
+
this._FontStyle = font_style;
|
|
111
|
+
this._InputType = input_type;
|
|
112
|
+
this._MaxInputLenth = max_input_lenth;
|
|
113
|
+
this._TextReadOnly = text_read_only;
|
|
114
|
+
|
|
115
|
+
this._EditVisibleArea = new EditVisibleArea(
|
|
116
|
+
box_width, box_height,
|
|
117
|
+
cursor_width,
|
|
118
|
+
font_style,
|
|
119
|
+
font_style.textAlign === "right"
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
generateView(): number {
|
|
124
|
+
// 构建EditControlView来处理输入
|
|
125
|
+
this._EditViewHandle = new Forge.EditControlView();
|
|
126
|
+
this._EditViewHandle.OnTextChanged = this._OnTextChanged.bind(this);
|
|
127
|
+
this._EditViewHandle.OnStatusChanged = this._OnStatusChanged.bind(this);
|
|
128
|
+
|
|
129
|
+
this._EditViewId = Forge.sViewStore.add(
|
|
130
|
+
new Forge.ViewInfo(this._EditViewHandle)
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return this._EditViewId;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
setCursorRef(cursor_ref: any) {
|
|
137
|
+
this._CursorHandle = cursor_ref;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
moveCursorOffset(moved_gap: number): boolean {
|
|
141
|
+
let cursor_moved = false;
|
|
142
|
+
|
|
143
|
+
if (moved_gap != 0) {
|
|
144
|
+
this._PauseCursorBlink(); // 开始移动后停止光标闪动
|
|
145
|
+
|
|
146
|
+
let pre_cursor_index = this._CurrentCursorOffset;
|
|
147
|
+
let new_cursor_index = pre_cursor_index + moved_gap;
|
|
148
|
+
|
|
149
|
+
// 控制边界
|
|
150
|
+
if (new_cursor_index < 0) {
|
|
151
|
+
new_cursor_index = 0;
|
|
152
|
+
}
|
|
153
|
+
if (new_cursor_index > this._CurrentFullText.length) {
|
|
154
|
+
new_cursor_index = this._CurrentFullText.length;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
cursor_moved = (pre_cursor_index != new_cursor_index);
|
|
158
|
+
|
|
159
|
+
if (cursor_moved) {
|
|
160
|
+
let new_text_left = this._EditVisibleArea!.calculateSlide(
|
|
161
|
+
this._CurrentDspText,
|
|
162
|
+
this._CurrentDspText,
|
|
163
|
+
this._CurrentDspWith,
|
|
164
|
+
this._CurrentDspWith,
|
|
165
|
+
new_cursor_index,
|
|
166
|
+
true
|
|
167
|
+
);
|
|
168
|
+
this._UpdateDispay(new_text_left, new_cursor_index)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return cursor_moved;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private _UpdateDispay(new_text_start_index: number, new_cursor_left: number) {
|
|
176
|
+
if (this._TextLeft != new_text_start_index || this._CurrentCursorOffset != new_cursor_left) {
|
|
177
|
+
this._TextLeft = new_text_start_index;
|
|
178
|
+
this._CurrentCursorOffset = new_cursor_left;
|
|
179
|
+
this._OnCursorMoved?.(this._TextLeft, this._EditVisibleArea!.getCursorPosition());
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
onUnmounted() {
|
|
184
|
+
if (this._EditViewId != -1) {
|
|
185
|
+
Forge.sViewStore.remove(this._EditViewId);
|
|
186
|
+
this._EditViewId = -1;
|
|
187
|
+
}
|
|
188
|
+
this._ClearCursorResumeTimer();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
private _PauseCursorBlink() {
|
|
192
|
+
// 暂停光标闪动,暂停800ms
|
|
193
|
+
|
|
194
|
+
this._CursorHandle?.stopBlink(true);
|
|
195
|
+
|
|
196
|
+
// reset cursor timer
|
|
197
|
+
this._ClearCursorResumeTimer();
|
|
198
|
+
this._CursorResumeTimeoutToken = setTimeout(() => {
|
|
199
|
+
this._CursorHandle?.startBlink();
|
|
200
|
+
}, 800);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private _ClearCursorResumeTimer() {
|
|
204
|
+
if (this._CursorResumeTimeoutToken) {
|
|
205
|
+
clearTimeout(this._CursorResumeTimeoutToken);
|
|
206
|
+
this._CursorResumeTimeoutToken = -1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// EditControlView当输入变化时的回调
|
|
211
|
+
private _OnTextChanged(text: string, cursor_index: number) {
|
|
212
|
+
if (typeof text != 'string' || text.length >= this._MaxInputLenth) {
|
|
213
|
+
// 非法输入或者输入限制,超输入限制,文字内容不改变
|
|
214
|
+
if (this._EditViewHandle && this._IsFocus) {
|
|
215
|
+
this._EditViewHandle.updateCursorOffset(
|
|
216
|
+
this._CurrentDspText,
|
|
217
|
+
this._CurrentCursorOffset
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (text.length > 0) {
|
|
224
|
+
const start = cursor_index - 1;
|
|
225
|
+
const end = cursor_index;
|
|
226
|
+
const add_text = text.slice(start, end);
|
|
227
|
+
if (add_text && !ifDigital(add_text) && this._InputType === InputType.NUMBER) {
|
|
228
|
+
// console.log(
|
|
229
|
+
// `onTextChanged add text failed, add_text:${add_text}, when input type is number!`
|
|
230
|
+
// );
|
|
231
|
+
// 输入内容非法,不更换内容
|
|
232
|
+
this._EditViewHandle!.updateCursorOffset(
|
|
233
|
+
this._CurrentDspText,
|
|
234
|
+
this._CurrentCursorOffset
|
|
235
|
+
);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 更新文字记录信息
|
|
241
|
+
let text_changed = this._CurrentFullText != text;
|
|
242
|
+
let origin_dsp_text = this._CurrentDspText;
|
|
243
|
+
let origin_dsp_width = this._CurrentDspWith;
|
|
244
|
+
if (text_changed) {
|
|
245
|
+
this._CurrentFullText = text;
|
|
246
|
+
// 更新显示字符串信息
|
|
247
|
+
if (this._InputType === Forge.TextInputType.PASSWORD) {
|
|
248
|
+
// password
|
|
249
|
+
this._CurrentDspText = text.replace(/\w/g, "*");
|
|
250
|
+
} else {
|
|
251
|
+
this._CurrentDspText = text;
|
|
252
|
+
}
|
|
253
|
+
this._CurrentDspWith = getTextDisplayWidth(this._CurrentDspText, this._FontStyle!);
|
|
254
|
+
} else {
|
|
255
|
+
// 仅由EditView发出来的光标移动事件
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// 在文字信息更新后,重算显示位置
|
|
259
|
+
let new_text_left = this._EditVisibleArea!.calculateSlide(
|
|
260
|
+
origin_dsp_text,
|
|
261
|
+
this._CurrentDspText,
|
|
262
|
+
origin_dsp_width,
|
|
263
|
+
this._CurrentDspWith,
|
|
264
|
+
cursor_index,
|
|
265
|
+
false
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
this._UpdateDispay(new_text_left, cursor_index);
|
|
269
|
+
|
|
270
|
+
if (text_changed) {
|
|
271
|
+
this._OnTextChangedCallback?.(this._CurrentFullText, this._CurrentDspText);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
private _OnStatusChanged() {
|
|
276
|
+
// console.log("OnStatusChanged status", status);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
public addText(text: string) {
|
|
280
|
+
if (this._InputType === InputType.NUMBER && !ifDigital(text)) {
|
|
281
|
+
// console.log(`The input data:${string} is not number`);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const pre_full_str = this._CurrentFullText;
|
|
285
|
+
const pre_index = this._CurrentCursorOffset;
|
|
286
|
+
|
|
287
|
+
const new_str =
|
|
288
|
+
pre_full_str.slice(0, pre_index) +
|
|
289
|
+
text +
|
|
290
|
+
pre_full_str.slice(pre_index);
|
|
291
|
+
|
|
292
|
+
if (new_str.length > this._MaxInputLenth) {
|
|
293
|
+
this._TextOverflowFunc?.(pre_full_str, new_str);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const new_index = pre_index + text.length;
|
|
298
|
+
this._OnTextChanged(new_str, new_index);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
public deleteText() {
|
|
302
|
+
const pre_full_str = this._CurrentFullText;
|
|
303
|
+
const pre_index = this._CurrentCursorOffset;
|
|
304
|
+
if (pre_index > 0) {
|
|
305
|
+
const new_str =
|
|
306
|
+
pre_full_str.slice(0, pre_index - 1) + pre_full_str.slice(pre_index);
|
|
307
|
+
const new_index = pre_index - 1;
|
|
308
|
+
this._OnTextChanged(new_str, new_index);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
public clearText() {
|
|
313
|
+
this._OnTextChanged("", 0);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
public replaceText(text: string) {
|
|
317
|
+
// 全部内容替换
|
|
318
|
+
this._OnTextChanged(text, text?.length);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { calculateCursorPosition } from "./SystemTextTools";
|
|
2
|
+
import { FontStyleDefine, MAX_WIDTH } from "./SharedDefine";
|
|
3
|
+
|
|
4
|
+
export class EditVisibleArea {
|
|
5
|
+
private _AreaWidth: number;
|
|
6
|
+
private _AreaHeight: number;
|
|
7
|
+
private _IsRightAlign: boolean;
|
|
8
|
+
private _TextLeft: number = 0;
|
|
9
|
+
private _CursorWidth: number = 0;
|
|
10
|
+
private _FontStyle: FontStyleDefine;
|
|
11
|
+
|
|
12
|
+
private _TextVisibleStartPos: number = 0; // 显示区域的起点是整段文字第几个像素上
|
|
13
|
+
private _TextVisibleEndPos: number = 0; // 显示区域的末尾是整段文字第几个像素上
|
|
14
|
+
private _VisibleAreaCurPos: number = 0; // 光标在整段文字的第几个像素上
|
|
15
|
+
|
|
16
|
+
constructor(area_width: number, area_height: number,
|
|
17
|
+
cursor_width: number,
|
|
18
|
+
font_style: FontStyleDefine,
|
|
19
|
+
is_right_align: boolean) {
|
|
20
|
+
|
|
21
|
+
this._CursorWidth = cursor_width;
|
|
22
|
+
this._FontStyle = font_style;
|
|
23
|
+
this._AreaWidth = area_width;
|
|
24
|
+
this._AreaHeight = area_height;
|
|
25
|
+
this._IsRightAlign = is_right_align;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getTextLeft(): number {
|
|
29
|
+
return this._TextLeft;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getCursorPosition(): number {
|
|
33
|
+
return this._VisibleAreaCurPos;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
calculateSlide(
|
|
37
|
+
pre_str: string, target_str: string,
|
|
38
|
+
pre_str_dsp_width: number, target_str_dsp_width: number, // 使用外部缓存,减少本地计算
|
|
39
|
+
cur_index: number, moved: boolean): number {
|
|
40
|
+
if (target_str.length === 0) {
|
|
41
|
+
// 当字符内容清空的场景
|
|
42
|
+
this._VisibleAreaCurPos = 0;
|
|
43
|
+
this._updateVisibleAreaPos(0, target_str_dsp_width);
|
|
44
|
+
return this._caculateTextLeft(target_str_dsp_width);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let new_left = this._TextLeft;
|
|
48
|
+
const current_cursor_position = calculateCursorPosition(
|
|
49
|
+
target_str,
|
|
50
|
+
cur_index,
|
|
51
|
+
target_str_dsp_width,
|
|
52
|
+
this._AreaHeight,
|
|
53
|
+
this._AreaHeight,
|
|
54
|
+
this._FontStyle
|
|
55
|
+
);
|
|
56
|
+
let option_mode = "op_vis_normal"; // 可视区域内移动
|
|
57
|
+
// 计算模式
|
|
58
|
+
if (pre_str.length > target_str.length) {
|
|
59
|
+
option_mode = "op_del"; // 字符删除
|
|
60
|
+
} else if (pre_str.length < target_str.length) {
|
|
61
|
+
option_mode = "op_add"; // 字符追加
|
|
62
|
+
} else {
|
|
63
|
+
if (current_cursor_position < this._VisibleAreaCurPos) {
|
|
64
|
+
option_mode = "op_move_left"; // 边界左移动
|
|
65
|
+
} else if (current_cursor_position > this._VisibleAreaCurPos) {
|
|
66
|
+
option_mode = "op_move_right"; // 边界右移动
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 根据用户动作,区分计算方法
|
|
71
|
+
switch (option_mode) {
|
|
72
|
+
case "op_del":
|
|
73
|
+
new_left = this._getLeftWithDelChar(
|
|
74
|
+
current_cursor_position,
|
|
75
|
+
target_str_dsp_width
|
|
76
|
+
);
|
|
77
|
+
break;
|
|
78
|
+
case "op_add":
|
|
79
|
+
new_left = this._getLeftWithAddChar(
|
|
80
|
+
current_cursor_position,
|
|
81
|
+
target_str_dsp_width
|
|
82
|
+
);
|
|
83
|
+
break;
|
|
84
|
+
case "op_move_left":
|
|
85
|
+
new_left = this._getLeftWithMoveLeft(
|
|
86
|
+
current_cursor_position,
|
|
87
|
+
target_str_dsp_width);
|
|
88
|
+
break;
|
|
89
|
+
case "op_move_right":
|
|
90
|
+
new_left = this._getLeftWithMoveRight(
|
|
91
|
+
current_cursor_position,
|
|
92
|
+
target_str_dsp_width);
|
|
93
|
+
break;
|
|
94
|
+
case "op_vis_normal":
|
|
95
|
+
default:
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 更新可视区域光标位置
|
|
100
|
+
this._VisibleAreaCurPos = current_cursor_position;
|
|
101
|
+
if (this._VisibleAreaCurPos == 2000) {
|
|
102
|
+
debugger;
|
|
103
|
+
}
|
|
104
|
+
this._TextLeft = new_left;
|
|
105
|
+
|
|
106
|
+
return new_left;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private _updateVisibleAreaPos(area_start_pos: number, target_str_dsp_width: number) {
|
|
110
|
+
if (target_str_dsp_width <= this._AreaWidth) {
|
|
111
|
+
this._TextVisibleStartPos = 0;
|
|
112
|
+
this._TextVisibleEndPos = target_str_dsp_width;
|
|
113
|
+
} else {
|
|
114
|
+
if (area_start_pos < 0) {
|
|
115
|
+
area_start_pos = 0;
|
|
116
|
+
}
|
|
117
|
+
this._TextVisibleStartPos = area_start_pos;
|
|
118
|
+
this._TextVisibleEndPos = this._TextVisibleStartPos + this._AreaWidth;
|
|
119
|
+
if (this._TextVisibleEndPos > target_str_dsp_width) {
|
|
120
|
+
// 到底,反推start
|
|
121
|
+
this._TextVisibleEndPos = target_str_dsp_width;
|
|
122
|
+
this._TextVisibleStartPos = this._TextVisibleEndPos - this._AreaWidth;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.log("_updateVisibleAreaPos new start=" + this._TextVisibleStartPos + " end=" + this._TextVisibleEndPos);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private _caculateTextLeft(target_str_dsp_width: number): number {
|
|
130
|
+
// 根据左右对齐原则,推到textLeft
|
|
131
|
+
if (target_str_dsp_width > this._AreaWidth) {
|
|
132
|
+
// 整体区域可填充,则以VisibleStartPos和0点对齐的left即可
|
|
133
|
+
return -this._TextVisibleStartPos;
|
|
134
|
+
} else {
|
|
135
|
+
if (this._IsRightAlign) {
|
|
136
|
+
return (this._AreaWidth - target_str_dsp_width);
|
|
137
|
+
} else {
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private _getLeftWithAddChar(
|
|
144
|
+
current_cursor_position: number,
|
|
145
|
+
target_str_dsp_width: number) {
|
|
146
|
+
let new_start: number;
|
|
147
|
+
|
|
148
|
+
if (this._IsRightAlign) {
|
|
149
|
+
// 右对齐场景,向左边移动光标(保持后端)
|
|
150
|
+
let end_range = this._TextVisibleEndPos - this._VisibleAreaCurPos;
|
|
151
|
+
new_start = current_cursor_position + end_range - this._AreaWidth;
|
|
152
|
+
} else {
|
|
153
|
+
// 左对齐场景,向右边移动光标(保持前端)
|
|
154
|
+
let start_range = this._VisibleAreaCurPos - this._TextVisibleStartPos;
|
|
155
|
+
new_start = current_cursor_position - start_range;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
this._updateVisibleAreaPos(new_start, target_str_dsp_width);
|
|
159
|
+
return this._caculateTextLeft(target_str_dsp_width);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private _getLeftWithDelChar(current_cursor_position: number, target_str_dsp_width: number) {
|
|
163
|
+
let new_start: number;
|
|
164
|
+
|
|
165
|
+
if (target_str_dsp_width >= this._AreaWidth) {
|
|
166
|
+
// 删除动作一般为backSpace驱动,带动右边的东西向左边移动更形象
|
|
167
|
+
// 除非前端可视区域不足时,才进行前端保持
|
|
168
|
+
let front_range = Math.floor((this._TextVisibleEndPos - this._TextVisibleStartPos) / 3);
|
|
169
|
+
if (this._VisibleAreaCurPos - front_range > this._TextVisibleStartPos) {
|
|
170
|
+
// 前端充足,向右移动,start不动
|
|
171
|
+
new_start = this._TextVisibleStartPos;
|
|
172
|
+
} else {
|
|
173
|
+
// 前端(左)不足,保持左边
|
|
174
|
+
let start_range = this._VisibleAreaCurPos - this._TextVisibleStartPos;
|
|
175
|
+
new_start = current_cursor_position - start_range;
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
new_start = 0; // 长度不够,归0处理
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
// 刷新可视区域段
|
|
183
|
+
this._updateVisibleAreaPos(new_start, target_str_dsp_width);
|
|
184
|
+
return this._caculateTextLeft(target_str_dsp_width);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private _getLeftWithMoveRight(current_cursor_position: number, target_str_dsp_width: number) {
|
|
188
|
+
let new_start: number;
|
|
189
|
+
|
|
190
|
+
let end_range = Math.floor(this._AreaWidth / 3);
|
|
191
|
+
if (this._VisibleAreaCurPos + end_range < this._TextVisibleEndPos) {
|
|
192
|
+
// 不到最后的1/3区域时,移动光标,保持Start位置
|
|
193
|
+
new_start = this._TextVisibleStartPos;
|
|
194
|
+
} else {
|
|
195
|
+
// 最后的1/3区域时,保持光标
|
|
196
|
+
let cursor_offset = current_cursor_position - this._VisibleAreaCurPos;
|
|
197
|
+
new_start = this._TextVisibleStartPos + cursor_offset;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// 刷新可视区域段
|
|
201
|
+
this._updateVisibleAreaPos(new_start, target_str_dsp_width);
|
|
202
|
+
return this._caculateTextLeft(target_str_dsp_width);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private _getLeftWithMoveLeft(current_cursor_position: number, target_str_dsp_width: number) {
|
|
206
|
+
let new_start: number;
|
|
207
|
+
|
|
208
|
+
let start_range = Math.floor(this._AreaWidth / 3);
|
|
209
|
+
if (this._VisibleAreaCurPos - start_range > this._TextVisibleStartPos) {
|
|
210
|
+
// 不到最后的1/3区域时,移动光标,保持Start位置
|
|
211
|
+
new_start = this._TextVisibleStartPos;
|
|
212
|
+
} else {
|
|
213
|
+
// 最后的1/3区域时,保持光标
|
|
214
|
+
let cursor_offset = current_cursor_position - this._VisibleAreaCurPos;
|
|
215
|
+
new_start = this._TextVisibleStartPos + cursor_offset;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// 刷新可视区域段
|
|
219
|
+
this._updateVisibleAreaPos(new_start, target_str_dsp_width);
|
|
220
|
+
return this._caculateTextLeft(target_str_dsp_width);
|
|
221
|
+
}
|
|
222
|
+
}
|