@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
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { JsvTextureStoreApi } from "../JsvTextureStore";
|
|
2
|
+
import CanvasTexture from "./CanvasTexture";
|
|
3
|
+
import { CustomPath } from "./Path";
|
|
4
|
+
|
|
5
|
+
type Data = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
interface Plot {
|
|
10
|
+
data: Data[];
|
|
11
|
+
lineWidth: number;
|
|
12
|
+
lineColor: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//曲线描画相关函数
|
|
16
|
+
// // 1. 处理边界:添加镜像虚拟点(优化首尾平滑)
|
|
17
|
+
// function addBoundaryPoints(data: Data[]): Data[] {
|
|
18
|
+
// const first = data[0];
|
|
19
|
+
// const last = data[data.length - 1];
|
|
20
|
+
// // 前加镜像点:2*first - second
|
|
21
|
+
// const prevVirtual = {
|
|
22
|
+
// x: 2 * first.x - data[1].x,
|
|
23
|
+
// y: 2 * first.y - data[1].y,
|
|
24
|
+
// };
|
|
25
|
+
// // 后加镜像点:2*last - secondLast
|
|
26
|
+
// const nextVirtual = {
|
|
27
|
+
// x: 2 * last.x - data[data.length - 2].x,
|
|
28
|
+
// y: 2 * last.y - data[data.length - 2].y,
|
|
29
|
+
// };
|
|
30
|
+
// return [prevVirtual, ...data, nextVirtual];
|
|
31
|
+
// }
|
|
32
|
+
// // 2. Catmull-Rom样条绘制平滑折线
|
|
33
|
+
// /**
|
|
34
|
+
// * Catmull-Rom样条插值
|
|
35
|
+
// * @param path {CustomPath} 路径对象
|
|
36
|
+
// * @param data {Data[]} 数据点数组,每个点包含 x 和 y 坐标
|
|
37
|
+
// * @param tension {Number} 张力参数,默认值 0
|
|
38
|
+
// */
|
|
39
|
+
// function drawCatmullRom(path: CustomPath, data: Data[], tension = 0): void {
|
|
40
|
+
// const points = addBoundaryPoints(data); // 含虚拟点的完整数据
|
|
41
|
+
// path.moveTo(data[0].x, data[0].y); // 起点(原始第一个点)
|
|
42
|
+
|
|
43
|
+
// for (let i = 1; i < data.length; i++) {
|
|
44
|
+
// const p0 = points[i - 1]; // 虚拟点/前一个点
|
|
45
|
+
// const p1 = points[i]; // 当前点(原始数据点)
|
|
46
|
+
// const p2 = points[i + 1]; // 下一个点(原始数据点)
|
|
47
|
+
// const p3 = points[i + 2]; // 虚拟点/后一个点
|
|
48
|
+
|
|
49
|
+
// // 计算贝塞尔控制点(含张力参数)
|
|
50
|
+
// const t = (1 - tension) / 6;
|
|
51
|
+
// const cp1x = p1.x + t * (p2.x - p0.x);
|
|
52
|
+
// const cp1y = p1.y + t * (p2.y - p0.y);
|
|
53
|
+
// const cp2x = p2.x - t * (p3.x - p1.x);
|
|
54
|
+
// const cp2y = p2.y - t * (p3.y - p1.y);
|
|
55
|
+
|
|
56
|
+
// // 绘制三次贝塞尔曲线(p1→p2)
|
|
57
|
+
// path.cubicTo(cp1x, cp1y, cp2x, cp2y, p2.x, p2.y);
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
|
|
61
|
+
// 3. 单调三次插值(Monotonic Cubic Interpolation)- 适合处理数据突变
|
|
62
|
+
/**
|
|
63
|
+
* 单调三次插值,避免在数据突变处产生凸起
|
|
64
|
+
* 基于 Fritsch-Carlson 算法,保持数据段的单调性
|
|
65
|
+
* @param path {CustomPath} 路径对象
|
|
66
|
+
* @param data {Data[]} 数据点数组,每个点包含 x 和 y 坐标
|
|
67
|
+
*/
|
|
68
|
+
function drawMonotonicCubic(path: CustomPath, data: Data[]): void {
|
|
69
|
+
if (data.length < 2) return;
|
|
70
|
+
if (data.length === 2) {
|
|
71
|
+
path.moveTo(data[0].x, data[0].y);
|
|
72
|
+
path.lineTo(data[1].x, data[1].y);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
path.moveTo(data[0].x, data[0].y);
|
|
77
|
+
|
|
78
|
+
const n = data.length - 1;
|
|
79
|
+
const dx: number[] = [];
|
|
80
|
+
const dy: number[] = [];
|
|
81
|
+
const m: number[] = []; // 每段的斜率
|
|
82
|
+
|
|
83
|
+
// 计算每段的斜率和距离
|
|
84
|
+
for (let i = 0; i < n; i++) {
|
|
85
|
+
dx[i] = data[i + 1].x - data[i].x;
|
|
86
|
+
dy[i] = data[i + 1].y - data[i].y;
|
|
87
|
+
m[i] = dx[i] !== 0 ? dy[i] / dx[i] : 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 计算每个内点的切线斜率(Fritsch-Carlson 方法)
|
|
91
|
+
const delta: number[] = new Array(n + 1);
|
|
92
|
+
|
|
93
|
+
// 边界点的斜率
|
|
94
|
+
delta[0] = m[0];
|
|
95
|
+
delta[n] = m[n - 1];
|
|
96
|
+
|
|
97
|
+
// 计算内点的斜率
|
|
98
|
+
for (let i = 1; i < n; i++) {
|
|
99
|
+
if (m[i - 1] * m[i] <= 0) {
|
|
100
|
+
// 如果相邻段斜率符号相反(有极值),设为0
|
|
101
|
+
delta[i] = 0;
|
|
102
|
+
} else {
|
|
103
|
+
// 使用加权调和平均,确保单调性
|
|
104
|
+
const w1 = 2 * dx[i] + dx[i - 1];
|
|
105
|
+
const w2 = 2 * dx[i - 1] + dx[i];
|
|
106
|
+
const denominator = w1 / m[i - 1] + w2 / m[i];
|
|
107
|
+
delta[i] = denominator !== 0 ? (w1 + w2) / denominator : 0;
|
|
108
|
+
|
|
109
|
+
// 确保斜率在合理范围内(3倍限制,保持单调性)
|
|
110
|
+
if (Math.abs(delta[i]) > 3 * Math.abs(m[i - 1])) {
|
|
111
|
+
delta[i] = 3 * m[i - 1];
|
|
112
|
+
}
|
|
113
|
+
if (Math.abs(delta[i]) > 3 * Math.abs(m[i])) {
|
|
114
|
+
delta[i] = 3 * m[i];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 绘制每段曲线
|
|
120
|
+
for (let i = 0; i < n; i++) {
|
|
121
|
+
const p0 = data[i];
|
|
122
|
+
const p1 = data[i + 1];
|
|
123
|
+
const dxi = dx[i];
|
|
124
|
+
|
|
125
|
+
// 获取当前段两端的切线斜率
|
|
126
|
+
const d0 = delta[i];
|
|
127
|
+
const d1 = delta[i + 1];
|
|
128
|
+
|
|
129
|
+
// 转换为三次贝塞尔曲线的控制点
|
|
130
|
+
// 对于三次 Hermite 插值,控制点位置为:
|
|
131
|
+
const cp1x = p0.x + dxi / 3;
|
|
132
|
+
const cp1y = p0.y + (d0 * dxi) / 3;
|
|
133
|
+
const cp2x = p1.x - dxi / 3;
|
|
134
|
+
const cp2y = p1.y - (d1 * dxi) / 3;
|
|
135
|
+
|
|
136
|
+
path.cubicTo(cp1x, cp1y, cp2x, cp2y, p1.x, p1.y);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// // 4. B样条插值
|
|
141
|
+
// /**
|
|
142
|
+
// * B样条插值(均匀B样条)
|
|
143
|
+
// * @param path {CustomPath} 路径对象
|
|
144
|
+
// * @param data {Data[]} 数据点数组
|
|
145
|
+
// * @param degree {number} B样条次数,默认3(三次B样条)
|
|
146
|
+
// */
|
|
147
|
+
// function drawBSpline(path: CustomPath, data: Data[], degree: number = 3): void {
|
|
148
|
+
// if (data.length < 2) return;
|
|
149
|
+
// if (data.length === 2) {
|
|
150
|
+
// path.moveTo(data[0].x, data[0].y);
|
|
151
|
+
// path.lineTo(data[1].x, data[1].y);
|
|
152
|
+
// return;
|
|
153
|
+
// }
|
|
154
|
+
|
|
155
|
+
// // 对于B样条,需要添加额外的控制点或使用近似方法
|
|
156
|
+
// // 这里使用简化的方法:将B样条转换为分段贝塞尔曲线
|
|
157
|
+
// path.moveTo(data[0].x, data[0].y);
|
|
158
|
+
|
|
159
|
+
// // 使用Catmull-Rom作为B样条的近似(当tension=0时,Catmull-Rom接近B样条)
|
|
160
|
+
// const points = addBoundaryPoints(data);
|
|
161
|
+
// for (let i = 1; i < data.length; i++) {
|
|
162
|
+
// const p0 = points[i - 1];
|
|
163
|
+
// const p1 = points[i];
|
|
164
|
+
// const p2 = points[i + 1];
|
|
165
|
+
// const p3 = points[i + 2];
|
|
166
|
+
|
|
167
|
+
// const t = 1 / 6;
|
|
168
|
+
// const cp1x = p1.x + t * (p2.x - p0.x);
|
|
169
|
+
// const cp1y = p1.y + t * (p2.y - p0.y);
|
|
170
|
+
// const cp2x = p2.x - t * (p3.x - p1.x);
|
|
171
|
+
// const cp2y = p2.y - t * (p3.y - p1.y);
|
|
172
|
+
|
|
173
|
+
// path.cubicTo(cp1x, cp1y, cp2x, cp2y, p2.x, p2.y);
|
|
174
|
+
// }
|
|
175
|
+
// }
|
|
176
|
+
|
|
177
|
+
// 5. 分段线性插值(简单折线)
|
|
178
|
+
/**
|
|
179
|
+
* 分段线性插值
|
|
180
|
+
* @param path {CustomPath} 路径对象
|
|
181
|
+
* @param data {Data[]} 数据点数组
|
|
182
|
+
*/
|
|
183
|
+
function drawLinear(path: CustomPath, data: Data[]): void {
|
|
184
|
+
if (data.length === 0) return;
|
|
185
|
+
path.moveTo(data[0].x, data[0].y);
|
|
186
|
+
for (let i = 1; i < data.length; i++) {
|
|
187
|
+
path.lineTo(data[i].x, data[i].y);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export class ChartHelper {
|
|
192
|
+
private width: number;
|
|
193
|
+
private height: number;
|
|
194
|
+
private xAxis: number[];
|
|
195
|
+
private yAxis: number[];
|
|
196
|
+
private originPosition: Data;
|
|
197
|
+
private canvasTexture: CanvasTexture;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @param w {number} 画布宽度
|
|
202
|
+
* @param h {number} 画布高度
|
|
203
|
+
* @param xAxis {number[]} x轴范围
|
|
204
|
+
* @param yAxis {number[]} y轴范围
|
|
205
|
+
* @throws {Error} 如果画布宽度或高度小于等于 0,或者 x 或 y 轴范围不是长度为 2 的数组,或者 x 或 y 轴范围不是升序
|
|
206
|
+
*/
|
|
207
|
+
constructor(w: number, h: number, xAxis: number[], yAxis: number[]) {
|
|
208
|
+
if (w <= 0 || h <= 0) {
|
|
209
|
+
throw new Error("Width and height must be greater than 0");
|
|
210
|
+
}
|
|
211
|
+
if (xAxis.length !== 2 || yAxis.length !== 2) {
|
|
212
|
+
throw new Error("X and y axis must be an array of 2 numbers");
|
|
213
|
+
}
|
|
214
|
+
if (xAxis[0] >= xAxis[1] || yAxis[0] >= yAxis[1]) {
|
|
215
|
+
throw new Error("X and y axis must be in ascending order");
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this.width = w;
|
|
219
|
+
this.height = h;
|
|
220
|
+
this.xAxis = xAxis;
|
|
221
|
+
this.yAxis = yAxis;
|
|
222
|
+
this.originPosition = {
|
|
223
|
+
x: ((0 - this.xAxis[0]) / (this.xAxis[1] - this.xAxis[0])) * this.width,
|
|
224
|
+
y:
|
|
225
|
+
this.height -
|
|
226
|
+
((0 - this.yAxis[0]) / (this.yAxis[1] - this.yAxis[0])) * this.height,
|
|
227
|
+
};
|
|
228
|
+
this.canvasTexture = JsvTextureStoreApi.canvasTexture(
|
|
229
|
+
this.width,
|
|
230
|
+
this.height
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @description 获取画布对象
|
|
236
|
+
* @returns {CanvasTexture} 画布对象
|
|
237
|
+
*/
|
|
238
|
+
getCanvas() {
|
|
239
|
+
return this.canvasTexture;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @description 获取原始数据点对应的坐标
|
|
244
|
+
* @returns {Data} 原始数据点对应的坐标
|
|
245
|
+
*/
|
|
246
|
+
getOriginPosition() {
|
|
247
|
+
return this.originPosition;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @description 根据数据获取绘制所需的position
|
|
252
|
+
* @param data {Data[]} 数据点数组,每个点包含 x 和 y 坐标
|
|
253
|
+
* @returns {Data[]} 数据点数组,每个点包含 x 和 y 坐标
|
|
254
|
+
*/
|
|
255
|
+
data2Pos(data: Data[]): Data[] {
|
|
256
|
+
const xAxisRange = this.xAxis[1] - this.xAxis[0];
|
|
257
|
+
const yAxisRange = this.yAxis[1] - this.yAxis[0];
|
|
258
|
+
return data.map((d) => ({
|
|
259
|
+
x: ((d.x - this.xAxis[0]) / xAxisRange) * this.width,
|
|
260
|
+
y: this.height - ((d.y - this.yAxis[0]) / yAxisRange) * this.height,
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* linePath参数说明
|
|
266
|
+
* @param data {Data[]} 数据点数组,每个点包含 x 和 y 坐标
|
|
267
|
+
* @param isBroken {boolean} 是否为折线
|
|
268
|
+
* @param close {number}
|
|
269
|
+
* 0: 不闭合,绘制线段用,
|
|
270
|
+
* 1: 闭合到x轴(自动绘制左右两端垂直于x轴的线段), 需要填充颜色时用
|
|
271
|
+
* 2: 闭合到y轴(自动绘制上下两端垂直于y轴的线段), 需要填充颜色时用
|
|
272
|
+
* @returns {CustomPath, Data[]} 路径对象和数据点数组,每个点包含 x 和 y 坐标
|
|
273
|
+
*/
|
|
274
|
+
linePath(
|
|
275
|
+
data: Data[],
|
|
276
|
+
isBroken: boolean = false,
|
|
277
|
+
close: number = 0
|
|
278
|
+
): { path: CustomPath; position: Data[] } | undefined {
|
|
279
|
+
const path = this.canvasTexture.customPath();
|
|
280
|
+
if (path) {
|
|
281
|
+
const posList = this.data2Pos(data);
|
|
282
|
+
|
|
283
|
+
if (isBroken) {
|
|
284
|
+
drawLinear(path, posList);
|
|
285
|
+
} else {
|
|
286
|
+
drawMonotonicCubic(path, posList);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (close == 1) {
|
|
290
|
+
//关闭到x轴
|
|
291
|
+
path.lineTo(posList[posList.length - 1].x, this.originPosition.y);
|
|
292
|
+
path.lineTo(posList[0].x, this.originPosition.y);
|
|
293
|
+
path.close();
|
|
294
|
+
} else if (close == 2) {
|
|
295
|
+
//关闭到y轴
|
|
296
|
+
path.lineTo(this.originPosition.x, posList[posList.length - 1].y);
|
|
297
|
+
path.lineTo(this.originPosition.x, posList[0].y);
|
|
298
|
+
path.close();
|
|
299
|
+
}
|
|
300
|
+
return { path, position: posList };
|
|
301
|
+
}
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
@@ -88,6 +88,21 @@ class DrawingPath {
|
|
|
88
88
|
this.finishedDraw = true;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
public fillWithLinearGradient(fromX: Number, fromY: Number, toX: Number, toY: Number, colorList: Array<String>, positionList: Array<Number>) {
|
|
92
|
+
this.drawCommandsRefs.push({
|
|
93
|
+
"cmd": Constants.CMD_PREPARE_PAINT,
|
|
94
|
+
"type": "fill_linear_gradient",
|
|
95
|
+
"x0": fromX,
|
|
96
|
+
"y0": fromY,
|
|
97
|
+
"x1": toX,
|
|
98
|
+
"y1": toY,
|
|
99
|
+
"clrs": colorList,
|
|
100
|
+
"stops": positionList
|
|
101
|
+
});
|
|
102
|
+
this.onFinishDraw(); // 调用继承类的完成处理执行绘制
|
|
103
|
+
this.finishedDraw = true;
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
protected onFinishDraw(): void {
|
|
92
107
|
// should override be extends class
|
|
93
108
|
}
|
|
@@ -184,6 +199,29 @@ export class CustomPath extends DrawingPath {
|
|
|
184
199
|
});
|
|
185
200
|
}
|
|
186
201
|
|
|
202
|
+
/**
|
|
203
|
+
* cubicTo
|
|
204
|
+
* 绘制三次贝塞尔曲线
|
|
205
|
+
*
|
|
206
|
+
* @param {Number} x0 控制点1的x坐标
|
|
207
|
+
* @param {Number} y0 控制点1的y坐标
|
|
208
|
+
* @param {Number} x1 控制点2的x坐标
|
|
209
|
+
* @param {Number} y1 控制点2的y坐标
|
|
210
|
+
* @param {Number} x2 目标点的x坐标
|
|
211
|
+
* @param {Number} y2 目标点的y坐标
|
|
212
|
+
*/
|
|
213
|
+
cubicTo(x0: Number, y0: Number, x1: Number, y1: Number, x2: Number, y2: Number) {
|
|
214
|
+
this.pathCommands?.push({
|
|
215
|
+
"cmd": Constants.PATH_CUBIC_TO,
|
|
216
|
+
"x0": x0,
|
|
217
|
+
"y0": y0,
|
|
218
|
+
"x1": x1,
|
|
219
|
+
"y1": y1,
|
|
220
|
+
"x2": x2,
|
|
221
|
+
"y2": y2
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
187
225
|
/**
|
|
188
226
|
* arcTo
|
|
189
227
|
* 绘制以(left, top, right, bottom)围城的矩形为横轴比的椭圆圆弧
|
|
@@ -13,6 +13,7 @@ export class CapturedTexture extends TextureBase {
|
|
|
13
13
|
private _Callback: CapturedCallback | null;
|
|
14
14
|
private _CaptureDiv: any;
|
|
15
15
|
private _Canceled: boolean = false;
|
|
16
|
+
private _Done: boolean = false;
|
|
16
17
|
private _PostProcessParams: any = null;
|
|
17
18
|
constructor(
|
|
18
19
|
captureDiv: any,
|
|
@@ -21,6 +22,10 @@ export class CapturedTexture extends TextureBase {
|
|
|
21
22
|
postProcessParams: any = null) {
|
|
22
23
|
super(null);
|
|
23
24
|
|
|
25
|
+
if (!captureDiv || !callback) {
|
|
26
|
+
throw new Error("CapturedTexture: captureDiv and callback are required");
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
// 激活引擎的功能支持
|
|
25
30
|
JsvUseFeature('JsvTextureStoreApi', FeatureNames.Capture2Texture);
|
|
26
31
|
|
|
@@ -33,13 +38,21 @@ export class CapturedTexture extends TextureBase {
|
|
|
33
38
|
// 清理对Callback和div的引用,防止泄露
|
|
34
39
|
cancel() {
|
|
35
40
|
if (!this._Canceled) {
|
|
36
|
-
|
|
41
|
+
if (!this._Done) {
|
|
42
|
+
// 补调用未完成的回调
|
|
43
|
+
this._Callback?.("", this.autoRecycle, 0, 0, true);
|
|
44
|
+
}
|
|
37
45
|
this._Callback = null;
|
|
38
46
|
this._CaptureDiv = null;
|
|
39
47
|
this._Canceled = true;
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
override recycle() {
|
|
52
|
+
this.cancel();
|
|
53
|
+
super.recycle();
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
override commit(): String {
|
|
44
57
|
this.textureRef = (ForgeHandles.TextureManager as any).GetCapturedTexture();
|
|
45
58
|
this._CaptureDiv.jsvGetProxyView(true).Capture2Texture(this.textureRef,
|
|
@@ -53,6 +66,8 @@ export class CapturedTexture extends TextureBase {
|
|
|
53
66
|
//由于自动回收是三帧后回收, 所以需要先添加到store
|
|
54
67
|
this.addToStore();
|
|
55
68
|
|
|
69
|
+
this._Done = true;
|
|
70
|
+
|
|
56
71
|
// 回调
|
|
57
72
|
this._Callback?.(
|
|
58
73
|
this.getStoreName(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*!
|
|
1
|
+
/*!
|
|
2
2
|
* @file JsvTextureStoreApi
|
|
3
3
|
*
|
|
4
4
|
* canvasTexture:
|
|
@@ -6,9 +6,22 @@
|
|
|
6
6
|
* a. commit() 接口调用之前可以任意绘制, commit之后就无法更改, commit之后才能使用, commit后绘制内容会被全局保存
|
|
7
7
|
* b. commit()的返回是其使用名称, 在div.backgroundImage和img.src中可使用, 格式: jsvtexturestore://commit返回名
|
|
8
8
|
* c.【非常重要】CanvasTexture是全局管理, commit()之后 不会自动释放, 需要手动调用 deleteTexture, 其参数是commit的返回值
|
|
9
|
+
*
|
|
9
10
|
* deleteTexture:
|
|
10
11
|
* 删除全局保存的texture(图片纹理)
|
|
11
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* capture2Texture:
|
|
14
|
+
* 对给定div做截图并生成一个Texture, 在回调函数中返回此Texture的访问名,
|
|
15
|
+
* 此访问名可以在 img.src 或者 div.backgroundImage 通过 "texturestore://访问名" 来使用
|
|
16
|
+
*
|
|
17
|
+
* getDominantColor:
|
|
18
|
+
* 获取图片的 dominant color
|
|
19
|
+
* 特殊说明: 此方法产生的内部CanvasTexture资源会自动回收,
|
|
20
|
+
* 虽然建议使用者在unmount时进行cancel, 但不是强制
|
|
21
|
+
*
|
|
22
|
+
* getChartHelper:
|
|
23
|
+
* 获取ChartHelper句柄,用于绘制二维统计图的多点折线(解决数据点之间的平滑衔接问题)
|
|
24
|
+
*
|
|
12
25
|
* CanvasTexture的接口(见 ./CanvasTexture/CanvasTexture.ts 的函数头):
|
|
13
26
|
* Path类型: 例如 rectPath, circlePath (见 ./CanvasTexture/Path.ts 的函数头)
|
|
14
27
|
* 通过 canvasTexture.xxxPath() 获得一个path操作对象,然后通过其接口进行游标运动形成绘制路径
|
|
@@ -17,39 +30,46 @@
|
|
|
17
30
|
*/
|
|
18
31
|
|
|
19
32
|
import CanvasTexture from "./CanvasTexture/CanvasTexture";
|
|
20
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
CapturedTexture,
|
|
35
|
+
CapturedCallback,
|
|
36
|
+
} from "./CapturedTexture/CapturedTexture";
|
|
21
37
|
import sStore from "./Store";
|
|
22
|
-
import {
|
|
38
|
+
import { ChartHelper } from "./CanvasTexture/DrawHelper";
|
|
39
|
+
import { BitPalette } from "./BitPalette/BitPalette";
|
|
23
40
|
|
|
24
41
|
let sJsvTextureConst = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
42
|
+
LEFT: 1,
|
|
43
|
+
TOP: 2,
|
|
44
|
+
RIGHT: 3,
|
|
45
|
+
BOTTOM: 4,
|
|
46
|
+
};
|
|
30
47
|
|
|
31
48
|
let sTextureStoreApi = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
/**
|
|
50
|
+
* canvasTexture
|
|
51
|
+
* 创建CanvasTexture句柄,执行commit()后, 获取访问名(访问名规则: 输入参数 baseName + 分配id)
|
|
52
|
+
* 可以在 img.src 或者 div.backgroundImage 通过 "texturestore://访问名" 来使用
|
|
53
|
+
*
|
|
54
|
+
* @param {int} width 此Canvas画布的宽度
|
|
55
|
+
* @param {int} height 此Canvas画布的高度
|
|
56
|
+
* @param {String|null} baseName 可选, 访问名的前缀信息
|
|
57
|
+
* @return {CanvasTexture}
|
|
58
|
+
*/
|
|
59
|
+
canvasTexture: (
|
|
60
|
+
width: Number,
|
|
61
|
+
height: Number,
|
|
62
|
+
baseName: String | null = null
|
|
63
|
+
): CanvasTexture => {
|
|
64
|
+
return new CanvasTexture(width, height, baseName);
|
|
65
|
+
},
|
|
45
66
|
|
|
46
|
-
|
|
67
|
+
/**
|
|
47
68
|
* capture2Texture
|
|
48
69
|
* 对给定div做截图并生成一个Texture, 在回调函数中返回此Texture的访问名,
|
|
49
70
|
* 此访问名可以在 img.src 或者 div.backgroundImage 通过 "texturestore://访问名" 来使用
|
|
50
|
-
* 注意: PC模拟环境下,无法截取运动物体的中间状态,但盒子端可以正常截取
|
|
51
71
|
*
|
|
52
|
-
* 关于 autoRecycle:
|
|
72
|
+
* 关于 autoRecycle: 此api生成的CanvasTexture根据这个标识有自动释放功能
|
|
53
73
|
* true(默认值): 收到callback的访问名后,请立即设置给使用的地方,若此宏任务结束(其触发的所有微任务全完成后)时,
|
|
54
74
|
* 若资源未被div和img使用,则会自动回收,回收后此访问名对应内容为黑屏
|
|
55
75
|
* false: 截图资源永久存在,可被反复使用,直到 JsvTextureStoreApi.deleteTexture(访问名) 进行清理
|
|
@@ -62,59 +82,124 @@ let sTextureStoreApi = {
|
|
|
62
82
|
* height: number) => void // 截取div的高
|
|
63
83
|
* @param {boolean} autoRecycle 可选, 是否当无div/img引用时会自动释放
|
|
64
84
|
* true默认值: 此场景在回调时要立刻赋值给响应式变量控制template的节点立刻使用(并且不是v-if=false的节点),
|
|
65
|
-
|
|
66
|
-
|
|
85
|
+
否则会自动释放掉, 此时, texture当使用它的template节点从dom树中去掉的时候(v-if=false也算)会自动释放,
|
|
86
|
+
不需要主动调用deleteTexture释放.
|
|
67
87
|
false: 此场景在callback收到资源名后, 需要使用完毕后调用 deleteTexture 手动释放
|
|
68
|
-
|
|
88
|
+
在手动释放之前,可以赋给其他div/img来复用
|
|
69
89
|
* @param {any} postProcessParams 可选, 截图处理的参数
|
|
70
90
|
* @return {CapturedTexture} 用于cancel的句柄,当cancel时,会清理对div和Callback的引用
|
|
71
91
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
capture2Texture: (
|
|
93
|
+
captureDiv: any,
|
|
94
|
+
callback: CapturedCallback,
|
|
95
|
+
autoRecycle: boolean = true,
|
|
96
|
+
postProcessParams: any = null
|
|
97
|
+
): CapturedTexture => {
|
|
98
|
+
let texture = new CapturedTexture(
|
|
99
|
+
captureDiv,
|
|
100
|
+
callback,
|
|
101
|
+
autoRecycle,
|
|
102
|
+
postProcessParams
|
|
103
|
+
);
|
|
104
|
+
texture.commit();
|
|
77
105
|
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
return texture;
|
|
107
|
+
},
|
|
80
108
|
|
|
81
|
-
|
|
82
|
-
|
|
109
|
+
/**
|
|
110
|
+
* deleteTexture
|
|
111
|
+
* 删除访问名对应的texture资源
|
|
112
|
+
*
|
|
113
|
+
* @param {String} accessName 此Texture的访问名,访问名来自: CanvasTexture.commit 或 capture2Texture 的回调
|
|
114
|
+
*/
|
|
115
|
+
deleteTexture: (accessName: String) => {
|
|
116
|
+
let textureRef = sStore.getFromStore(accessName);
|
|
117
|
+
if (textureRef) {
|
|
118
|
+
// 释放native端的texture实体
|
|
119
|
+
textureRef.recycle();
|
|
120
|
+
}
|
|
121
|
+
},
|
|
83
122
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
123
|
+
/**
|
|
124
|
+
* getDominantColor
|
|
125
|
+
* 获取图片的 dominant color
|
|
126
|
+
* 特殊说明: 此方法产生的内部CanvasTexture资源会自动回收,
|
|
127
|
+
* 虽然建议使用者在unmount时进行cancel, 但不是强制
|
|
128
|
+
*
|
|
129
|
+
* @param src 图片的src
|
|
130
|
+
* @param callback 回调函数, 参数: info
|
|
131
|
+
* @return 用于cancel的句柄的函数,
|
|
132
|
+
* 例如 let c = JsvTextureStoreApi.getDominantColor(src, callback); c(); 为资源清理
|
|
133
|
+
* 若callback前清理, 则callback不会被调用
|
|
134
|
+
*/
|
|
135
|
+
getDominantColor: (src: string, callback: (info: any) => void) => {
|
|
136
|
+
let bitPalette = sTextureStoreApi.getBitPalette(src, async ()=>{
|
|
137
|
+
let result: any = await bitPalette.Ctrl!.getDomainColorSync();
|
|
138
|
+
bitPalette.recycle();
|
|
139
|
+
let cbk_ret = null;
|
|
140
|
+
if (result) {
|
|
141
|
+
cbk_ret = {dominantColors: JSON.parse(result)};
|
|
142
|
+
}
|
|
143
|
+
callback(cbk_ret);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// 返回cancel的句柄
|
|
147
|
+
return ()=>{
|
|
148
|
+
bitPalette.recycle();
|
|
149
|
+
};
|
|
150
|
+
},
|
|
97
151
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* getBitPalette
|
|
155
|
+
* 获取 BitPalette 实例
|
|
156
|
+
*
|
|
157
|
+
* 用法示例:
|
|
158
|
+
*
|
|
159
|
+
* let bp = JsvTextureStoreApi.getBitPalette(src);
|
|
160
|
+
* await bp.Ready;
|
|
161
|
+
* let result = await bp.Ctrl?.doCommand(cmd_id, {...});
|
|
162
|
+
*
|
|
163
|
+
* 说明:
|
|
164
|
+
* - 该方法会立即返回 BitPalette 实例,但 BitPalette 数据初始化可能为异步过程。
|
|
165
|
+
* - 若在await Ready之前直接操作 bitPalette,其状态未必已完成加载。
|
|
166
|
+
*
|
|
167
|
+
* 特别注意: 不再使用时, 请务必调用 bitPalette.recycle() 释放资源, recycle接口不需要等待Ready完成
|
|
168
|
+
*
|
|
169
|
+
* @param {string} src 图片的 src 链接, 可以是 "jsvtexturestore://访问名" 或者 图片的url
|
|
170
|
+
* @return {BitPalette} BitPalette 实例
|
|
171
|
+
*/
|
|
172
|
+
getBitPalette: (src: string, callback: () => void): BitPalette => {
|
|
173
|
+
let bitPalette = new BitPalette(src, callback);
|
|
174
|
+
return bitPalette;
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* getChartHelper
|
|
179
|
+
* 获取ChartHelper句柄,用于绘制二维统计图
|
|
180
|
+
*
|
|
181
|
+
* @param {number} width 画布宽度
|
|
182
|
+
* @param {number} height 画布高度
|
|
183
|
+
* @param {number[]} xAxis x轴范围(可以为负数到正数的范围)
|
|
184
|
+
* @param {number[]} yAxis y轴范围(可以为负数到正数的范围)
|
|
185
|
+
* @throws {Error} 如果画布宽度或高度小于等于 0,或者 x 或 y 轴范围不是长度为 2 的数组,或者 x 或 y 轴范围不是升序
|
|
186
|
+
* @return {ChartHelper} ChartHelper接口说明见 ./CanvasTexture/DrawHelper.ts 的 ChartHelper 类
|
|
187
|
+
*/
|
|
188
|
+
getChartHelper(
|
|
189
|
+
width: number,
|
|
190
|
+
height: number,
|
|
191
|
+
xAxis: number[],
|
|
192
|
+
yAxis: number[]
|
|
193
|
+
): ChartHelper {
|
|
194
|
+
return new ChartHelper(width, height, xAxis, yAxis);
|
|
195
|
+
},
|
|
196
|
+
};
|
|
112
197
|
|
|
113
198
|
export enum CaptureProcessType {
|
|
114
|
-
|
|
115
|
-
|
|
199
|
+
Blur = 1,
|
|
200
|
+
}
|
|
116
201
|
|
|
117
202
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
203
|
+
sTextureStoreApi as JsvTextureStoreApi,
|
|
204
|
+
sJsvTextureConst as JsvTextureConst,
|
|
205
|
+
};
|
|
@@ -25,7 +25,7 @@ class JsvTextureStore {
|
|
|
25
25
|
this.textureMap.delete(storeName);
|
|
26
26
|
return textureBaseRef;
|
|
27
27
|
} else {
|
|
28
|
-
console.
|
|
28
|
+
console.warn(`Warn: name=${storeName} not in map, maybe auto recycled`);
|
|
29
29
|
return undefined;
|
|
30
30
|
}
|
|
31
31
|
}
|