@cornerstonejs/tools 0.56.2 → 0.56.4
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/package.json +5 -4
- package/src/constants/COLOR_LUT.ts +262 -0
- package/src/constants/index.ts +3 -0
- package/src/cursors/ImageMouseCursor.ts +39 -0
- package/src/cursors/MouseCursor.ts +114 -0
- package/src/cursors/SVGCursorDescriptor.ts +462 -0
- package/src/cursors/SVGMouseCursor.ts +145 -0
- package/src/cursors/elementCursor.ts +69 -0
- package/src/cursors/index.ts +24 -0
- package/src/cursors/setCursorForElement.ts +33 -0
- package/src/drawingSvg/_getHash.ts +9 -0
- package/src/drawingSvg/_setAttributesIfNecessary.ts +13 -0
- package/src/drawingSvg/_setNewAttributesIfValid.ts +10 -0
- package/src/drawingSvg/clearByToolType.ts +26 -0
- package/src/drawingSvg/draw.ts +16 -0
- package/src/drawingSvg/drawArrow.ts +82 -0
- package/src/drawingSvg/drawCircle.ts +62 -0
- package/src/drawingSvg/drawEllipse.ts +71 -0
- package/src/drawingSvg/drawHandles.ts +87 -0
- package/src/drawingSvg/drawLine.ts +70 -0
- package/src/drawingSvg/drawLink.ts +76 -0
- package/src/drawingSvg/drawLinkedTextBox.ts +64 -0
- package/src/drawingSvg/drawPolyline.ts +80 -0
- package/src/drawingSvg/drawRect.ts +70 -0
- package/src/drawingSvg/drawTextBox.ts +213 -0
- package/src/drawingSvg/getSvgDrawingHelper.ts +98 -0
- package/src/drawingSvg/index.ts +23 -0
- package/src/enums/AnnotationStyleStates.ts +22 -0
- package/src/enums/Events.ts +242 -0
- package/src/enums/SegmentationRepresentations.ts +12 -0
- package/src/enums/ToolBindings.ts +37 -0
- package/src/enums/ToolModes.ts +31 -0
- package/src/enums/Touch.ts +8 -0
- package/src/enums/index.js +16 -0
- package/src/eventDispatchers/annotationModifiedEventDispatcher.ts +41 -0
- package/src/eventDispatchers/cameraModifiedEventDispatcher.ts +41 -0
- package/src/eventDispatchers/imageRenderedEventDispatcher.ts +37 -0
- package/src/eventDispatchers/imageSpacingCalibratedEventDispatcher.ts +50 -0
- package/src/eventDispatchers/index.js +15 -0
- package/src/eventDispatchers/keyboardEventHandlers/index.js +4 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyDown.ts +29 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyUp.ts +33 -0
- package/src/eventDispatchers/keyboardToolEventDispatcher.ts +28 -0
- package/src/eventDispatchers/mouseEventHandlers/index.js +19 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseClick.ts +13 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDoubleClick.ts +13 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDown.ts +196 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDownActivate.ts +35 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDrag.ts +25 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseMove.ts +70 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseUp.ts +9 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseWheel.ts +13 -0
- package/src/eventDispatchers/mouseToolEventDispatcher.ts +64 -0
- package/src/eventDispatchers/shared/customCallbackHandler.ts +73 -0
- package/src/eventDispatchers/shared/getActiveToolForKeyboardEvent.ts +58 -0
- package/src/eventDispatchers/shared/getActiveToolForMouseEvent.ts +61 -0
- package/src/eventDispatchers/shared/getActiveToolForTouchEvent.ts +64 -0
- package/src/eventDispatchers/shared/getMouseModifier.ts +30 -0
- package/src/eventDispatchers/shared/getToolsWithModesForMouseEvent.ts +56 -0
- package/src/eventDispatchers/shared/getToolsWithModesForTouchEvent.ts +54 -0
- package/src/eventDispatchers/touchEventHandlers/index.js +15 -0
- package/src/eventDispatchers/touchEventHandlers/touchDrag.ts +23 -0
- package/src/eventDispatchers/touchEventHandlers/touchEnd.ts +9 -0
- package/src/eventDispatchers/touchEventHandlers/touchPress.ts +13 -0
- package/src/eventDispatchers/touchEventHandlers/touchStart.ts +174 -0
- package/src/eventDispatchers/touchEventHandlers/touchStartActivate.ts +36 -0
- package/src/eventDispatchers/touchEventHandlers/touchTap.ts +9 -0
- package/src/eventDispatchers/touchToolEventDispatcher.ts +51 -0
- package/src/eventListeners/annotations/annotationModifiedListener.ts +22 -0
- package/src/eventListeners/annotations/annotationSelectionListener.ts +29 -0
- package/src/eventListeners/annotations/index.ts +4 -0
- package/src/eventListeners/index.ts +28 -0
- package/src/eventListeners/keyboard/index.ts +16 -0
- package/src/eventListeners/keyboard/keyDownListener.ts +99 -0
- package/src/eventListeners/mouse/getMouseEventPoints.ts +66 -0
- package/src/eventListeners/mouse/index.ts +55 -0
- package/src/eventListeners/mouse/mouseDoubleClickListener.ts +55 -0
- package/src/eventListeners/mouse/mouseDownListener.ts +519 -0
- package/src/eventListeners/mouse/mouseMoveListener.ts +33 -0
- package/src/eventListeners/segmentation/index.ts +11 -0
- package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +61 -0
- package/src/eventListeners/segmentation/segmentationModifiedEventListener.ts +32 -0
- package/src/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.ts +15 -0
- package/src/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.ts +16 -0
- package/src/eventListeners/touch/getTouchEventPoints.ts +75 -0
- package/src/eventListeners/touch/index.ts +37 -0
- package/src/eventListeners/touch/preventGhostClick.js +72 -0
- package/src/eventListeners/touch/touchStartListener.ts +499 -0
- package/src/eventListeners/wheel/index.ts +27 -0
- package/src/eventListeners/wheel/normalizeWheel.ts +69 -0
- package/src/eventListeners/wheel/wheelListener.ts +51 -0
- package/src/index.ts +133 -0
- package/src/init.ts +187 -0
- package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +399 -0
- package/src/stateManagement/annotation/annotationLocking.ts +178 -0
- package/src/stateManagement/annotation/annotationSelection.ts +163 -0
- package/src/stateManagement/annotation/annotationState.ts +180 -0
- package/src/stateManagement/annotation/annotationVisibility.ts +156 -0
- package/src/stateManagement/annotation/config/ToolStyle.ts +265 -0
- package/src/stateManagement/annotation/config/getFont.ts +36 -0
- package/src/stateManagement/annotation/config/getState.ts +26 -0
- package/src/stateManagement/annotation/config/helpers.ts +55 -0
- package/src/stateManagement/annotation/config/index.ts +5 -0
- package/src/stateManagement/annotation/helpers/state.ts +83 -0
- package/src/stateManagement/annotation/index.ts +15 -0
- package/src/stateManagement/index.js +40 -0
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +491 -0
- package/src/stateManagement/segmentation/activeSegmentation.ts +60 -0
- package/src/stateManagement/segmentation/addSegmentationRepresentations.ts +77 -0
- package/src/stateManagement/segmentation/addSegmentations.ts +27 -0
- package/src/stateManagement/segmentation/config/index.ts +29 -0
- package/src/stateManagement/segmentation/config/segmentationColor.ts +132 -0
- package/src/stateManagement/segmentation/config/segmentationConfig.ts +195 -0
- package/src/stateManagement/segmentation/config/segmentationVisibility.ts +171 -0
- package/src/stateManagement/segmentation/helpers/index.ts +3 -0
- package/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts +35 -0
- package/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts +41 -0
- package/src/stateManagement/segmentation/index.ts +22 -0
- package/src/stateManagement/segmentation/removeSegmentationsFromToolGroup.ts +85 -0
- package/src/stateManagement/segmentation/segmentIndex.ts +38 -0
- package/src/stateManagement/segmentation/segmentLocking.ts +72 -0
- package/src/stateManagement/segmentation/segmentationState.ts +429 -0
- package/src/stateManagement/segmentation/triggerSegmentationEvents.ts +157 -0
- package/src/store/SynchronizerManager/Synchronizer.ts +344 -0
- package/src/store/SynchronizerManager/createSynchronizer.ts +41 -0
- package/src/store/SynchronizerManager/destroy.ts +14 -0
- package/src/store/SynchronizerManager/destroySynchronizer.ts +25 -0
- package/src/store/SynchronizerManager/getAllSynchronizers.ts +12 -0
- package/src/store/SynchronizerManager/getSynchronizer.ts +13 -0
- package/src/store/SynchronizerManager/getSynchronizersForViewport.ts +44 -0
- package/src/store/SynchronizerManager/index.js +15 -0
- package/src/store/ToolGroupManager/ToolGroup.ts +679 -0
- package/src/store/ToolGroupManager/createToolGroup.ts +33 -0
- package/src/store/ToolGroupManager/destroy.ts +24 -0
- package/src/store/ToolGroupManager/destroyToolGroup.ts +26 -0
- package/src/store/ToolGroupManager/getAllToolGroups.ts +12 -0
- package/src/store/ToolGroupManager/getToolGroup.ts +14 -0
- package/src/store/ToolGroupManager/getToolGroupForViewport.ts +44 -0
- package/src/store/ToolGroupManager/getToolGroupsWithToolName.ts +33 -0
- package/src/store/ToolGroupManager/index.ts +17 -0
- package/src/store/addEnabledElement.ts +137 -0
- package/src/store/addTool.ts +56 -0
- package/src/store/cancelActiveManipulations.ts +30 -0
- package/src/store/filterMoveableAnnotationTools.ts +61 -0
- package/src/store/filterToolsWithAnnotationsForElement.ts +51 -0
- package/src/store/filterToolsWithMoveableHandles.ts +51 -0
- package/src/store/index.ts +29 -0
- package/src/store/removeEnabledElement.ts +132 -0
- package/src/store/state.ts +57 -0
- package/src/store/svgNodeCache.ts +7 -0
- package/src/synchronizers/callbacks/areViewportsCoplanar .ts +12 -0
- package/src/synchronizers/callbacks/cameraSyncCallback.ts +33 -0
- package/src/synchronizers/callbacks/stackImageSyncCallback.ts +157 -0
- package/src/synchronizers/callbacks/voiSyncCallback.ts +51 -0
- package/src/synchronizers/callbacks/zoomPanSyncCallback.ts +43 -0
- package/src/synchronizers/index.ts +11 -0
- package/src/synchronizers/synchronizers/createCameraPositionSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/createStackImageSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/createVOISynchronizer.ts +24 -0
- package/src/synchronizers/synchronizers/createZoomPanSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/index.ts +11 -0
- package/src/tools/CrosshairsTool.ts +2693 -0
- package/src/tools/MIPJumpToClickTool.ts +99 -0
- package/src/tools/MagnifyTool.ts +319 -0
- package/src/tools/PanTool.ts +58 -0
- package/src/tools/PlanarRotateTool.ts +77 -0
- package/src/tools/ReferenceCursors.ts +466 -0
- package/src/tools/ReferenceLinesTool.ts +279 -0
- package/src/tools/ScaleOverlayTool.ts +685 -0
- package/src/tools/StackScrollTool.ts +97 -0
- package/src/tools/StackScrollToolMouseWheelTool.ts +58 -0
- package/src/tools/TrackballRotateTool.ts +141 -0
- package/src/tools/VolumeRotateMouseWheelTool.ts +86 -0
- package/src/tools/WindowLevelTool.ts +260 -0
- package/src/tools/ZoomTool.ts +293 -0
- package/src/tools/annotation/AngleTool.ts +835 -0
- package/src/tools/annotation/ArrowAnnotateTool.ts +820 -0
- package/src/tools/annotation/BidirectionalTool.ts +1350 -0
- package/src/tools/annotation/CircleROITool.ts +1070 -0
- package/src/tools/annotation/CobbAngleTool.ts +815 -0
- package/src/tools/annotation/DragProbeTool.ts +213 -0
- package/src/tools/annotation/EllipticalROITool.ts +1223 -0
- package/src/tools/annotation/LengthTool.ts +861 -0
- package/src/tools/annotation/PlanarFreehandROITool.ts +636 -0
- package/src/tools/annotation/ProbeTool.ts +681 -0
- package/src/tools/annotation/RectangleROITool.ts +1028 -0
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +488 -0
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +462 -0
- package/src/tools/annotation/planarFreehandROITool/editLoopCommon.ts +331 -0
- package/src/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.ts +74 -0
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +612 -0
- package/src/tools/annotation/planarFreehandROITool/openContourEndEditLoop.ts +74 -0
- package/src/tools/annotation/planarFreehandROITool/renderMethods.ts +407 -0
- package/src/tools/base/AnnotationDisplayTool.ts +228 -0
- package/src/tools/base/AnnotationTool.ts +307 -0
- package/src/tools/base/BaseTool.ts +215 -0
- package/src/tools/base/index.ts +4 -0
- package/src/tools/displayTools/Contour/addContourToElement.ts +135 -0
- package/src/tools/displayTools/Contour/contourDisplay.ts +252 -0
- package/src/tools/displayTools/Contour/index.ts +3 -0
- package/src/tools/displayTools/Contour/removeContourFromElement.ts +35 -0
- package/src/tools/displayTools/Labelmap/addLabelmapToElement.ts +57 -0
- package/src/tools/displayTools/Labelmap/index.ts +4 -0
- package/src/tools/displayTools/Labelmap/labelmapConfig.ts +37 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +461 -0
- package/src/tools/displayTools/Labelmap/removeLabelmapFromElement.ts +27 -0
- package/src/tools/displayTools/Labelmap/validateRepresentationData.ts +30 -0
- package/src/tools/displayTools/SegmentationDisplayTool.ts +198 -0
- package/src/tools/index.ts +84 -0
- package/src/tools/segmentation/BrushTool.ts +474 -0
- package/src/tools/segmentation/CircleScissorsTool.ts +365 -0
- package/src/tools/segmentation/PaintFillTool.ts +370 -0
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +471 -0
- package/src/tools/segmentation/RectangleROIThresholdTool.ts +281 -0
- package/src/tools/segmentation/RectangleScissorsTool.ts +382 -0
- package/src/tools/segmentation/SphereScissorsTool.ts +368 -0
- package/src/tools/segmentation/strategies/eraseCircle.ts +30 -0
- package/src/tools/segmentation/strategies/eraseRectangle.ts +81 -0
- package/src/tools/segmentation/strategies/eraseSphere.ts +27 -0
- package/src/tools/segmentation/strategies/fillCircle.ts +185 -0
- package/src/tools/segmentation/strategies/fillRectangle.ts +110 -0
- package/src/tools/segmentation/strategies/fillSphere.ts +88 -0
- package/src/tools/segmentation/strategies/index.ts +9 -0
- package/src/types/AnnotationGroupSelector.ts +7 -0
- package/src/types/AnnotationStyle.ts +42 -0
- package/src/types/AnnotationTypes.ts +109 -0
- package/src/types/BoundsIJK.ts +5 -0
- package/src/types/CINETypes.ts +32 -0
- package/src/types/ContourTypes.ts +26 -0
- package/src/types/CursorTypes.ts +12 -0
- package/src/types/EventTypes.ts +657 -0
- package/src/types/FloodFillTypes.ts +19 -0
- package/src/types/IAnnotationManager.ts +89 -0
- package/src/types/IDistance.ts +16 -0
- package/src/types/IPoints.ts +18 -0
- package/src/types/ISetToolModeOptions.ts +29 -0
- package/src/types/ISynchronizerEventHandler.ts +11 -0
- package/src/types/IToolClassReference.ts +5 -0
- package/src/types/IToolGroup.ts +72 -0
- package/src/types/ITouchPoints.ts +14 -0
- package/src/types/InteractionTypes.ts +6 -0
- package/src/types/InternalToolTypes.ts +19 -0
- package/src/types/JumpToSliceOptions.ts +7 -0
- package/src/types/LabelmapTypes.ts +41 -0
- package/src/types/PlanarBoundingBox.ts +8 -0
- package/src/types/SVGDrawingHelper.ts +10 -0
- package/src/types/ScrollOptions.ts +9 -0
- package/src/types/SegmentationStateTypes.ts +248 -0
- package/src/types/ToolHandle.ts +26 -0
- package/src/types/ToolProps.ts +16 -0
- package/src/types/ToolSpecificAnnotationTypes.ts +311 -0
- package/src/types/index.ts +115 -0
- package/src/utilities/boundingBox/extend2DBoundingBoxInViewAxis.ts +29 -0
- package/src/utilities/boundingBox/getBoundingBoxAroundShape.ts +57 -0
- package/src/utilities/boundingBox/index.ts +4 -0
- package/src/utilities/calibrateImageSpacing.ts +46 -0
- package/src/utilities/cine/events.ts +9 -0
- package/src/utilities/cine/index.ts +5 -0
- package/src/utilities/cine/playClip.ts +435 -0
- package/src/utilities/cine/state.ts +18 -0
- package/src/utilities/clip.js +30 -0
- package/src/utilities/debounce.js +217 -0
- package/src/utilities/drawing/getTextBoxCoordsCanvas.ts +45 -0
- package/src/utilities/drawing/index.ts +3 -0
- package/src/utilities/dynamicVolume/getDataInTime.ts +110 -0
- package/src/utilities/dynamicVolume/index.ts +2 -0
- package/src/utilities/getAnnotationNearPoint.ts +130 -0
- package/src/utilities/getModalityUnit.ts +11 -0
- package/src/utilities/getToolsWithModesForElement.ts +52 -0
- package/src/utilities/index.ts +68 -0
- package/src/utilities/isObject.js +29 -0
- package/src/utilities/math/angle/angleBetweenLines.ts +29 -0
- package/src/utilities/math/circle/_types.ts +6 -0
- package/src/utilities/math/circle/getCanvasCircleCorners.ts +23 -0
- package/src/utilities/math/circle/getCanvasCircleRadius.ts +16 -0
- package/src/utilities/math/circle/index.ts +4 -0
- package/src/utilities/math/ellipse/getCanvasEllipseCorners.ts +26 -0
- package/src/utilities/math/ellipse/index.ts +4 -0
- package/src/utilities/math/ellipse/pointInEllipse.ts +38 -0
- package/src/utilities/math/ellipse/pointInEllipsoidWithConstraint.ts +35 -0
- package/src/utilities/math/index.ts +8 -0
- package/src/utilities/math/line/distanceToPoint.ts +24 -0
- package/src/utilities/math/line/distanceToPointSquared.ts +44 -0
- package/src/utilities/math/line/index.ts +5 -0
- package/src/utilities/math/line/intersectLine.ts +92 -0
- package/src/utilities/math/midPoint.ts +24 -0
- package/src/utilities/math/point/distanceToPoint.ts +22 -0
- package/src/utilities/math/point/index.ts +3 -0
- package/src/utilities/math/polyline/addCanvasPointsToArray.ts +62 -0
- package/src/utilities/math/polyline/calculateAreaOfPoints.ts +23 -0
- package/src/utilities/math/polyline/getIntersectionWithPolyline.ts +182 -0
- package/src/utilities/math/polyline/getSubPixelSpacingAndXYDirections.ts +99 -0
- package/src/utilities/math/polyline/index.ts +19 -0
- package/src/utilities/math/polyline/planarFreehandROIInternalTypes.ts +36 -0
- package/src/utilities/math/polyline/pointCanProjectOnLine.ts +57 -0
- package/src/utilities/math/polyline/pointsAreWithinCloseContourProximity.ts +15 -0
- package/src/utilities/math/rectangle/distanceToPoint.ts +82 -0
- package/src/utilities/math/rectangle/index.ts +3 -0
- package/src/utilities/math/sphere/index.ts +3 -0
- package/src/utilities/math/sphere/pointInSphere.ts +31 -0
- package/src/utilities/math/vec2/findClosestPoint.ts +40 -0
- package/src/utilities/math/vec2/index.ts +4 -0
- package/src/utilities/math/vec2/liangBarksyClip.ts +84 -0
- package/src/utilities/orientation/getOrientationStringLPS.ts +52 -0
- package/src/utilities/orientation/index.ts +4 -0
- package/src/utilities/orientation/invertOrientationStringLPS.ts +21 -0
- package/src/utilities/planar/filterAnnotationsForDisplay.ts +68 -0
- package/src/utilities/planar/filterAnnotationsWithinSlice.ts +85 -0
- package/src/utilities/planar/getPointInLineOfSightWithCriteria.ts +104 -0
- package/src/utilities/planar/getWorldWidthAndHeightFromCorners.ts +51 -0
- package/src/utilities/planar/getWorldWidthAndHeightFromTwoPoints.ts +51 -0
- package/src/utilities/planar/index.ts +18 -0
- package/src/utilities/planarFreehandROITool/index.ts +7 -0
- package/src/utilities/planarFreehandROITool/interpolateAnnotation.ts +87 -0
- package/src/utilities/planarFreehandROITool/interpolatePoints.ts +214 -0
- package/src/utilities/planarFreehandROITool/interpolation/algorithms/bspline.ts +55 -0
- package/src/utilities/planarFreehandROITool/interpolation/interpolateSegmentPoints.ts +90 -0
- package/src/utilities/pointInShapeCallback.ts +138 -0
- package/src/utilities/pointInSurroundingSphereCallback.ts +188 -0
- package/src/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.ts +76 -0
- package/src/utilities/rectangleROITool/index.ts +3 -0
- package/src/utilities/scroll.ts +62 -0
- package/src/utilities/segmentation/brushSizeForToolGroup.ts +72 -0
- package/src/utilities/segmentation/brushThresholdForToolGroup.ts +65 -0
- package/src/utilities/segmentation/createLabelmapVolumeForViewport.ts +74 -0
- package/src/utilities/segmentation/createMergedLabelmapForIndex.ts +65 -0
- package/src/utilities/segmentation/floodFill.ts +194 -0
- package/src/utilities/segmentation/getDefaultRepresentationConfig.ts +20 -0
- package/src/utilities/segmentation/index.ts +33 -0
- package/src/utilities/segmentation/isValidRepresentationConfig.ts +22 -0
- package/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts +91 -0
- package/src/utilities/segmentation/thresholdSegmentationByRange.ts +129 -0
- package/src/utilities/segmentation/thresholdVolumeByRange.ts +150 -0
- package/src/utilities/segmentation/triggerSegmentationRender.ts +206 -0
- package/src/utilities/segmentation/utilities.ts +116 -0
- package/src/utilities/stackPrefetch/index.ts +8 -0
- package/src/utilities/stackPrefetch/stackPrefetch.ts +405 -0
- package/src/utilities/stackPrefetch/state.ts +17 -0
- package/src/utilities/throttle.js +69 -0
- package/src/utilities/touch/index.ts +246 -0
- package/src/utilities/triggerAnnotationRender.ts +237 -0
- package/src/utilities/triggerAnnotationRenderForViewportIds.ts +18 -0
- package/src/utilities/viewport/index.ts +5 -0
- package/src/utilities/viewport/isViewportPreScaled.ts +24 -0
- package/src/utilities/viewport/jumpToSlice.ts +73 -0
- package/src/utilities/viewport/jumpToWorld.ts +58 -0
- package/src/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.ts +28 -0
- package/src/utilities/viewportFilters/filterViewportsWithParallelNormals.ts +26 -0
- package/src/utilities/viewportFilters/filterViewportsWithSameOrientation.ts +15 -0
- package/src/utilities/viewportFilters/filterViewportsWithToolEnabled.ts +72 -0
- package/src/utilities/viewportFilters/getViewportIdsWithToolToRender.ts +45 -0
- package/src/utilities/viewportFilters/index.ts +11 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { SVGCursorDescriptor } from '../types';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Definitions
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const BASE: SVGCursorDescriptor = {
|
|
8
|
+
iconContent: '',
|
|
9
|
+
iconSize: 16,
|
|
10
|
+
viewBox: {
|
|
11
|
+
x: 16,
|
|
12
|
+
y: 16,
|
|
13
|
+
},
|
|
14
|
+
mousePoint: {
|
|
15
|
+
x: 8,
|
|
16
|
+
y: 8,
|
|
17
|
+
},
|
|
18
|
+
mousePointerGroupString: `
|
|
19
|
+
<path stroke="{{color}}" d="M8 16L8 0"></path>
|
|
20
|
+
<path stroke="{{color}}" d="M16 8L0 8"></path>
|
|
21
|
+
`,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const SEGMENTATION_CURSOR_BOUNDARIES = {
|
|
25
|
+
x: 127,
|
|
26
|
+
y: 60,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const MINUS_RECT = `
|
|
30
|
+
<rect fill="{{color}}" x="80.19" y="25.03" width="47.14" height="15.85"/>
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const PLUS_RECT = `
|
|
34
|
+
<rect fill="{{color}}" x="80.19" y="25.03" width="47.14" height="15.85"/>
|
|
35
|
+
<rect fill="{{color}}" x="95.84" y="9.38" width="15.85" height="47.14"/>
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const SCISSOR_ICON = `<path fill="{{color}}" d="M82.89,10a12.09,12.09,0,0,0-16.8-2.5l-27.5,20.4-8.5-6.3a2.93,2.93,0,0,1-1.1-3,14.66,14.66,0,0,0,.1-6.6,14.08,14.08,0,1,0-6.5,15.2,2.87,2.87,0,0,1,3.2.2l8.2,6.1-8.2,6.1a2.87,2.87,0,0,1-3.2.2,14.16,14.16,0,1,0,6.7,14.4,14,14,0,0,0-.3-5.8,2.93,2.93,0,0,1,1.1-3l8.5-6.3,27.5,20.4A11.91,11.91,0,0,0,82.89,57l-31.7-23.5ZM15.29,21a5.9,5.9,0,1,1,5.9-5.9A5.91,5.91,0,0,1,15.29,21Zm0,36.8a5.9,5.9,0,1,1,5.9-5.9A5.91,5.91,0,0,1,15.29,57.77Zm28.3-21.5a2.8,2.8,0,1,1,2.8-2.8A2.8,2.8,0,0,1,43.59,36.27Z" transform="translate(-1.17 -0.96)"/>`;
|
|
39
|
+
const RECTANGLE_ICON = `<path fill="{{color}}" d="M8.86,2.25V66.08H72.69V2.25H8.86ZM65.28,58.67h-49v-49h49v49Z" transform="translate(-8.86 -2.25)"/>`;
|
|
40
|
+
const CIRCLE_ICON = `<path fill="{{color}}" d="M40.77,2.25A31.92,31.92,0,1,0,72.69,34.16,31.92,31.92,0,0,0,40.77,2.25Zm0,57.63A25.71,25.71,0,1,1,66.48,34.16,25.71,25.71,0,0,1,40.77,59.87Z" transform="translate(-8.86 -2.25)"/>`;
|
|
41
|
+
|
|
42
|
+
const CursorSVG = {
|
|
43
|
+
Angle: extend(BASE, {
|
|
44
|
+
iconContent: `<path fill="{{color}}" d="M1203 544q0 13-10 23l-393 393 393 393q10 10 10 23t-10 23l-50
|
|
45
|
+
50q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l466-466q10-10 23-10t23
|
|
46
|
+
10l50 50q10 10 10 23z" />`,
|
|
47
|
+
viewBox: {
|
|
48
|
+
x: 1792,
|
|
49
|
+
y: 1792,
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
ArrowAnnotate: extend(BASE, {
|
|
53
|
+
iconContent: `<g id="arrowAnnotate-group" fill="none" stroke-width="1" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
|
|
54
|
+
<path id="arrowAnnotate-arrow" d="M23,7 l-15,15 M7,17 l0,6 6,0" stroke-width="2" />
|
|
55
|
+
</g>`,
|
|
56
|
+
viewBox: {
|
|
57
|
+
x: 24,
|
|
58
|
+
y: 24,
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
Bidirectional: extend(BASE, {
|
|
62
|
+
iconContent: `<g fill="{{color}}" stroke-width="3" stroke="{{color}}">
|
|
63
|
+
<path d="M27.63 3.21L3.12 28.81"></path>
|
|
64
|
+
<path d="M27.63 15.75L15.27 4.43"></path>
|
|
65
|
+
<path d="M16.5 4.28C16.5 4.96 15.95 5.51 15.27 5.51C14.59 5.51 14.03 4.96 14.03 4.28C14.03 3.59 14.59 3.04 15.27 3.04C15.95 3.04 16.5 3.59 16.5 4.28Z" ></path>
|
|
66
|
+
<path d="M28.87 3.19C28.87 3.87 28.31 4.43 27.63 4.43C26.95 4.43 26.4 3.87 26.4 3.19C26.4 2.51 26.95 1.95 27.63 1.95C28.31 1.95 28.87 2.51 28.87 3.19Z"></path>
|
|
67
|
+
<path d="M28.87 15.75C28.87 16.43 28.31 16.99 27.63 16.99C26.95 16.99 26.4 16.43 26.4 15.75C26.4 15.07 26.95 14.51 27.63 14.51C28.31 14.51 28.87 15.07 28.87 15.75Z"></path>
|
|
68
|
+
<path d="M4.73 28.44C4.73 29.12 4.17 29.68 3.49 29.68C2.81 29.68 2.25 29.12 2.25 28.44C2.25 27.76 2.81 27.2 3.49 27.2C4.17 27.2 4.73 27.76 4.73 28.44Z"></path>
|
|
69
|
+
</g>`,
|
|
70
|
+
viewBox: {
|
|
71
|
+
x: 48,
|
|
72
|
+
y: 48,
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
CobbAngle: extend(BASE, {
|
|
76
|
+
iconContent: `<g stroke="{{color}}" stroke-width="3">
|
|
77
|
+
<path d="M28.59 2.34L3.82 12.32"></path>
|
|
78
|
+
<path d="M28.59 29.66L3.82 19.68"></path>
|
|
79
|
+
<path stroke-dasharray="2" fill-opacity="0" d="M12.37
|
|
80
|
+
23.06C12.67 22.36 12.85 21.93 12.92 21.76C14.6 17.8 14.68 13.35 13.15
|
|
81
|
+
9.33C13.11 9.24 13.02 9 12.88 8.63">
|
|
82
|
+
</path>
|
|
83
|
+
</g>`,
|
|
84
|
+
viewBox: {
|
|
85
|
+
x: 32,
|
|
86
|
+
y: 32,
|
|
87
|
+
},
|
|
88
|
+
}),
|
|
89
|
+
CircleROI: extend(BASE, {
|
|
90
|
+
iconContent: `<circle stroke="{{color}}" fill="none" stroke-width="3" cx="16" cy="16" r="14" />`,
|
|
91
|
+
viewBox: {
|
|
92
|
+
x: 32,
|
|
93
|
+
y: 32,
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
EllipticalROI: extend(BASE, {
|
|
97
|
+
iconContent: `<path stroke="{{color}}" fill="none" stroke-width="3" d="M30.74 15.76C30.74 20.99 24.14 25.23 16
|
|
98
|
+
25.23C7.86 25.23 1.26 20.99 1.26 15.76C1.26 10.54 7.86 6.3 16 6.3C24.14
|
|
99
|
+
6.3 30.74 10.54 30.74 15.76Z" />`,
|
|
100
|
+
viewBox: {
|
|
101
|
+
x: 32,
|
|
102
|
+
y: 32,
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
FreehandROI: extend(BASE, {
|
|
106
|
+
iconContent: `<g fill="{{color}}" stroke="{{color}}" stroke-width="2">
|
|
107
|
+
<ellipse ry="1" rx="1" id="svg_3" cy="4.240343" cx="14.306499"/>
|
|
108
|
+
<line id="svg_4" y2="3.58462" x2="12.242186" y1="3.997482" x1="13.432202"/>
|
|
109
|
+
<line id="svg_5" y2="3.268901" x2="10.857882" y1="3.608906" x1="12.387902"/>
|
|
110
|
+
<line id="svg_6" y2="3.147471" x2="9.740724" y1="3.293187" x1="10.955026"/>
|
|
111
|
+
<line id="svg_7" y2="3.147471" x2="8.089274" y1="3.196043" x1="9.983585"/>
|
|
112
|
+
<line id="svg_8" y2="3.268901" x2="6.874972" y1="3.123185" x1="8.307848"/>
|
|
113
|
+
<line id="svg_9" y2="3.657478" x2="5.587812" y1="3.220329" x1="7.020688"/>
|
|
114
|
+
<line id="svg_10" y2="4.046054" x2="4.737801" y1="3.560334" x1="5.854959"/>
|
|
115
|
+
<line id="svg_11" y2="4.337487" x2="4.300652" y1="3.997482" x1="4.834945"/>
|
|
116
|
+
<line id="svg_12" y2="4.726063" x2="3.88779" y1="4.191771" x1="4.470655"/>
|
|
117
|
+
<line id="svg_15" y2="5.3575" x2="3.377783" y1="4.604633" x1="3.960648"/>
|
|
118
|
+
<line id="svg_16" y2="6.183226" x2="2.916348" y1="5.138926" x1="3.547785"/>
|
|
119
|
+
<line id="svg_17" y2="6.960379" x2="2.770632" y1="5.867507" x1="3.037779"/>
|
|
120
|
+
<line id="svg_18" y2="7.713246" x2="2.673488" y1="6.741804" x1="2.819204"/>
|
|
121
|
+
<line id="svg_19" y2="8.684687" x2="2.697774" y1="7.616102" x1="2.673488"/>
|
|
122
|
+
<line id="svg_20" y2="9.753273" x2="2.892062" y1="8.611829" x1="2.697774"/>
|
|
123
|
+
<line id="svg_21" y2="10.724714" x2="3.134923" y1="9.534698" x1="2.84349"/>
|
|
124
|
+
<line id="svg_23" y2="11.647583" x2="3.596357" y1="10.578998" x1="3.086351"/>
|
|
125
|
+
<line id="svg_25" y2="12.521881" x2="4.276366" y1="11.501867" x1="3.499213"/>
|
|
126
|
+
<line id="svg_26" y2="13.930471" x2="5.830673" y1="12.376165" x1="4.13065"/>
|
|
127
|
+
<line id="svg_28" y2="14.707624" x2="7.263549" y1="13.881899" x1="5.733528"/>
|
|
128
|
+
<line id="svg_29" y2="15.339061" x2="8.963571" y1="14.61048" x1="7.06926"/>
|
|
129
|
+
<line id="svg_30" y2="15.581921" x2="10.882168" y1="15.314775" x1="8.817855"/>
|
|
130
|
+
<line id="svg_31" y2="15.460491" x2="12.023612" y1="15.581921" x1="10.785024"/>
|
|
131
|
+
<line id="svg_33" y2="15.120487" x2="13.092197" y1="15.484777" x1="11.877895"/>
|
|
132
|
+
<line id="svg_34" y2="14.586194" x2="13.86935" y1="15.217631" x1="12.897909"/>
|
|
133
|
+
<line id="svg_35" y2="13.833327" x2="14.597931" y1="14.756196" x1="13.699348"/>
|
|
134
|
+
<line id="svg_37" y2="12.716169" x2="15.180796" y1="13.881899" x1="14.549359"/>
|
|
135
|
+
<line id="svg_39" y2="11.429009" x2="15.520801" y1="12.813313" x1="15.15651"/>
|
|
136
|
+
<ellipse ry="1" rx="1" id="svg_40" cy="10.967574" cx="15.520801"/>
|
|
137
|
+
</g>`,
|
|
138
|
+
viewBox: {
|
|
139
|
+
x: 18,
|
|
140
|
+
y: 18,
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
FreehandROISculptor: extend(BASE, {
|
|
144
|
+
iconContent: `<g id="icon-freehand-sculpt" fill="none" stroke-width="1.5" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
|
|
145
|
+
<line id="svg_1" y2="2.559367" x2="10.184807" y1="4.467781" x1="8.81711"/>
|
|
146
|
+
<line id="svg_4" y2="1.493836" x2="11.727442" y1="2.766112" x1="10.089386"/>
|
|
147
|
+
<line id="svg_7" y2="1.080346" x2="13.047428" y1="1.748291" x1="11.345759"/>
|
|
148
|
+
<line id="svg_8" y2="1.000829" x2="14.351511" y1="1.112153" x1="12.77707"/>
|
|
149
|
+
<line id="svg_9" y2="1.350705" x2="15.242104" y1="0.905408" x1="13.969828"/>
|
|
150
|
+
<line id="svg_10" y2="2.098167" x2="15.862339" y1="1.14396" x1="14.955842"/>
|
|
151
|
+
<line id="svg_11" y2="3.195505" x2="16.41896" y1="1.939133" x1="15.766918"/>
|
|
152
|
+
<line id="svg_12" y2="4.292843" x2="16.530284" y1="2.925147" x1="16.387153"/>
|
|
153
|
+
<line id="svg_16" y2="5.644637" x2="16.196311" y1="3.831643" x1="16.593898"/>
|
|
154
|
+
<line id="svg_18" y2="7.266789" x2="15.623787" y1="5.19934" x1="16.275829"/>
|
|
155
|
+
<line id="svg_19" y2="10.813258" x2="14.526449" y1="6.726071" x1="15.766918"/>
|
|
156
|
+
<line id="svg_20" y2="5.056209" x2="8.085552" y1="4.181519" x1="8.976145"/>
|
|
157
|
+
<line id="svg_23" y2="5.326568" x2="7.481221" y1="4.78585" x1="8.403621"/>
|
|
158
|
+
<line id="svg_24" y2="5.565119" x2="6.749662" y1="5.294761" x1="7.624352"/>
|
|
159
|
+
<line id="svg_25" y2="5.994512" x2="5.429675" y1="5.533312" x1="6.956407"/>
|
|
160
|
+
<line id="svg_27" y2="6.551133" x2="4.284627" y1="5.962706" x1="5.572807"/>
|
|
161
|
+
<line id="svg_28" y2="7.584858" x2="3.044158" y1="6.392099" x1="4.427758"/>
|
|
162
|
+
<line id="svg_29" y2="8.84123" x2="2.185372" y1="7.489437" x1="3.219096"/>
|
|
163
|
+
<line id="svg_31" y2="10.606513" x2="1.644654" y1="8.602678" x1="2.280792"/>
|
|
164
|
+
<line id="svg_32" y2="13.214679" x2="1.48562" y1="10.352058" x1="1.724171"/>
|
|
165
|
+
<line id="svg_33" y2="14.375631" x2="1.676461" y1="12.992031" x1="1.453813"/>
|
|
166
|
+
<line id="svg_34" y2="15.298031" x2="2.264889" y1="14.152983" x1="1.517427"/>
|
|
167
|
+
<line id="svg_35" y2="16.172721" x2="3.521261" y1="14.948155" x1="1.915013"/>
|
|
168
|
+
<line id="svg_36" y2="16.824762" x2="5.207027" y1="15.997783" x1="3.28271"/>
|
|
169
|
+
<line id="svg_38" y2="17.063314" x2="7.035924" y1="16.745245" x1="4.968475"/>
|
|
170
|
+
<line id="svg_39" y2="16.888376" x2="9.278311" y1="17.047411" x1="6.733758"/>
|
|
171
|
+
<line id="svg_40" y2="16.284045" x2="10.661911" y1="16.983797" x1="8.992048"/>
|
|
172
|
+
<line id="svg_41" y2="15.313934" x2="11.647925" y1="16.395369" x1="10.455166"/>
|
|
173
|
+
<line id="svg_44" y2="13.898527" x2="12.82478" y1="15.425259" x1="11.504794"/>
|
|
174
|
+
<line id="svg_45" y2="12.037824" x2="14.144766" y1="14.312017" x1="12.522614"/>
|
|
175
|
+
<line id="svg_47" y2="10.59061" x2="14.605966" y1="12.228665" x1="13.953925"/>
|
|
176
|
+
<ellipse ry="1" rx="1" id="svg_48" cy="3.982726" cx="13.460918"/>
|
|
177
|
+
</g>`,
|
|
178
|
+
viewBox: {
|
|
179
|
+
x: 18,
|
|
180
|
+
y: 18,
|
|
181
|
+
},
|
|
182
|
+
}),
|
|
183
|
+
Length: extend(BASE, {
|
|
184
|
+
iconContent: `<g id="length-group" fill="none" stroke-width="1" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
|
|
185
|
+
<path id="length-dashes" d="m22.5,6 -16.5,16.5" stroke-width="3" stroke-dasharray="0.6666,5" />
|
|
186
|
+
</g>`,
|
|
187
|
+
viewBox: {
|
|
188
|
+
x: 24,
|
|
189
|
+
y: 24,
|
|
190
|
+
},
|
|
191
|
+
}),
|
|
192
|
+
Probe: extend(BASE, {
|
|
193
|
+
iconContent: `<path fill="{{color}}" d="M1152 896q0 106-75 181t-181 75-181-75-75-181 75-181 181-75 181 75
|
|
194
|
+
75 181zm-256-544q-148 0-273 73t-198 198-73 273 73 273 198 198 273 73 273-73
|
|
195
|
+
198-198 73-273-73-273-198-198-273-73zm768 544q0 209-103 385.5t-279.5
|
|
196
|
+
279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5
|
|
197
|
+
385.5-103 385.5 103 279.5 279.5 103 385.5z" />`,
|
|
198
|
+
viewBox: {
|
|
199
|
+
x: 1792,
|
|
200
|
+
y: 1792,
|
|
201
|
+
},
|
|
202
|
+
}),
|
|
203
|
+
RectangleROI: extend(BASE, {
|
|
204
|
+
iconContent: `<path fill="{{color}}" d="M1312 256h-832q-66 0-113 47t-47 113v832q0 66 47
|
|
205
|
+
113t113 47h832q66 0 113-47t47-113v-832q0-66-47-113t-113-47zm288 160v832q0
|
|
206
|
+
119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119
|
|
207
|
+
84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z" />`,
|
|
208
|
+
viewBox: {
|
|
209
|
+
x: 1792,
|
|
210
|
+
y: 1792,
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
213
|
+
TextMarker: extend(BASE, {
|
|
214
|
+
iconContent: `<path fill="{{color}}" d="M789 559l-170 450q33 0 136.5 2t160.5 2q19 0
|
|
215
|
+
57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29
|
|
216
|
+
31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15
|
|
217
|
+
34 58 144.5t72 168.5q20 45 35 57 19 15 88 29.5t84 20.5q6 38 6 57 0 5-.5
|
|
218
|
+
13.5t-.5 12.5q-63 0-190-8t-191-8q-76 0-215 7t-178 8q0-43 4-78l131-28q1 0
|
|
219
|
+
12.5-2.5t15.5-3.5 14.5-4.5 15-6.5 11-8 9-11
|
|
220
|
+
2.5-14q0-16-31-96.5t-72-177.5-42-100l-450-2q-26 58-76.5 195.5t-50.5 162.5q0
|
|
221
|
+
22 14 37.5t43.5 24.5 48.5 13.5 57 8.5 41 4q1 19 1 58 0 9-2 27-58
|
|
222
|
+
0-174.5-10t-174.5-10q-8 0-26.5 4t-21.5 4q-80 14-188 14z" />`,
|
|
223
|
+
viewBox: {
|
|
224
|
+
x: 1792,
|
|
225
|
+
y: 1792,
|
|
226
|
+
},
|
|
227
|
+
}),
|
|
228
|
+
Crosshairs: extend(BASE, {
|
|
229
|
+
iconContent: `<path fill="{{color}}" d="M1325 1024h-109q-26 0-45-19t-19-45v-128q0-26
|
|
230
|
+
19-45t45-19h109q-32-108-112.5-188.5t-188.5-112.5v109q0 26-19 45t-45
|
|
231
|
+
19h-128q-26 0-45-19t-19-45v-109q-108 32-188.5 112.5t-112.5 188.5h109q26
|
|
232
|
+
0 45 19t19 45v128q0 26-19 45t-45 19h-109q32 108 112.5 188.5t188.5
|
|
233
|
+
112.5v-109q0-26 19-45t45-19h128q26 0 45 19t19 45v109q108-32
|
|
234
|
+
188.5-112.5t112.5-188.5zm339-192v128q0 26-19 45t-45 19h-143q-37 161-154.5
|
|
235
|
+
278.5t-278.5 154.5v143q0 26-19 45t-45 19h-128q-26
|
|
236
|
+
0-45-19t-19-45v-143q-161-37-278.5-154.5t-154.5-278.5h-143q-26
|
|
237
|
+
0-45-19t-19-45v-128q0-26 19-45t45-19h143q37-161
|
|
238
|
+
154.5-278.5t278.5-154.5v-143q0-26 19-45t45-19h128q26 0 45 19t19 45v143q161
|
|
239
|
+
37 278.5 154.5t154.5 278.5h143q26 0 45 19t19 45z" />`,
|
|
240
|
+
viewBox: {
|
|
241
|
+
x: 1792,
|
|
242
|
+
y: 1792,
|
|
243
|
+
},
|
|
244
|
+
}),
|
|
245
|
+
Eraser: extend(BASE, {
|
|
246
|
+
iconContent: `<path transform="translate(0,1792) scale(1,-1)" fill="{{color}}" d="M960 1408l336-384h-768l-336 384h768zm1013-1077q15
|
|
247
|
+
34 9.5 71.5t-30.5 65.5l-896 1024q-38 44-96 44h-768q-38
|
|
248
|
+
0-69.5-20.5t-47.5-54.5q-15-34-9.5-71.5t30.5-65.5l896-1024q38-44 96-44h768q38
|
|
249
|
+
0 69.5 20.5t47.5 54.5z" />`,
|
|
250
|
+
viewBox: {
|
|
251
|
+
x: 2048,
|
|
252
|
+
y: 1792,
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
Magnify: extend(BASE, {
|
|
256
|
+
iconContent: `<path fill="{{color}}" d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395
|
|
257
|
+
312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5
|
|
258
|
+
0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17
|
|
259
|
+
0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208
|
|
260
|
+
32s176 78.7 176 176-78.7 176-176 176z" />`,
|
|
261
|
+
viewBox: {
|
|
262
|
+
x: 512,
|
|
263
|
+
y: 512,
|
|
264
|
+
},
|
|
265
|
+
}),
|
|
266
|
+
Pan: extend(BASE, {
|
|
267
|
+
iconContent: `<path fill="{{color}}" d="M1411 541l-355 355 355 355 144-144q29-31 70-14 39 17
|
|
268
|
+
39 59v448q0 26-19 45t-45 19h-448q-42 0-59-40-17-39 14-69l144-144-355-355-355
|
|
269
|
+
355 144 144q31 30 14 69-17 40-59 40h-448q-26 0-45-19t-19-45v-448q0-42 40-59
|
|
270
|
+
39-17 69 14l144 144 355-355-355-355-144 144q-19 19-45 19-12
|
|
271
|
+
0-24-5-40-17-40-59v-448q0-26 19-45t45-19h448q42 0 59 40 17 39-14 69l-144
|
|
272
|
+
144 355 355 355-355-144-144q-31-30-14-69 17-40 59-40h448q26 0 45 19t19
|
|
273
|
+
45v448q0 42-39 59-13 5-25 5-26 0-45-19z" />`,
|
|
274
|
+
viewBox: {
|
|
275
|
+
x: 1792,
|
|
276
|
+
y: 1792,
|
|
277
|
+
},
|
|
278
|
+
}),
|
|
279
|
+
Rotate: extend(BASE, {
|
|
280
|
+
iconContent: `<path fill="{{color}}" d="M1664 256v448q0 26-19 45t-45 19h-448q-42 0-59-40-17-39
|
|
281
|
+
14-69l138-138q-148-137-349-137-104 0-198.5 40.5t-163.5 109.5-109.5
|
|
282
|
+
163.5-40.5 198.5 40.5 198.5 109.5 163.5 163.5 109.5 198.5 40.5q119 0
|
|
283
|
+
225-52t179-147q7-10 23-12 15 0 25 9l137 138q9 8 9.5 20.5t-7.5 22.5q-109
|
|
284
|
+
132-264 204.5t-327 72.5q-156 0-298-61t-245-164-164-245-61-298 61-298
|
|
285
|
+
164-245 245-164 298-61q147 0 284.5 55.5t244.5 156.5l130-129q29-31 70-14
|
|
286
|
+
39 17 39 59z" />`,
|
|
287
|
+
viewBox: {
|
|
288
|
+
x: 1792,
|
|
289
|
+
y: 1792,
|
|
290
|
+
},
|
|
291
|
+
}),
|
|
292
|
+
StackScroll: extend(BASE, {
|
|
293
|
+
iconContent: `<path fill="{{color}}" d="M24 21v2c0 0.547-0.453 1-1 1h-22c-0.547
|
|
294
|
+
0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1zM24 13v2c0
|
|
295
|
+
0.547-0.453 1-1 1h-22c-0.547 0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547
|
|
296
|
+
0 1 0.453 1 1zM24 5v2c0 0.547-0.453 1-1 1h-22c-0.547
|
|
297
|
+
0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1z" />`,
|
|
298
|
+
viewBox: {
|
|
299
|
+
x: 24,
|
|
300
|
+
y: 28,
|
|
301
|
+
},
|
|
302
|
+
}),
|
|
303
|
+
WindowLevelRegion: extend(BASE, {
|
|
304
|
+
iconContent: `<path fill="{{color}}" d="M1664 416v960q0 119-84.5 203.5t-203.5 84.5h-960q-119
|
|
305
|
+
0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5
|
|
306
|
+
84.5t84.5 203.5z" />`,
|
|
307
|
+
viewBox: {
|
|
308
|
+
x: 1792,
|
|
309
|
+
y: 1792,
|
|
310
|
+
},
|
|
311
|
+
}),
|
|
312
|
+
WindowLevel: extend(BASE, {
|
|
313
|
+
iconContent: `
|
|
314
|
+
<path fill="{{color}}" d="M14.5,3.5 a1 1 0 0 1 -11,11 Z" stroke="none" opacity="0.8" />
|
|
315
|
+
<circle cx="9" cy="9" r="8" fill="none" stroke-width="2" stroke="{{color}}" />`,
|
|
316
|
+
viewBox: {
|
|
317
|
+
x: 18,
|
|
318
|
+
y: 18,
|
|
319
|
+
},
|
|
320
|
+
}),
|
|
321
|
+
Zoom: extend(BASE, {
|
|
322
|
+
iconContent: `
|
|
323
|
+
<path fill="{{color}}" d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395
|
|
324
|
+
312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5
|
|
325
|
+
0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17
|
|
326
|
+
0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208
|
|
327
|
+
32s176 78.7 176 176-78.7 176-176 176z" />
|
|
328
|
+
<path fill="{{color}}" transform="scale(0.22,0.22) translate(1400,0)" d="M1216
|
|
329
|
+
320q0 26-19 45t-45 19h-128v1024h128q26 0 45 19t19 45-19 45l-256 256q-19
|
|
330
|
+
19-45 19t-45-19l-256-256q-19-19-19-45t19-45 45-19h128v-1024h-128q-26
|
|
331
|
+
0-45-19t-19-45 19-45l256-256q19-19 45-19t45 19l256 256q19 19 19 45z" />`,
|
|
332
|
+
viewBox: {
|
|
333
|
+
x: 640,
|
|
334
|
+
y: 512,
|
|
335
|
+
},
|
|
336
|
+
}),
|
|
337
|
+
|
|
338
|
+
/*
|
|
339
|
+
* Segmentation Cursors
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
SegmentationFreeHandEraseInside: extend(BASE, {
|
|
343
|
+
iconContent: `${SCISSOR_ICON} ${MINUS_RECT}`,
|
|
344
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
345
|
+
}),
|
|
346
|
+
|
|
347
|
+
SegmentationFreeHandFillInside: extend(BASE, {
|
|
348
|
+
iconContent: `${SCISSOR_ICON} ${PLUS_RECT}`,
|
|
349
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
350
|
+
}),
|
|
351
|
+
|
|
352
|
+
SegmentationFreeHandEraseOutside: extend(BASE, {
|
|
353
|
+
iconContent: `${SCISSOR_ICON} ${MINUS_RECT}`,
|
|
354
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
355
|
+
}),
|
|
356
|
+
|
|
357
|
+
SegmentationFreeHandFillOutside: extend(BASE, {
|
|
358
|
+
iconContent: `${SCISSOR_ICON} ${PLUS_RECT}`,
|
|
359
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
360
|
+
}),
|
|
361
|
+
|
|
362
|
+
SegmentationRectangleEraseInside: extend(BASE, {
|
|
363
|
+
iconContent: `${RECTANGLE_ICON} ${MINUS_RECT}`,
|
|
364
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
365
|
+
}),
|
|
366
|
+
|
|
367
|
+
// Default Rectangle Scissors
|
|
368
|
+
RectangleScissor: extend(BASE, {
|
|
369
|
+
iconContent: `${RECTANGLE_ICON} ${PLUS_RECT}`,
|
|
370
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
371
|
+
}),
|
|
372
|
+
|
|
373
|
+
'RectangleScissor.FILL_INSIDE': extend(BASE, {
|
|
374
|
+
iconContent: `${RECTANGLE_ICON} ${PLUS_RECT}`,
|
|
375
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
376
|
+
}),
|
|
377
|
+
|
|
378
|
+
'RectangleScissor.FILL_OUTSIDE': extend(BASE, {
|
|
379
|
+
iconContent: `${RECTANGLE_ICON} ${PLUS_RECT}`,
|
|
380
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
381
|
+
}),
|
|
382
|
+
|
|
383
|
+
'RectangleScissor.ERASE_OUTSIDE': extend(BASE, {
|
|
384
|
+
iconContent: `${RECTANGLE_ICON} ${MINUS_RECT}`,
|
|
385
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
386
|
+
}),
|
|
387
|
+
|
|
388
|
+
'RectangleScissor.ERASE_INSIDE': extend(BASE, {
|
|
389
|
+
iconContent: `${RECTANGLE_ICON} ${MINUS_RECT}`,
|
|
390
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
391
|
+
}),
|
|
392
|
+
|
|
393
|
+
CircleScissor: extend(BASE, {
|
|
394
|
+
iconContent: `${CIRCLE_ICON} ${PLUS_RECT}`,
|
|
395
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
396
|
+
}),
|
|
397
|
+
|
|
398
|
+
'CircleScissor.FILL_INSIDE': extend(BASE, {
|
|
399
|
+
iconContent: `${CIRCLE_ICON} ${PLUS_RECT}`,
|
|
400
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
401
|
+
}),
|
|
402
|
+
|
|
403
|
+
'CircleScissor.ERASE_OUTSIDE': extend(BASE, {
|
|
404
|
+
iconContent: `${CIRCLE_ICON} ${MINUS_RECT}`,
|
|
405
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
406
|
+
}),
|
|
407
|
+
|
|
408
|
+
'CircleScissor.FILL_OUTSIDE': extend(BASE, {
|
|
409
|
+
iconContent: `${CIRCLE_ICON} ${PLUS_RECT}`,
|
|
410
|
+
viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
|
|
411
|
+
}),
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
/*
|
|
415
|
+
* Utils
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
function extend(
|
|
419
|
+
base: SVGCursorDescriptor,
|
|
420
|
+
values: Record<string, unknown>
|
|
421
|
+
): SVGCursorDescriptor {
|
|
422
|
+
return Object.assign(Object.create(base), values);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Registers a cursor to the list, so that it will be used for the given `toolName`.
|
|
427
|
+
* Overwrites the given cursor if it is already set.
|
|
428
|
+
*
|
|
429
|
+
* @param toolName - The name of the tool to assign a cursor to.
|
|
430
|
+
* @param iconContent - The SVG icon content of the cursor.
|
|
431
|
+
* @param viewBox - The viewBox of the cursor object.
|
|
432
|
+
*/
|
|
433
|
+
function registerCursor(
|
|
434
|
+
toolName: string,
|
|
435
|
+
iconContent: string,
|
|
436
|
+
viewBox: { x: number; y: number }
|
|
437
|
+
) {
|
|
438
|
+
CursorSVG[toolName] = extend(BASE, {
|
|
439
|
+
iconContent,
|
|
440
|
+
viewBox,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function getDefinedSVGCursorDescriptor(
|
|
445
|
+
name: string
|
|
446
|
+
): SVGCursorDescriptor | undefined {
|
|
447
|
+
if (Object.prototype.hasOwnProperty.call(CursorSVG, name)) {
|
|
448
|
+
return CursorSVG[name];
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/*
|
|
453
|
+
* Exports
|
|
454
|
+
*/
|
|
455
|
+
const svgCursorNames = Object.keys(CursorSVG);
|
|
456
|
+
|
|
457
|
+
export {
|
|
458
|
+
getDefinedSVGCursorDescriptor,
|
|
459
|
+
registerCursor,
|
|
460
|
+
svgCursorNames,
|
|
461
|
+
CursorSVG,
|
|
462
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { ToolModes, AnnotationStyleStates } from '../enums';
|
|
2
|
+
import MouseCursor from './MouseCursor';
|
|
3
|
+
import ImageMouseCursor from './ImageMouseCursor';
|
|
4
|
+
import { getDefinedSVGCursorDescriptor } from './SVGCursorDescriptor';
|
|
5
|
+
import { getStyleProperty } from '../stateManagement/annotation/config/helpers';
|
|
6
|
+
|
|
7
|
+
import type { StyleSpecifier } from '../types/AnnotationStyle';
|
|
8
|
+
import type { SVGCursorDescriptor } from '../types';
|
|
9
|
+
|
|
10
|
+
const PROPERTY = 'color';
|
|
11
|
+
const STATE = AnnotationStyleStates.Highlighted;
|
|
12
|
+
const MODE = ToolModes.Active;
|
|
13
|
+
|
|
14
|
+
export default class SVGMouseCursor extends ImageMouseCursor {
|
|
15
|
+
constructor(
|
|
16
|
+
url: string,
|
|
17
|
+
x?: number,
|
|
18
|
+
y?: number,
|
|
19
|
+
name?: string | undefined,
|
|
20
|
+
fallback?: MouseCursor | undefined
|
|
21
|
+
) {
|
|
22
|
+
super(url, x, y, name, fallback);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get a shared instance of the SVGMouseCursor class satisfying the given parameters.
|
|
27
|
+
*
|
|
28
|
+
* @param name - The name of the cursor (defined in SVGCursorDescriptor.ts);
|
|
29
|
+
* @param pointer - Should be true to use the version of the cursor containing
|
|
30
|
+
* a mouse pointer. Defaults to false (which does not add a pointer to the cursor);
|
|
31
|
+
* @param color - The color of the cursor. Defaults to tool.style.colorHighlightedActive;
|
|
32
|
+
* @returns a SVGMouseCursor instance or
|
|
33
|
+
* undefined if no SVG cursor descriptor was found with the given name;
|
|
34
|
+
*/
|
|
35
|
+
static getDefinedCursor(
|
|
36
|
+
name: string,
|
|
37
|
+
pointer = false,
|
|
38
|
+
color?: string
|
|
39
|
+
): MouseCursor {
|
|
40
|
+
if (!color) {
|
|
41
|
+
color = getStyleProperty(PROPERTY, {} as StyleSpecifier, STATE, MODE);
|
|
42
|
+
}
|
|
43
|
+
const urn = getCursorURN(name, pointer, color);
|
|
44
|
+
let cursor = super.getDefinedCursor(urn);
|
|
45
|
+
if (!cursor) {
|
|
46
|
+
const descriptor = getDefinedSVGCursorDescriptor(name);
|
|
47
|
+
if (descriptor) {
|
|
48
|
+
cursor = createSVGMouseCursor(
|
|
49
|
+
descriptor,
|
|
50
|
+
urn,
|
|
51
|
+
pointer,
|
|
52
|
+
color,
|
|
53
|
+
super.getDefinedCursor('default')
|
|
54
|
+
);
|
|
55
|
+
super.setDefinedCursor(urn, cursor);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return cursor;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* Helpers
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
function format(template: string, dictionary: Record<string, unknown>): string {
|
|
67
|
+
const dict = Object(dictionary);
|
|
68
|
+
const defined = Object.prototype.hasOwnProperty.bind(dict);
|
|
69
|
+
return (template + '').replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
|
70
|
+
return defined(key) ? dict[key] + '' : '';
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getCursorURN(name: string, pointer: boolean, color: string) {
|
|
75
|
+
const type = pointer ? 'pointer' : 'cursor';
|
|
76
|
+
return `${type}:${name}/${color}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function createSVGMouseCursor(
|
|
80
|
+
descriptor: SVGCursorDescriptor,
|
|
81
|
+
name: string,
|
|
82
|
+
pointer: boolean,
|
|
83
|
+
color: string,
|
|
84
|
+
fallback: MouseCursor
|
|
85
|
+
): SVGMouseCursor {
|
|
86
|
+
const { x, y } = descriptor.mousePoint;
|
|
87
|
+
return new SVGMouseCursor(
|
|
88
|
+
createSVGIconUrl(descriptor, pointer, { color }),
|
|
89
|
+
x,
|
|
90
|
+
y,
|
|
91
|
+
name,
|
|
92
|
+
fallback
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function createSVGIconUrl(
|
|
97
|
+
descriptor: SVGCursorDescriptor,
|
|
98
|
+
pointer: boolean,
|
|
99
|
+
options: Record<string, unknown>
|
|
100
|
+
): string {
|
|
101
|
+
return URL.createObjectURL(createSVGIconBlob(descriptor, pointer, options));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function createSVGIconBlob(
|
|
105
|
+
descriptor: SVGCursorDescriptor,
|
|
106
|
+
pointer: boolean,
|
|
107
|
+
options: Record<string, unknown>
|
|
108
|
+
): Blob {
|
|
109
|
+
const svgString = (pointer ? createSVGIconWithPointer : createSVGIcon)(
|
|
110
|
+
descriptor,
|
|
111
|
+
options
|
|
112
|
+
);
|
|
113
|
+
return new Blob([svgString], { type: 'image/svg+xml' });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function createSVGIcon(
|
|
117
|
+
descriptor: SVGCursorDescriptor,
|
|
118
|
+
options: Record<string, unknown>
|
|
119
|
+
): string {
|
|
120
|
+
const { iconContent, iconSize, viewBox } = descriptor;
|
|
121
|
+
const svgString = `
|
|
122
|
+
<svg data-icon="cursor" role="img" xmlns="http://www.w3.org/2000/svg"
|
|
123
|
+
width="${iconSize}" height="${iconSize}" viewBox="0 0
|
|
124
|
+
${viewBox.x} ${viewBox.y}">
|
|
125
|
+
${iconContent}
|
|
126
|
+
</svg>`;
|
|
127
|
+
return format(svgString, options);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function createSVGIconWithPointer(
|
|
131
|
+
descriptor: SVGCursorDescriptor,
|
|
132
|
+
options: Record<string, unknown>
|
|
133
|
+
) {
|
|
134
|
+
const { iconContent, iconSize, viewBox, mousePointerGroupString } =
|
|
135
|
+
descriptor;
|
|
136
|
+
const scale = iconSize / Math.max(viewBox.x, viewBox.y, 1);
|
|
137
|
+
const svgSize = 16 + iconSize;
|
|
138
|
+
const svgString = `
|
|
139
|
+
<svg data-icon="cursor" role="img" xmlns="http://www.w3.org/2000/svg"
|
|
140
|
+
width="${svgSize}" height="${svgSize}" viewBox="0 0 ${svgSize} ${svgSize}">
|
|
141
|
+
<g>${mousePointerGroupString}</g>
|
|
142
|
+
<g transform="translate(16, 16) scale(${scale})">${iconContent}</g>
|
|
143
|
+
</svg>`;
|
|
144
|
+
return format(svgString, options);
|
|
145
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { MouseCursor } from '.';
|
|
2
|
+
|
|
3
|
+
const ELEMENT_CURSORS_MAP = Symbol('ElementCursorsMap');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Public Methods
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function initElementCursor(
|
|
10
|
+
element: HTMLDivElement,
|
|
11
|
+
cursor: MouseCursor | null
|
|
12
|
+
): void {
|
|
13
|
+
_getElementCursors(element)[0] = cursor;
|
|
14
|
+
_setElementCursor(element, cursor);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function _setElementCursor(
|
|
18
|
+
element: HTMLDivElement,
|
|
19
|
+
cursor: MouseCursor | null
|
|
20
|
+
): void {
|
|
21
|
+
const cursors = _getElementCursors(element);
|
|
22
|
+
cursors[1] = cursors[0];
|
|
23
|
+
cursors[0] = cursor;
|
|
24
|
+
element.style.cursor = (
|
|
25
|
+
cursor instanceof MouseCursor
|
|
26
|
+
? cursor
|
|
27
|
+
: MouseCursor.getDefinedCursor('auto')
|
|
28
|
+
).getStyleProperty();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function resetElementCursor(element: HTMLDivElement): void {
|
|
32
|
+
_setElementCursor(element, _getElementCursors(element)[1]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function hideElementCursor(element: HTMLDivElement): void {
|
|
36
|
+
_setElementCursor(element, MouseCursor.getDefinedCursor('none'));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* Helpers
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
function _getElementCursors(
|
|
44
|
+
element: HTMLDivElement
|
|
45
|
+
): [MouseCursor | null, MouseCursor | null] {
|
|
46
|
+
let map = _getElementCursors[ELEMENT_CURSORS_MAP];
|
|
47
|
+
if (!(map instanceof WeakMap)) {
|
|
48
|
+
map = new WeakMap();
|
|
49
|
+
Object.defineProperty(_getElementCursors, ELEMENT_CURSORS_MAP, {
|
|
50
|
+
value: map,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
let cursors = map.get(element);
|
|
54
|
+
if (!cursors) {
|
|
55
|
+
cursors = [null, null];
|
|
56
|
+
map.set(element, cursors);
|
|
57
|
+
}
|
|
58
|
+
return cursors;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
* Exports
|
|
63
|
+
*/
|
|
64
|
+
export {
|
|
65
|
+
initElementCursor,
|
|
66
|
+
resetElementCursor,
|
|
67
|
+
hideElementCursor,
|
|
68
|
+
_setElementCursor as setElementCursor,
|
|
69
|
+
};
|