@realsee/dnalogel 2.0.0-alpha.7 → 2.0.0-beta.36
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/README.md +78 -28
- package/components/index.js +1450 -0
- package/dist/CSS3DRenderPlugin/Plugin.d.ts +49 -0
- package/dist/CSS3DRenderPlugin/index.d.ts +4 -0
- package/dist/CSS3DRenderPlugin/index.js +234 -0
- package/dist/CSS3DRenderPlugin/utils/createResizeObserver.d.ts +7 -0
- package/dist/CameraMovementPlugin/CameraMovementPlugin.d.ts +7 -0
- package/dist/CameraMovementPlugin/index.d.ts +5 -0
- package/dist/CameraMovementPlugin/index.js +302 -0
- package/dist/CameraMovementPlugin/typing.d.ts +68 -0
- package/dist/ItemLabelPlugin/Plugin.d.ts +4 -0
- package/dist/ItemLabelPlugin/events.type.d.ts +9 -0
- package/dist/ItemLabelPlugin/index.d.ts +9 -0
- package/dist/ItemLabelPlugin/index.js +941 -0
- package/dist/ItemLabelPlugin/typings.d.ts +59 -0
- package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/dist/ItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/dist/ModelChassisCompassPlugin/Plugin.d.ts +19 -0
- package/dist/ModelChassisCompassPlugin/index.d.ts +4 -0
- package/dist/ModelChassisCompassPlugin/index.js +145 -0
- package/dist/ModelEntryDoorGuidePlugin/Plugin.d.ts +26 -0
- package/dist/ModelEntryDoorGuidePlugin/index.d.ts +4 -0
- package/dist/ModelEntryDoorGuidePlugin/index.js +196 -0
- package/dist/ModelItemLabelPlugin/ModelItemLabelPlugin.d.ts +4 -0
- package/dist/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/dist/ModelItemLabelPlugin/index.d.ts +9 -0
- package/dist/ModelItemLabelPlugin/index.js +674 -0
- package/dist/ModelItemLabelPlugin/typings.d.ts +56 -0
- package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ModelRoomLabelPlugin/Assets/roomLabelBg.d.ts +1 -0
- package/dist/ModelRoomLabelPlugin/Controller.d.ts +36 -0
- package/dist/ModelRoomLabelPlugin/index.d.ts +12 -0
- package/dist/ModelRoomLabelPlugin/index.js +541 -0
- package/dist/ModelRoomLabelPlugin/typings.d.ts +35 -0
- package/dist/ModelRoomLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ModelTVVideoPlugin/Plugin.d.ts +4 -0
- package/dist/ModelTVVideoPlugin/index.d.ts +5 -0
- package/dist/ModelTVVideoPlugin/index.js +301 -0
- package/dist/ModelTVVideoPlugin/typings.d.ts +25 -0
- package/dist/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
- package/dist/ModelViewPlugin/Plugin.d.ts +17 -0
- package/dist/ModelViewPlugin/index.d.ts +4 -0
- package/dist/ModelViewPlugin/index.js +187 -0
- package/dist/PanoCompassPlugin/Assets/roomInfoIcon.d.ts +1 -0
- package/dist/PanoCompassPlugin/Plugin.d.ts +47 -0
- package/dist/PanoCompassPlugin/getRoomInfoInstance.d.ts +8 -0
- package/dist/PanoCompassPlugin/index.d.ts +8 -0
- package/dist/PanoCompassPlugin/index.js +636 -0
- package/dist/PanoCursorRaycasterPlugin/index.d.ts +48 -0
- package/dist/PanoCursorRaycasterPlugin/index.js +90 -0
- package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +39 -0
- package/dist/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/dist/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
- package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +26 -0
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +70 -0
- package/dist/PanoMeasurePlugin/Model/index.d.ts +38 -0
- package/dist/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/dist/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/dist/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +25 -0
- package/dist/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/dist/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
- package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +59 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +13 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +20 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +19 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/dist/PanoMeasurePlugin/index.d.ts +10 -0
- package/dist/PanoMeasurePlugin/index.js +3996 -0
- package/dist/PanoMeasurePlugin/typings/data.d.ts +32 -0
- package/dist/PanoMeasurePlugin/typings/event.type.d.ts +37 -0
- package/dist/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
- package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
- package/dist/PanoMeasurePlugin/utils/constants.d.ts +4 -0
- package/dist/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
- package/dist/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
- package/dist/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
- package/dist/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
- package/dist/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
- package/dist/PanoMeasurePlugin/utils/line.d.ts +17 -0
- package/dist/PanoMeasurePlugin/utils/math.d.ts +17 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
- package/dist/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
- package/dist/PanoRulerPlugin/Plugin.d.ts +31 -0
- package/dist/PanoRulerPlugin/index.d.ts +5 -0
- package/dist/PanoRulerPlugin/index.js +610 -0
- package/dist/PanoRulerPlugin/style.d.ts +2 -0
- package/dist/PanoRulerPlugin/typings.d.ts +21 -0
- package/dist/PanoSpatialTagPlugin/Plugin.d.ts +35 -0
- package/dist/PanoSpatialTagPlugin/index.d.ts +5 -0
- package/dist/PanoSpatialTagPlugin/index.js +1307 -0
- package/dist/PanoSpatialTagPlugin/store.d.ts +1 -0
- package/dist/PanoSpatialTagPlugin/style.d.ts +1 -0
- package/dist/PanoSpatialTagPlugin/typings.d.ts +40 -0
- package/dist/base/BasePlugin.d.ts +100 -0
- package/dist/base/BasePluginWithData.d.ts +34 -0
- package/dist/components/PaintBrush/Controller.d.ts +43 -0
- package/dist/components/PaintBrush/Subscribe.d.ts +76 -0
- package/dist/components/PaintBrush/index.d.ts +27 -0
- package/dist/components/PaintBrush/style.d.ts +2 -0
- package/dist/components/PaintBrush/tween.d.ts +62 -0
- package/dist/components/PaintBrush/typings.d.ts +58 -0
- package/dist/components/PaintBrush/utils.d.ts +26 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/floorplan/Assets/camera.d.ts +1 -0
- package/dist/floorplan/Assets/compass.d.ts +1 -0
- package/dist/floorplan/Assets/floorplanExtraObject.d.ts +1 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +97 -0
- package/dist/floorplan/ModelFloorplanPlugin/index.d.ts +7 -0
- package/dist/floorplan/ModelFloorplanPlugin/index.js +4526 -0
- package/dist/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
- package/dist/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +23 -0
- package/dist/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +15 -0
- package/dist/floorplan/ModelFloorplanPlugin/utils/correctFiveState.d.ts +14 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +36 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.d.ts +7 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +2008 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +67 -0
- package/dist/floorplan/TopviewFloorplanPlugin/index.d.ts +7 -0
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +4236 -0
- package/dist/floorplan/TopviewFloorplanPlugin/style.d.ts +1 -0
- package/dist/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
- package/dist/floorplan/constant.d.ts +5 -0
- package/dist/floorplan/index.d.ts +6 -0
- package/dist/floorplan/typings/floorplanData.d.ts +137 -0
- package/dist/floorplan/typings/floorplanServerData.d.ts +131 -0
- package/dist/floorplan/typings/utility.d.ts +2 -0
- package/dist/floorplan/utils/constant.d.ts +22 -0
- package/dist/floorplan/utils/correctFiveState.d.ts +15 -0
- package/dist/floorplan/utils/formatData.d.ts +5 -0
- package/dist/floorplan/utils/formatPosition.d.ts +36 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.es.js +15436 -0
- package/dist/index.js +15488 -0
- package/dist/index.umd.js +15480 -0
- package/dist/shared-utils/Preloader.d.ts +6 -0
- package/dist/shared-utils/Subscribe.d.ts +45 -0
- package/dist/shared-utils/animationFrame/BetterTween.d.ts +11 -0
- package/dist/shared-utils/animationFrame/calculateProgress.d.ts +8 -0
- package/dist/shared-utils/animationFrame/formatRad.d.ts +15 -0
- package/dist/shared-utils/animationFrame/index.d.ts +15 -0
- package/dist/shared-utils/animationFrame/tween.d.ts +75 -0
- package/dist/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
- package/dist/shared-utils/createCanvasTextTexture.d.ts +8 -0
- package/dist/shared-utils/createLine/index.d.ts +3 -0
- package/dist/shared-utils/debounce.d.ts +6 -0
- package/dist/shared-utils/equal.d.ts +11 -0
- package/dist/shared-utils/filter.d.ts +27 -0
- package/dist/shared-utils/five/changeMode.d.ts +5 -0
- package/dist/shared-utils/formatRad.d.ts +7 -0
- package/dist/shared-utils/getPxmm.d.ts +19 -0
- package/dist/shared-utils/getRandomColor.d.ts +1 -0
- package/dist/shared-utils/index.d.ts +1 -0
- package/dist/shared-utils/isNil.d.ts +10 -0
- package/dist/shared-utils/isTruelyObject.d.ts +18 -0
- package/dist/shared-utils/math/Interval.d.ts +13 -0
- package/dist/shared-utils/math/Rectangle.d.ts +27 -0
- package/dist/shared-utils/math/evenNumber.d.ts +3 -0
- package/dist/shared-utils/math/index.d.ts +2 -0
- package/dist/shared-utils/math/planimetry.d.ts +116 -0
- package/dist/shared-utils/math/rad2Deg.d.ts +1 -0
- package/dist/shared-utils/nearlyEqual.d.ts +7 -0
- package/dist/shared-utils/nextFrame.d.ts +1 -0
- package/dist/shared-utils/noop.d.ts +5 -0
- package/dist/shared-utils/object3d2LocalMatrix.d.ts +12 -0
- package/dist/shared-utils/px2rem.d.ts +1 -0
- package/dist/shared-utils/removeArrayItem.d.ts +7 -0
- package/dist/shared-utils/tap.d.ts +8 -0
- package/dist/shared-utils/three/centerPoint.d.ts +2 -0
- package/dist/shared-utils/three/getExtraModelLoader.d.ts +6 -0
- package/dist/shared-utils/three/getNormal.d.ts +2 -0
- package/dist/shared-utils/three/getTextureLoader.d.ts +6 -0
- package/dist/shared-utils/three/loadFbxObj.d.ts +2 -0
- package/dist/shared-utils/three/loadTexture.d.ts +2 -0
- package/dist/shared-utils/three/transformPositionToVector3.d.ts +7 -0
- package/dist/shared-utils/three/transfromToMeshBasicMaterial.d.ts +2 -0
- package/dist/shared-utils/throttle.d.ts +7 -0
- package/dist/shared-utils/tinyEJSrender.d.ts +5 -0
- package/dist/shared-utils/to.d.ts +8 -0
- package/dist/shared-utils/uuid.d.ts +5 -0
- package/dist/shared-utils/vectorTocoordinates.d.ts +7 -0
- package/dist/typings/math.type.d.ts +44 -0
- package/dist/typings/utils.type.d.ts +2 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1413 -0
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/Magnifier.html +9 -0
- package/docs/classes/ModelRoomLabelController.html +17 -0
- package/docs/enums/CameraMovementEffect.html +3 -0
- package/docs/enums/DIRECTION.html +1 -0
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -0
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -0
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -0
- package/docs/enums/Rotation.html +3 -0
- package/docs/index.html +88 -0
- package/docs/interfaces/CSS3DRenderPluginExportType.html +4 -0
- package/docs/interfaces/CameraMovementPluginExportType.html +17 -0
- package/docs/interfaces/FloorplanBounding.html +10 -0
- package/docs/interfaces/FloorplanData.html +3 -0
- package/docs/interfaces/FloorplanEntrance.html +15 -0
- package/docs/interfaces/FloorplanExtraObject.html +7 -0
- package/docs/interfaces/FloorplanExtraObject3D.html +3 -0
- package/docs/interfaces/FloorplanFloorData.html +3 -0
- package/docs/interfaces/FloorplanImagePosition.html +3 -0
- package/docs/interfaces/FloorplanObserver.html +5 -0
- package/docs/interfaces/FloorplanOutlineItem.html +3 -0
- package/docs/interfaces/FloorplanPosition.html +3 -0
- package/docs/interfaces/FloorplanRoomItem.html +17 -0
- package/docs/interfaces/FloorplanRoomLabelItem.html +7 -0
- package/docs/interfaces/FloorplanServerBounding.html +10 -0
- package/docs/interfaces/FloorplanServerComputedData.html +1 -0
- package/docs/interfaces/FloorplanServerData.html +3 -0
- package/docs/interfaces/FloorplanServerEntrance.html +15 -0
- package/docs/interfaces/FloorplanServerFloorData.html +3 -0
- package/docs/interfaces/FloorplanServerImagePosition.html +3 -0
- package/docs/interfaces/FloorplanServerObserver.html +5 -0
- package/docs/interfaces/FloorplanServerOutlineItem.html +3 -0
- package/docs/interfaces/FloorplanServerPosition.html +3 -0
- package/docs/interfaces/FloorplanServerRoomItem.html +20 -0
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +7 -0
- package/docs/interfaces/ItemLabelPluginData.html +1 -0
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -0
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -0
- package/docs/interfaces/LineJson.html +1 -0
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -0
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -0
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -0
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -0
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -0
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -0
- package/docs/interfaces/ModelViewPluginExportType.html +1 -0
- package/docs/interfaces/OpenParameter.html +3 -0
- package/docs/interfaces/PanoCompassPluginData.html +1 -0
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -0
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +11 -0
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -0
- package/docs/interfaces/PanoMeasureParameterType.html +1 -0
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -0
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -0
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -0
- package/docs/interfaces/Point.html +1 -0
- package/docs/interfaces/PointJson.html +1 -0
- package/docs/interfaces/Room.html +1 -0
- package/docs/interfaces/RoomInfo.html +1 -0
- package/docs/interfaces/RoomLabel.html +13 -0
- package/docs/interfaces/RoomRules.html +1 -0
- package/docs/interfaces/Rooms.html +1 -0
- package/docs/modules.html +34 -0
- package/libs/CSS3DRenderPlugin/Plugin.d.ts +49 -0
- package/libs/CSS3DRenderPlugin/Plugin.js +182 -0
- package/libs/CSS3DRenderPlugin/index.d.ts +3 -48
- package/libs/CSS3DRenderPlugin/index.js +2 -180
- package/libs/CameraMovementPlugin/CameraMovementPlugin.d.ts +7 -0
- package/libs/CameraMovementPlugin/CameraMovementPlugin.js +159 -0
- package/libs/CameraMovementPlugin/index.d.ts +4 -6
- package/libs/CameraMovementPlugin/index.js +3 -158
- package/libs/CameraMovementPlugin/typing.d.ts +1 -1
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +577 -0
- package/libs/ItemLabelPlugin/ItemLabelItem.js +227 -0
- package/libs/ItemLabelPlugin/Plugin.d.ts +4 -0
- package/libs/ItemLabelPlugin/Plugin.js +120 -0
- package/libs/ItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ItemLabelPlugin/events.type.js +1 -0
- package/libs/ItemLabelPlugin/index.d.ts +9 -0
- package/libs/ItemLabelPlugin/index.js +8 -0
- package/libs/ItemLabelPlugin/typings.d.ts +59 -0
- package/libs/ItemLabelPlugin/typings.js +7 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.js +13 -0
- package/libs/ItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
- package/libs/ModelChassisCompassPlugin/Plugin.d.ts +19 -0
- package/libs/ModelChassisCompassPlugin/Plugin.js +77 -0
- package/libs/ModelChassisCompassPlugin/index.d.ts +3 -18
- package/libs/ModelChassisCompassPlugin/index.js +2 -74
- package/libs/ModelEntryDoorGuidePlugin/Plugin.d.ts +26 -0
- package/libs/ModelEntryDoorGuidePlugin/Plugin.js +140 -0
- package/libs/ModelEntryDoorGuidePlugin/index.d.ts +3 -25
- package/libs/ModelEntryDoorGuidePlugin/index.js +2 -135
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +409 -0
- package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
- package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.d.ts +4 -0
- package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.js +120 -0
- package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ModelItemLabelPlugin/events.type.js +1 -0
- package/libs/ModelItemLabelPlugin/index.d.ts +9 -0
- package/libs/ModelItemLabelPlugin/index.js +8 -0
- package/libs/ModelItemLabelPlugin/typings.d.ts +56 -0
- package/libs/ModelItemLabelPlugin/typings.js +7 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ModelRoomLabelPlugin/Controller.js +67 -25
- package/libs/ModelRoomLabelPlugin/RoomLabelItem.js +121 -0
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +291 -0
- package/libs/ModelRoomLabelPlugin/utils/parseData.d.ts +1 -1
- package/libs/ModelSimulationPlugin/index.d.ts +33 -0
- package/libs/ModelSimulationPlugin/index.js +166 -0
- package/libs/ModelSimulationPlugin/shaders/fragment.d.ts +2 -0
- package/libs/ModelSimulationPlugin/shaders/fragment.js +96 -0
- package/libs/ModelSimulationPlugin/shaders/vertex.d.ts +2 -0
- package/libs/ModelSimulationPlugin/shaders/vertex.js +23 -0
- package/libs/ModelTVVideoPlugin/Plugin.d.ts +4 -0
- package/libs/ModelTVVideoPlugin/Plugin.js +254 -0
- package/libs/ModelTVVideoPlugin/index.d.ts +5 -0
- package/libs/ModelTVVideoPlugin/index.js +4 -0
- package/libs/ModelTVVideoPlugin/typings.d.ts +25 -0
- package/libs/ModelTVVideoPlugin/typings.js +8 -0
- package/libs/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
- package/libs/ModelTVVideoPlugin/utils/parseData.js +13 -0
- package/libs/ModelViewPlugin/Plugin.d.ts +17 -0
- package/libs/ModelViewPlugin/Plugin.js +160 -0
- package/libs/ModelViewPlugin/index.d.ts +3 -16
- package/libs/ModelViewPlugin/index.js +2 -159
- package/libs/PanoCompassPlugin/Plugin.d.ts +47 -0
- package/libs/PanoCompassPlugin/Plugin.js +249 -0
- package/libs/PanoCompassPlugin/index.d.ts +4 -47
- package/libs/PanoCompassPlugin/index.js +3 -167
- package/libs/PanoCursorRaycasterPlugin/index.d.ts +1 -1
- package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +12 -9
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +77 -14
- package/libs/PanoMeasurePlugin/Controller/EditController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
- package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +2 -1
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +246 -153
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +18 -9
- package/libs/PanoMeasurePlugin/Controller/index.js +182 -54
- package/libs/PanoMeasurePlugin/Model/index.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Model/index.js +30 -5
- package/libs/PanoMeasurePlugin/Model/line.d.ts +5 -5
- package/libs/PanoMeasurePlugin/Model/line.js +61 -11
- package/libs/PanoMeasurePlugin/Model/point.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Model/point.js +24 -4
- package/libs/PanoMeasurePlugin/Model/polyline.d.ts +3 -3
- package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +5 -2
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +107 -25
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
- package/libs/PanoMeasurePlugin/Modules/GuideController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +50 -15
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +234 -59
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +84 -38
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +2 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +5 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +84 -34
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +11 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
- package/libs/PanoMeasurePlugin/index.d.ts +9 -6
- package/libs/PanoMeasurePlugin/index.js +3 -1
- package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +14 -5
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
- package/libs/PanoMeasurePlugin/utils/clearGroup.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/constants.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
- package/libs/PanoMeasurePlugin/utils/distanceDom.d.ts +3 -3
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +22 -16
- package/libs/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/findClosestPoint.d.ts +3 -3
- package/libs/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/line.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/line.js +8 -7
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -5
- package/libs/PanoRulerPlugin/Plugin.d.ts +31 -0
- package/libs/PanoRulerPlugin/Plugin.js +403 -0
- package/libs/PanoRulerPlugin/index.d.ts +4 -30
- package/libs/PanoRulerPlugin/index.js +2 -397
- package/libs/PanoSpatialTagPlugin/Components/origins.js +168 -0
- package/libs/PanoSpatialTagPlugin/Components/tag.js +302 -0
- package/libs/PanoSpatialTagPlugin/Plugin.d.ts +35 -0
- package/libs/PanoSpatialTagPlugin/Plugin.js +426 -0
- package/libs/PanoSpatialTagPlugin/index.d.ts +5 -0
- package/libs/PanoSpatialTagPlugin/index.js +5 -0
- package/libs/PanoSpatialTagPlugin/store.d.ts +1 -0
- package/libs/PanoSpatialTagPlugin/store.js +2 -0
- package/libs/PanoSpatialTagPlugin/style.d.ts +1 -0
- package/libs/PanoSpatialTagPlugin/style.js +8 -0
- package/libs/PanoSpatialTagPlugin/typings.d.ts +40 -0
- package/libs/PanoSpatialTagPlugin/typings.js +1 -0
- package/libs/base/BasePlugin.d.ts +100 -0
- package/libs/base/BasePlugin.js +31 -0
- package/libs/base/BasePluginWithData.d.ts +34 -0
- package/libs/base/BasePluginWithData.js +4 -0
- package/libs/components/PaintBrush/Controller.d.ts +43 -0
- package/libs/components/PaintBrush/Controller.js +575 -0
- package/libs/components/PaintBrush/Subscribe.d.ts +76 -0
- package/libs/components/PaintBrush/Subscribe.js +121 -0
- package/libs/components/PaintBrush/index.d.ts +27 -0
- package/libs/components/PaintBrush/index.js +57 -0
- package/libs/components/PaintBrush/style.d.ts +2 -0
- package/libs/components/PaintBrush/style.js +102 -0
- package/libs/components/PaintBrush/tween.d.ts +62 -0
- package/libs/components/PaintBrush/tween.js +15 -0
- package/libs/components/PaintBrush/typings.d.ts +58 -0
- package/libs/components/PaintBrush/typings.js +6 -0
- package/libs/components/PaintBrush/utils.d.ts +26 -0
- package/libs/components/PaintBrush/utils.js +51 -0
- package/libs/components/index.d.ts +2 -0
- package/libs/components/index.js +3 -0
- package/libs/floorplan/Assets/compass.d.ts +1 -0
- package/libs/floorplan/Assets/compass.js +1 -0
- package/libs/floorplan/Components/BaseImage.js +222 -0
- package/libs/floorplan/Components/Camera.js +120 -0
- package/libs/floorplan/Components/Compass.js +120 -0
- package/libs/floorplan/Components/CurrentFloor.js +469 -0
- package/libs/floorplan/Components/Main.js +470 -0
- package/libs/floorplan/Components/Normalmage.js +63 -0
- package/libs/floorplan/Components/RoomHighlight/Room.js +107 -0
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +216 -0
- package/libs/floorplan/Components/RoomLabels/RoomLabel.js +322 -0
- package/libs/floorplan/Components/RoomLabels/RoomLabels.js +309 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +331 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_0.js +64 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.js +104 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.js +142 -0
- package/libs/floorplan/Components/RuleLabels/RuleItem.js +284 -0
- package/libs/floorplan/Components/RuleLabels/RuleLabels.js +269 -0
- package/libs/floorplan/Components/SvgImage.js +83 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.js +120 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +106 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.js +463 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +375 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +171 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.js +265 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +301 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.js +219 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -77
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +661 -326
- package/libs/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
- package/libs/floorplan/ModelFloorplanPlugin/index.js +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
- package/libs/floorplan/ModelFloorplanPlugin/typing.js +1 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +168 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +250 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.js +154 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +373 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +24 -16
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +195 -43
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +2 -2
- package/libs/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/typing.js +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +53 -47
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +450 -154
- package/libs/floorplan/TopviewFloorplanPlugin/index.d.ts +6 -4
- package/libs/floorplan/TopviewFloorplanPlugin/index.js +2 -2
- package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -1
- package/libs/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
- package/libs/floorplan/TopviewFloorplanPlugin/typing.js +1 -0
- package/libs/floorplan/index.d.ts +6 -0
- package/libs/floorplan/index.js +7 -0
- package/libs/floorplan/utils/constant.d.ts +22 -0
- package/libs/floorplan/utils/constant.js +23 -0
- package/libs/floorplan/utils/correctFiveState.d.ts +15 -0
- package/libs/floorplan/utils/correctFiveState.js +46 -0
- package/libs/floorplan/utils/formatPosition.d.ts +1 -1
- package/libs/floorplan/utils/formatPosition.js +3 -3
- package/libs/index.d.ts +15 -24
- package/libs/index.js +25 -14
- package/libs/shared-utils/Subscribe.js +8 -1
- package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
- package/libs/shared-utils/createCanvasTextTexture.js +6 -5
- package/libs/shared-utils/five/changeMode.d.ts +4 -1
- package/libs/shared-utils/five/changeMode.js +34 -13
- package/libs/shared-utils/getPxmm.d.ts +8 -0
- package/libs/shared-utils/getPxmm.js +25 -20
- package/libs/shared-utils/index.d.ts +1 -0
- package/libs/shared-utils/index.js +1 -0
- package/libs/shared-utils/math/Interval.d.ts +13 -0
- package/libs/shared-utils/math/Interval.js +40 -0
- package/libs/shared-utils/math/Rectangle.d.ts +27 -0
- package/libs/shared-utils/math/Rectangle.js +50 -0
- package/libs/shared-utils/math/evenNumber.js +1 -1
- package/libs/shared-utils/math/index.d.ts +2 -0
- package/libs/shared-utils/math/index.js +2 -0
- package/libs/shared-utils/three/getExtraModelLoader.d.ts +1 -1
- package/libs/shared-utils/three/getNormal.d.ts +1 -1
- package/libs/shared-utils/three/getTextureLoader.d.ts +1 -1
- package/libs/shared-utils/three/loadFbxObj.d.ts +1 -1
- package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
- package/libs/shared-utils/tinyEJSrender.d.ts +5 -0
- package/libs/shared-utils/tinyEJSrender.js +210 -0
- package/libs/shared-utils/uuid.d.ts +1 -0
- package/libs/shared-utils/uuid.js +1 -0
- package/libs/shared-utils/vectorTocoordinates.d.ts +1 -1
- package/package.json +29 -14
- package/CHANGELOG.md +0 -21
- package/dist/dnalogel.cjs.js +0 -7
- package/dist/dnalogel.es.js +0 -41280
- package/dist/dnalogel.umd.js +0 -7
- package/dist/style.css +0 -1
- package/libs/ModelRoomLabelPlugin/RoomLabelItem.svelte +0 -63
- package/libs/ModelRoomLabelPlugin/RoomLabelItem.svelte.map +0 -1
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.svelte +0 -80
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.svelte.map +0 -1
- package/libs/floorplan/Components/BaseImage.svelte +0 -25
- package/libs/floorplan/Components/BaseImage.svelte.map +0 -1
- package/libs/floorplan/Components/Normalmage.svelte +0 -11
- package/libs/floorplan/Components/Normalmage.svelte.map +0 -1
- package/libs/floorplan/Components/RoomHighlight/Room.svelte +0 -21
- package/libs/floorplan/Components/RoomHighlight/Room.svelte.map +0 -1
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.svelte +0 -60
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.svelte.map +0 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.svelte +0 -35
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.svelte.map +0 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_0.svelte +0 -7
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_0.svelte.map +0 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.svelte +0 -16
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.svelte.map +0 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.svelte +0 -17
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.svelte.map +0 -1
- package/libs/floorplan/Components/SvgImage.svelte +0 -25
- package/libs/floorplan/Components/SvgImage.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.svelte +0 -46
- package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.svelte +0 -48
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.svelte +0 -37
- package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.svelte +0 -50
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.svelte +0 -41
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.svelte +0 -25
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.svelte +0 -148
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.svelte.map +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.svelte +0 -15
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.svelte.map +0 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte +0 -84
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte.map +0 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte +0 -18
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte.map +0 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte +0 -40
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte.map +0 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte +0 -61
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { noop } from './utils';
|
|
2
|
+
import { PaintBrushAction, PaintBrushConfigs, PaintBrushEventMap, PaintBrushState } from './typings';
|
|
3
|
+
import { Subscribe } from './Subscribe';
|
|
4
|
+
export declare class Controller extends Subscribe<PaintBrushEventMap> {
|
|
5
|
+
configs: PaintBrushConfigs;
|
|
6
|
+
private clientWidth;
|
|
7
|
+
private clientHeight;
|
|
8
|
+
private ready;
|
|
9
|
+
private uuid;
|
|
10
|
+
private tween?;
|
|
11
|
+
private tweening;
|
|
12
|
+
private container;
|
|
13
|
+
private canvas;
|
|
14
|
+
private data;
|
|
15
|
+
private tempLine;
|
|
16
|
+
get color(): string;
|
|
17
|
+
get state(): Record<string, PaintBrushState[]>;
|
|
18
|
+
get dpr(): number;
|
|
19
|
+
constructor(configs: PaintBrushConfigs);
|
|
20
|
+
ifInsertToDOM(): HTMLDivElement;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param className 初始化画板
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
initCanvas(className: string): HTMLCanvasElement;
|
|
27
|
+
/**
|
|
28
|
+
* 初始化操作面板
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
initCtrl(): HTMLDivElement;
|
|
32
|
+
openBrush(): void;
|
|
33
|
+
closeBrush(): void;
|
|
34
|
+
updateCurrentColor(color: string): void;
|
|
35
|
+
openBrushHandle(): void;
|
|
36
|
+
emitStateChange(action: PaintBrushAction, userAction?: boolean): void;
|
|
37
|
+
action(action: PaintBrushAction): void;
|
|
38
|
+
handleDrawLine(_uuid: string, data: PaintBrushState, { withUndo }: {
|
|
39
|
+
withUndo?: boolean;
|
|
40
|
+
}, callback?: typeof noop): void;
|
|
41
|
+
handleUndo(uuid: string): void;
|
|
42
|
+
destroyBrush(): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { queue, execInterval, transformCoords, unTransformCoords, getQuadraticCurvePoint, noop, nextFrame, } from './utils';
|
|
2
|
+
import tween from './tween';
|
|
3
|
+
import { PaintBrushTypeEnum, } from './typings';
|
|
4
|
+
import { Subscribe } from './Subscribe';
|
|
5
|
+
import { uuid } from '../../shared-utils/uuid';
|
|
6
|
+
import PaintBrushStyle from './style';
|
|
7
|
+
export class Controller extends Subscribe {
|
|
8
|
+
constructor(configs) {
|
|
9
|
+
super();
|
|
10
|
+
Object.defineProperty(this, "configs", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "clientWidth", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "clientHeight", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "ready", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: false
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "uuid", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: uuid()
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "tween", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: void 0
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(this, "tweening", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: false
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(this, "container", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(this, "canvas", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: void 0
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(this, "data", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: {}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(this, "tempLine", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: {}
|
|
75
|
+
});
|
|
76
|
+
this.configs = configs;
|
|
77
|
+
this.clientWidth = document.body.clientWidth;
|
|
78
|
+
this.clientHeight = document.body.clientHeight;
|
|
79
|
+
this.container = this.ifInsertToDOM();
|
|
80
|
+
this.canvas = {};
|
|
81
|
+
this.initCtrl();
|
|
82
|
+
}
|
|
83
|
+
get color() {
|
|
84
|
+
return this.configs.currentColor;
|
|
85
|
+
}
|
|
86
|
+
get state() {
|
|
87
|
+
return this.data;
|
|
88
|
+
}
|
|
89
|
+
get dpr() {
|
|
90
|
+
return this.configs.DPR || 1;
|
|
91
|
+
}
|
|
92
|
+
ifInsertToDOM() {
|
|
93
|
+
if (this.container) {
|
|
94
|
+
return this.container;
|
|
95
|
+
}
|
|
96
|
+
if (this.configs.container) {
|
|
97
|
+
this.configs.container.id = '_gl_paintBrush';
|
|
98
|
+
this.container = this.configs.container;
|
|
99
|
+
}
|
|
100
|
+
else if (!document.getElementById('_gl_paintBrush')) {
|
|
101
|
+
const container = document.createElement('div');
|
|
102
|
+
container.id = '_gl_paintBrush';
|
|
103
|
+
document.body.appendChild(container);
|
|
104
|
+
this.container = container;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.container = document.getElementById('_gl_paintBrush');
|
|
108
|
+
}
|
|
109
|
+
this.container.innerHTML = PaintBrushStyle;
|
|
110
|
+
return this.container;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* @param className 初始化画板
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
initCanvas(className) {
|
|
118
|
+
const canvas = document.createElement('canvas');
|
|
119
|
+
canvas.className = className;
|
|
120
|
+
canvas.width = this.clientWidth;
|
|
121
|
+
canvas.height = this.clientHeight;
|
|
122
|
+
const ctx = canvas.getContext('2d');
|
|
123
|
+
if (!ctx)
|
|
124
|
+
return;
|
|
125
|
+
ctx.lineWidth = 5 * this.dpr;
|
|
126
|
+
ctx.lineCap = 'round';
|
|
127
|
+
ctx.lineJoin = 'round';
|
|
128
|
+
this.container.appendChild(canvas);
|
|
129
|
+
return canvas;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 初始化操作面板
|
|
133
|
+
* @returns
|
|
134
|
+
*/
|
|
135
|
+
initCtrl() {
|
|
136
|
+
const ctrl = document.createElement('div');
|
|
137
|
+
ctrl.className = '_paintBrush-ctrl';
|
|
138
|
+
const ctrl_inner = document.createElement('div');
|
|
139
|
+
ctrl_inner.className = '_paintBrush-ctrlinner';
|
|
140
|
+
const a_undo = document.createElement('a');
|
|
141
|
+
a_undo.className = '_paintBrush-ctrlitem _paintBrush-ctrlitem--undo';
|
|
142
|
+
a_undo.addEventListener('click', (e) => {
|
|
143
|
+
var _a;
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
// 点击撤回:供埋点使用
|
|
146
|
+
if (this.configs.onClickUndo) {
|
|
147
|
+
this.configs.onClickUndo();
|
|
148
|
+
}
|
|
149
|
+
if (!this.canvas[this.uuid] || !this.data[this.uuid] || this.data[this.uuid].length === 0) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const popState = this.data[this.uuid].pop();
|
|
153
|
+
if (popState) {
|
|
154
|
+
this.emitStateChange({
|
|
155
|
+
type: PaintBrushTypeEnum.Undo,
|
|
156
|
+
color: this.color,
|
|
157
|
+
ready: this.ready,
|
|
158
|
+
state: popState,
|
|
159
|
+
uuid: this.uuid,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const $ctx = (_a = this.canvas[this.uuid]) === null || _a === void 0 ? void 0 : _a.getContext('2d');
|
|
163
|
+
if (!this.canvas[this.uuid]) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const { width, height } = this.canvas[this.uuid];
|
|
167
|
+
if ($ctx) {
|
|
168
|
+
$ctx.clearRect(0, 0, width, height);
|
|
169
|
+
}
|
|
170
|
+
this.data[this.uuid].forEach((ld) => this.handleDrawLine(this.uuid, ld, { withUndo: true }));
|
|
171
|
+
});
|
|
172
|
+
const a_close = document.createElement('a');
|
|
173
|
+
a_close.className = '_paintBrush-ctrlitem _paintBrush-ctrlitem--close';
|
|
174
|
+
a_close.addEventListener('click', (e) => {
|
|
175
|
+
e.stopPropagation();
|
|
176
|
+
this.closeBrush();
|
|
177
|
+
// 点击关闭:供埋点使用
|
|
178
|
+
if (this.configs.onClickClose) {
|
|
179
|
+
this.configs.onClickClose();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const $A = [a_undo, a_close];
|
|
183
|
+
$A.forEach(($a) => {
|
|
184
|
+
const $i = document.createElement('i');
|
|
185
|
+
$i.className = 'brush-icon';
|
|
186
|
+
const $span = document.createElement('span');
|
|
187
|
+
$span.className = 'brush-txt';
|
|
188
|
+
$span.innerText = $a.className.endsWith('undo') ? this.configs.onUndoText : this.configs.onExitText;
|
|
189
|
+
$a.appendChild($i);
|
|
190
|
+
$a.appendChild($span);
|
|
191
|
+
});
|
|
192
|
+
ctrl_inner.appendChild(a_undo);
|
|
193
|
+
ctrl_inner.appendChild(a_close);
|
|
194
|
+
ctrl.appendChild(ctrl_inner);
|
|
195
|
+
this.container.appendChild(ctrl);
|
|
196
|
+
return ctrl;
|
|
197
|
+
}
|
|
198
|
+
openBrush() {
|
|
199
|
+
if (this.ready)
|
|
200
|
+
return;
|
|
201
|
+
if (!this.canvas[this.uuid]) {
|
|
202
|
+
this.canvas[this.uuid] = this.initCanvas('_paintBrush-canvas');
|
|
203
|
+
}
|
|
204
|
+
this.container.className = 'brushing';
|
|
205
|
+
const $curCanvas = this.canvas[this.uuid];
|
|
206
|
+
const $ctx = $curCanvas.getContext('2d');
|
|
207
|
+
$ctx.clearRect(0, 0, $curCanvas.width, $curCanvas.height);
|
|
208
|
+
this.openBrushHandle();
|
|
209
|
+
this.ready = true;
|
|
210
|
+
this.emit('readyChange', true);
|
|
211
|
+
}
|
|
212
|
+
closeBrush() {
|
|
213
|
+
if (!this.ready)
|
|
214
|
+
return;
|
|
215
|
+
this.container.className = '';
|
|
216
|
+
this.data = {};
|
|
217
|
+
this.tempLine = {};
|
|
218
|
+
Object.keys(this.canvas).forEach((key) => {
|
|
219
|
+
this.canvas[key].ontouchstart = () => false;
|
|
220
|
+
this.canvas[key].ontouchmove = () => false;
|
|
221
|
+
this.canvas[key].ontouchend = () => false;
|
|
222
|
+
this.canvas[key].ontouchcancel = () => false;
|
|
223
|
+
const $ctx = this.canvas[key].getContext('2d');
|
|
224
|
+
if ($ctx) {
|
|
225
|
+
$ctx.clearRect(0, 0, this.canvas[key].width, this.canvas[key].height);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
this.ready = false;
|
|
229
|
+
this.emit('readyChange', false);
|
|
230
|
+
this.emitStateChange({
|
|
231
|
+
type: PaintBrushTypeEnum.Exit,
|
|
232
|
+
color: this.color,
|
|
233
|
+
ready: false,
|
|
234
|
+
uuid: this.uuid,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
updateCurrentColor(color) {
|
|
238
|
+
const currentCanvas = this.canvas[this.uuid];
|
|
239
|
+
if (!currentCanvas)
|
|
240
|
+
return;
|
|
241
|
+
const currentCtx = currentCanvas.getContext('2d');
|
|
242
|
+
if (!currentCtx)
|
|
243
|
+
return;
|
|
244
|
+
this.configs.currentColor = color;
|
|
245
|
+
currentCtx.strokeStyle = color;
|
|
246
|
+
}
|
|
247
|
+
openBrushHandle() {
|
|
248
|
+
const currentCanvas = this.canvas[this.uuid];
|
|
249
|
+
if (!currentCanvas)
|
|
250
|
+
return;
|
|
251
|
+
const currentCtx = currentCanvas.getContext('2d');
|
|
252
|
+
if (!currentCtx)
|
|
253
|
+
return;
|
|
254
|
+
const color = this.color || '#6D92FF';
|
|
255
|
+
currentCtx.strokeStyle = color;
|
|
256
|
+
let begin = null; // 开始点
|
|
257
|
+
let points = []; // 单次 touch 点位集合
|
|
258
|
+
let move;
|
|
259
|
+
let line = []; // 同步 touch 点位数据
|
|
260
|
+
let startTime = 0; // touch 开始时间
|
|
261
|
+
// 绘制
|
|
262
|
+
const draw = (beginPoint, controlPoint, endPoint) => {
|
|
263
|
+
const color = this.color || '#ff0000';
|
|
264
|
+
currentCtx.strokeStyle = color;
|
|
265
|
+
currentCtx.beginPath();
|
|
266
|
+
currentCtx.moveTo(beginPoint.x, beginPoint.y);
|
|
267
|
+
currentCtx.quadraticCurveTo(controlPoint.x, controlPoint.y, endPoint.x, endPoint.y);
|
|
268
|
+
currentCtx.stroke();
|
|
269
|
+
};
|
|
270
|
+
// 鼠标按下
|
|
271
|
+
currentCanvas.onmousedown = (e) => {
|
|
272
|
+
e.preventDefault();
|
|
273
|
+
startTime = Date.now();
|
|
274
|
+
const x = e.clientX;
|
|
275
|
+
const y = e.clientY;
|
|
276
|
+
points = [];
|
|
277
|
+
points.push({ x, y });
|
|
278
|
+
begin = { x, y };
|
|
279
|
+
move = transformCoords({ x, y }, this.clientWidth, this.clientHeight);
|
|
280
|
+
line = [];
|
|
281
|
+
};
|
|
282
|
+
// 鼠标移动
|
|
283
|
+
currentCanvas.onmousemove = (e) => {
|
|
284
|
+
e.preventDefault();
|
|
285
|
+
if (!begin)
|
|
286
|
+
return;
|
|
287
|
+
const x = Number(e.clientX);
|
|
288
|
+
const y = Number(e.clientY);
|
|
289
|
+
// 密集点位稀释
|
|
290
|
+
if (Math.abs(x - begin.x) < 5 && Math.abs(y - begin.y) < 5) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
points.push({ x, y });
|
|
294
|
+
// 此处应记录折线拟合之前的点
|
|
295
|
+
line.push(transformCoords({ x, y }, this.clientWidth, this.clientHeight));
|
|
296
|
+
// 折线拟合二次贝塞尔曲线至少需要三个点
|
|
297
|
+
if (points.length < 3) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const { control, end } = getQuadraticCurvePoint(points);
|
|
301
|
+
if (!control || !end) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
draw(begin, control, end);
|
|
305
|
+
begin = end;
|
|
306
|
+
};
|
|
307
|
+
// 鼠标松开
|
|
308
|
+
currentCanvas.onmouseup = (e) => {
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
begin = null;
|
|
311
|
+
if (points.length < 3)
|
|
312
|
+
return;
|
|
313
|
+
if (!this.data[this.uuid]) {
|
|
314
|
+
this.data[this.uuid] = [];
|
|
315
|
+
}
|
|
316
|
+
const duration = Date.now() - startTime;
|
|
317
|
+
const state = {
|
|
318
|
+
move: Object.assign({}, move),
|
|
319
|
+
uuid: this.uuid,
|
|
320
|
+
line: [...line],
|
|
321
|
+
color: this.color,
|
|
322
|
+
duration: duration < 1280 ? duration : duration < 2000 ? 1280 : 0, // 单次笔迹时长超过2000ms不加动画
|
|
323
|
+
};
|
|
324
|
+
this.data[this.uuid].push(state);
|
|
325
|
+
// 广播数据
|
|
326
|
+
nextFrame(() => {
|
|
327
|
+
this.emitStateChange({
|
|
328
|
+
type: PaintBrushTypeEnum.Drawline,
|
|
329
|
+
color: this.color,
|
|
330
|
+
ready: this.ready,
|
|
331
|
+
state,
|
|
332
|
+
uuid: this.uuid,
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
// 手势按压
|
|
337
|
+
currentCanvas.ontouchstart = (e) => {
|
|
338
|
+
e.preventDefault();
|
|
339
|
+
startTime = Date.now();
|
|
340
|
+
const x = e.touches[0].clientX;
|
|
341
|
+
const y = e.touches[0].clientY;
|
|
342
|
+
points = [];
|
|
343
|
+
points.push({ x, y });
|
|
344
|
+
begin = { x, y };
|
|
345
|
+
console.log('ontouchstart', x, y, begin);
|
|
346
|
+
move = transformCoords({ x, y }, this.clientWidth, this.clientHeight);
|
|
347
|
+
line = [];
|
|
348
|
+
};
|
|
349
|
+
// 手势移动
|
|
350
|
+
currentCanvas.ontouchmove = (e) => {
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
if (!begin)
|
|
353
|
+
return;
|
|
354
|
+
const x = Number(e.touches[0].clientX);
|
|
355
|
+
const y = Number(e.touches[0].clientY);
|
|
356
|
+
if (Math.abs(x - begin.x) < 5 && Math.abs(y - begin.y) < 5)
|
|
357
|
+
return; // 密集点位稀释
|
|
358
|
+
points.push({ x, y });
|
|
359
|
+
line.push(transformCoords({ x, y }, this.clientWidth, this.clientHeight)); // 此处应记录折线拟合之前的点
|
|
360
|
+
if (points.length < 3)
|
|
361
|
+
return; // 折线拟合二次贝塞尔曲线至少需要三个点
|
|
362
|
+
const { control, end } = getQuadraticCurvePoint(points);
|
|
363
|
+
if (!control || !end)
|
|
364
|
+
return;
|
|
365
|
+
draw(begin, control, end);
|
|
366
|
+
begin = end;
|
|
367
|
+
};
|
|
368
|
+
// 手势按压离开
|
|
369
|
+
currentCanvas.ontouchend = currentCanvas.ontouchcancel = (e) => {
|
|
370
|
+
e.preventDefault();
|
|
371
|
+
begin = null;
|
|
372
|
+
if (points.length < 3)
|
|
373
|
+
return;
|
|
374
|
+
if (!this.data[this.uuid]) {
|
|
375
|
+
this.data[this.uuid] = [];
|
|
376
|
+
}
|
|
377
|
+
const duration = Date.now() - startTime;
|
|
378
|
+
const state = {
|
|
379
|
+
move: Object.assign({}, move),
|
|
380
|
+
line: [...line],
|
|
381
|
+
uuid: this.uuid,
|
|
382
|
+
color: this.color,
|
|
383
|
+
duration: duration < 1280 ? duration : duration < 2000 ? 1280 : 0, // 单次笔迹时长超过2000ms不加动画
|
|
384
|
+
};
|
|
385
|
+
this.data[this.uuid].push(state);
|
|
386
|
+
// 广播数据
|
|
387
|
+
nextFrame(() => {
|
|
388
|
+
this.emitStateChange({
|
|
389
|
+
type: PaintBrushTypeEnum.Drawline,
|
|
390
|
+
color: this.color,
|
|
391
|
+
ready: this.ready,
|
|
392
|
+
state,
|
|
393
|
+
uuid: this.uuid,
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
emitStateChange(action, userAction = true) {
|
|
399
|
+
if (action.type !== PaintBrushTypeEnum.Drawline) {
|
|
400
|
+
this.emit('stateChange', action, userAction);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const timestamp = Date.now();
|
|
404
|
+
const state = action.state;
|
|
405
|
+
if (!state)
|
|
406
|
+
return;
|
|
407
|
+
if (!state.line)
|
|
408
|
+
return;
|
|
409
|
+
const sliceCount = Math.ceil(state.line.length / 100);
|
|
410
|
+
for (let i = 0; i < sliceCount; i++) {
|
|
411
|
+
const localityAction = {
|
|
412
|
+
uuid: this.uuid,
|
|
413
|
+
color: this.color,
|
|
414
|
+
ready: this.ready,
|
|
415
|
+
type: action.type,
|
|
416
|
+
state: {
|
|
417
|
+
uuid: this.uuid,
|
|
418
|
+
move: state.move,
|
|
419
|
+
duration: state.duration,
|
|
420
|
+
color: this.color,
|
|
421
|
+
line: state.line.slice(i * 100, (i + 1) * 100),
|
|
422
|
+
},
|
|
423
|
+
timestamp,
|
|
424
|
+
end: i === sliceCount - 1,
|
|
425
|
+
};
|
|
426
|
+
/** 由于单次 ws 传输数据量过大,会导致 ws 断掉,所以分批传数据 */
|
|
427
|
+
execInterval(i, 20, () => {
|
|
428
|
+
this.emit('stateChange', localityAction, userAction);
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
action(action) {
|
|
433
|
+
const { ready, type, uuid } = action;
|
|
434
|
+
if (!ready && this.ready) {
|
|
435
|
+
// 关闭面板
|
|
436
|
+
this.closeBrush();
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (ready && !this.ready) {
|
|
440
|
+
// 开启面板:首次打开画笔不同步上一次的画线
|
|
441
|
+
this.openBrush();
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (!this.ready) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
switch (type) {
|
|
448
|
+
case PaintBrushTypeEnum.Drawline:
|
|
449
|
+
const { state, timestamp, end } = action;
|
|
450
|
+
if (!timestamp)
|
|
451
|
+
return;
|
|
452
|
+
if (!state)
|
|
453
|
+
return;
|
|
454
|
+
this.tempLine[timestamp] = [].concat(this.tempLine[timestamp] || [], state.line);
|
|
455
|
+
if (end) {
|
|
456
|
+
Object.assign(state, { line: this.tempLine[timestamp] });
|
|
457
|
+
this.handleDrawLine(uuid, state, {}, () => delete this.tempLine[timestamp]);
|
|
458
|
+
}
|
|
459
|
+
break;
|
|
460
|
+
case PaintBrushTypeEnum.Undo:
|
|
461
|
+
this.handleUndo(uuid);
|
|
462
|
+
break;
|
|
463
|
+
default:
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
handleDrawLine(_uuid, data, { withUndo = false }, callback = noop) {
|
|
468
|
+
if (!data || Object.prototype.toString.call(data) != '[object Object]' || Object.keys(data).length === 0) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
console.log('handleDrawLine', data, data.line);
|
|
472
|
+
queue(() => {
|
|
473
|
+
return new Promise((resolve) => {
|
|
474
|
+
if (!withUndo) {
|
|
475
|
+
if (!this.canvas[_uuid]) {
|
|
476
|
+
this.canvas[_uuid] = this.initCanvas('_paintBrush-canvas--sync');
|
|
477
|
+
}
|
|
478
|
+
if (!this.data[_uuid]) {
|
|
479
|
+
this.data[_uuid] = [];
|
|
480
|
+
}
|
|
481
|
+
this.data[_uuid].push(data);
|
|
482
|
+
}
|
|
483
|
+
if (!this.canvas[_uuid]) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const $ctx = this.canvas[_uuid].getContext('2d');
|
|
487
|
+
if (!$ctx)
|
|
488
|
+
return;
|
|
489
|
+
const { line = [], color = 'black', duration = 0, uuid } = data;
|
|
490
|
+
const move = unTransformCoords(data.move || {}, this.clientWidth, this.clientHeight);
|
|
491
|
+
let points = [move];
|
|
492
|
+
$ctx.strokeStyle = color;
|
|
493
|
+
$ctx.beginPath();
|
|
494
|
+
$ctx.moveTo(move.x, move.y);
|
|
495
|
+
if (duration && !withUndo) {
|
|
496
|
+
let drawCache = [];
|
|
497
|
+
const self = this;
|
|
498
|
+
self.tween = tween({ step: 0 }, { step: line.length - 1 }, duration)
|
|
499
|
+
.onUpdate(({ step }) => {
|
|
500
|
+
var _a;
|
|
501
|
+
self.tweening = true;
|
|
502
|
+
if (!self.ready) {
|
|
503
|
+
$ctx.clearRect(0, 0, self.canvas[uuid].width, self.canvas[uuid].height);
|
|
504
|
+
return (_a = self.tween) === null || _a === void 0 ? void 0 : _a.stop();
|
|
505
|
+
}
|
|
506
|
+
const i = Math.floor(step);
|
|
507
|
+
if (!drawCache.find((dc) => dc === i)) {
|
|
508
|
+
drawCache.push(i);
|
|
509
|
+
console.log('__debug__', line, line[i], i);
|
|
510
|
+
points.push(unTransformCoords(line[i], self.clientWidth, self.clientHeight));
|
|
511
|
+
if (points.length < 3)
|
|
512
|
+
return;
|
|
513
|
+
const { control, end } = getQuadraticCurvePoint(points);
|
|
514
|
+
if (!control || !end)
|
|
515
|
+
return;
|
|
516
|
+
$ctx.quadraticCurveTo(control.x, control.y, end.x, end.y);
|
|
517
|
+
$ctx.stroke();
|
|
518
|
+
}
|
|
519
|
+
})
|
|
520
|
+
.onComplete((e) => {
|
|
521
|
+
self.tween = undefined;
|
|
522
|
+
self.tweening = false;
|
|
523
|
+
drawCache = [];
|
|
524
|
+
points = [];
|
|
525
|
+
if (callback)
|
|
526
|
+
callback();
|
|
527
|
+
resolve();
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
for (let i = 0; i < line.length; i++) {
|
|
532
|
+
points.push(unTransformCoords(line[i], this.clientWidth, this.clientHeight));
|
|
533
|
+
if (points.length < 3)
|
|
534
|
+
continue;
|
|
535
|
+
const { control, end } = getQuadraticCurvePoint(points);
|
|
536
|
+
if (!control || !end)
|
|
537
|
+
continue;
|
|
538
|
+
$ctx.quadraticCurveTo(control.x, control.y, end.x, end.y);
|
|
539
|
+
}
|
|
540
|
+
$ctx.stroke();
|
|
541
|
+
points = [];
|
|
542
|
+
if (callback)
|
|
543
|
+
callback();
|
|
544
|
+
resolve();
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
handleUndo(uuid) {
|
|
550
|
+
console.log('handleUndo', uuid, this.canvas[uuid]);
|
|
551
|
+
if (!this.canvas[uuid] || !this.data[uuid] || this.data[uuid].length === 0) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
this.data[uuid].pop();
|
|
555
|
+
const handle = () => {
|
|
556
|
+
var _a;
|
|
557
|
+
const $ctx = (_a = this.canvas[uuid]) === null || _a === void 0 ? void 0 : _a.getContext('2d');
|
|
558
|
+
if ($ctx) {
|
|
559
|
+
$ctx.clearRect(0, 0, this.canvas[uuid].width, this.canvas[uuid].height);
|
|
560
|
+
}
|
|
561
|
+
this.data[uuid].forEach((ld) => this.handleDrawLine(uuid, ld, { withUndo: true }));
|
|
562
|
+
};
|
|
563
|
+
if (this.tween && this.tweening) {
|
|
564
|
+
this.tween.stop();
|
|
565
|
+
nextFrame(handle, 60);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
handle();
|
|
569
|
+
}
|
|
570
|
+
destroyBrush() {
|
|
571
|
+
this.closeBrush();
|
|
572
|
+
this.ready = false;
|
|
573
|
+
this.emit('readyChange', true);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare type EventMap = {
|
|
2
|
+
[name: string]: (...args: any[]) => void | boolean;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* 监听者模式
|
|
6
|
+
* @template T 预设的监听回调类型
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* new Subscribe<{
|
|
10
|
+
* "foo": [arg1: number, arg2: string],
|
|
11
|
+
* "bar": [arg: boolean],
|
|
12
|
+
* }>()
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class Subscribe<T extends EventMap> {
|
|
16
|
+
/**
|
|
17
|
+
* 判断是否注册了事件
|
|
18
|
+
* @param name 事件类型
|
|
19
|
+
*/
|
|
20
|
+
hasListener(name: keyof T): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 注册事件
|
|
23
|
+
* @param name 事件类型
|
|
24
|
+
* @param callback 事件回调函数
|
|
25
|
+
* @param once 是否只执行一次
|
|
26
|
+
* @returns 解除事件
|
|
27
|
+
* @template K 预设的监听事件名称
|
|
28
|
+
* @template C 回调函数函数上下文
|
|
29
|
+
*/
|
|
30
|
+
on<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>, once?: boolean): () => void;
|
|
31
|
+
/**
|
|
32
|
+
* 注册事件(是否只执行一次)
|
|
33
|
+
* @param name 事件类型
|
|
34
|
+
* @param callback 事件回调函数
|
|
35
|
+
* @returns 解除事件
|
|
36
|
+
* @template K 预设的监听事件名称
|
|
37
|
+
* @template C 回调函数函数上下文
|
|
38
|
+
*/
|
|
39
|
+
once<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>): () => void;
|
|
40
|
+
/**
|
|
41
|
+
* 解除事件
|
|
42
|
+
*
|
|
43
|
+
* 如果 name 不传的话解除对应所有事件
|
|
44
|
+
* 如果 name, callback 不传的话解除所有name的所有事件
|
|
45
|
+
* @param name 事件类型
|
|
46
|
+
* @param callback 事件回调函数
|
|
47
|
+
* @template K 预设的监听事件名称
|
|
48
|
+
*/
|
|
49
|
+
off<K extends keyof T>(name?: K, callback?: (...args: Parameters<T[K]>) => ReturnType<T[K]>): void;
|
|
50
|
+
/**
|
|
51
|
+
* 触发事件
|
|
52
|
+
* @param name 事件类型
|
|
53
|
+
* @param data 触发事件的数据
|
|
54
|
+
* @returns canceled 是否被触发取消
|
|
55
|
+
* @template K 预设的监听事件名称
|
|
56
|
+
*/
|
|
57
|
+
emit<K extends keyof T>(name: K, ...data: Parameters<T[K]>): boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare namespace SubscribeMixinType {
|
|
60
|
+
interface hasListener<T extends EventMap> {
|
|
61
|
+
(name: keyof T): boolean;
|
|
62
|
+
}
|
|
63
|
+
interface on<T extends EventMap> {
|
|
64
|
+
<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>, once?: boolean): () => void;
|
|
65
|
+
}
|
|
66
|
+
interface once<T extends EventMap> {
|
|
67
|
+
<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>): () => void;
|
|
68
|
+
}
|
|
69
|
+
interface off<T extends EventMap> {
|
|
70
|
+
<K extends keyof T>(names?: K | K[], callback?: (...args: any[]) => any): void;
|
|
71
|
+
}
|
|
72
|
+
interface emit<T extends EventMap> {
|
|
73
|
+
<K extends keyof T>(name: K, ...data: Parameters<T[K]>): boolean;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export { Subscribe };
|