@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,80 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import _getHash from './_getHash';
|
|
3
|
+
import _setNewAttributesIfValid from './_setNewAttributesIfValid';
|
|
4
|
+
import _setAttributesIfNecessary from './_setAttributesIfNecessary';
|
|
5
|
+
import { SVGDrawingHelper } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Draws an SVG polyline with the given points.
|
|
9
|
+
*
|
|
10
|
+
* The `connectLastToFirst` option, if true, draws a closed polyline, with the
|
|
11
|
+
* last point connected to the first.
|
|
12
|
+
*/
|
|
13
|
+
export default function drawPolyline(
|
|
14
|
+
svgDrawingHelper: SVGDrawingHelper,
|
|
15
|
+
annotationUID: string,
|
|
16
|
+
polylineUID: string,
|
|
17
|
+
points: Types.Point2[],
|
|
18
|
+
options: {
|
|
19
|
+
color?: string;
|
|
20
|
+
width?: number;
|
|
21
|
+
lineWidth?: number;
|
|
22
|
+
lineDash?: string;
|
|
23
|
+
connectLastToFirst?: boolean;
|
|
24
|
+
}
|
|
25
|
+
): void {
|
|
26
|
+
if (points.length < 2) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { color, width, lineWidth, lineDash } = Object.assign(
|
|
31
|
+
{
|
|
32
|
+
color: 'dodgerblue',
|
|
33
|
+
width: '2',
|
|
34
|
+
lineWidth: undefined,
|
|
35
|
+
lineDash: undefined,
|
|
36
|
+
connectLastToFirst: false,
|
|
37
|
+
},
|
|
38
|
+
options
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// for supporting both lineWidth and width options
|
|
42
|
+
const strokeWidth = lineWidth || width;
|
|
43
|
+
|
|
44
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
45
|
+
const svgNodeHash = _getHash(annotationUID, 'polyline', polylineUID);
|
|
46
|
+
const existingPolyLine = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
47
|
+
|
|
48
|
+
let pointsAttribute = '';
|
|
49
|
+
|
|
50
|
+
for (const point of points) {
|
|
51
|
+
pointsAttribute += `${point[0]}, ${point[1]} `;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (options.connectLastToFirst) {
|
|
55
|
+
const firstPoint = points[0];
|
|
56
|
+
|
|
57
|
+
pointsAttribute += `${firstPoint[0]}, ${firstPoint[1]}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const attributes = {
|
|
61
|
+
points: pointsAttribute,
|
|
62
|
+
stroke: color,
|
|
63
|
+
fill: 'none',
|
|
64
|
+
'stroke-width': strokeWidth,
|
|
65
|
+
'stroke-dasharray': lineDash,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (existingPolyLine) {
|
|
69
|
+
// This is run to avoid re-rendering annotations that actually haven't changed
|
|
70
|
+
_setAttributesIfNecessary(attributes, existingPolyLine);
|
|
71
|
+
|
|
72
|
+
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
73
|
+
} else {
|
|
74
|
+
const newPolyLine = document.createElementNS(svgns, 'polyline');
|
|
75
|
+
|
|
76
|
+
_setNewAttributesIfValid(attributes, newPolyLine);
|
|
77
|
+
|
|
78
|
+
svgDrawingHelper.appendNode(newPolyLine, svgNodeHash);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
import _getHash from './_getHash';
|
|
4
|
+
import _setAttributesIfNecessary from './_setAttributesIfNecessary';
|
|
5
|
+
import _setNewAttributesIfValid from './_setNewAttributesIfValid';
|
|
6
|
+
import { SVGDrawingHelper } from '../types';
|
|
7
|
+
|
|
8
|
+
// <rect x="120" y="100" width="100" height="100" />
|
|
9
|
+
export default function drawRect(
|
|
10
|
+
svgDrawingHelper: SVGDrawingHelper,
|
|
11
|
+
annotationUID: string,
|
|
12
|
+
rectangleUID: string,
|
|
13
|
+
start: Types.Point2,
|
|
14
|
+
end: Types.Point2,
|
|
15
|
+
options = {},
|
|
16
|
+
dataId = ''
|
|
17
|
+
): void {
|
|
18
|
+
const {
|
|
19
|
+
color,
|
|
20
|
+
width: _width,
|
|
21
|
+
lineWidth,
|
|
22
|
+
lineDash,
|
|
23
|
+
} = Object.assign(
|
|
24
|
+
{
|
|
25
|
+
color: 'dodgerblue',
|
|
26
|
+
width: '2',
|
|
27
|
+
lineWidth: undefined,
|
|
28
|
+
lineDash: undefined,
|
|
29
|
+
},
|
|
30
|
+
options
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// for supporting both lineWidth and width options
|
|
34
|
+
const strokeWidth = lineWidth || _width;
|
|
35
|
+
|
|
36
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
37
|
+
const svgNodeHash = _getHash(annotationUID, 'rect', rectangleUID);
|
|
38
|
+
const existingRect = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
39
|
+
|
|
40
|
+
const tlhc = [Math.min(start[0], end[0]), Math.min(start[1], end[1])];
|
|
41
|
+
const width = Math.abs(start[0] - end[0]);
|
|
42
|
+
const height = Math.abs(start[1] - end[1]);
|
|
43
|
+
|
|
44
|
+
const attributes = {
|
|
45
|
+
x: `${tlhc[0]}`,
|
|
46
|
+
y: `${tlhc[1]}`,
|
|
47
|
+
width: `${width}`,
|
|
48
|
+
height: `${height}`,
|
|
49
|
+
stroke: color,
|
|
50
|
+
fill: 'transparent',
|
|
51
|
+
'stroke-width': strokeWidth,
|
|
52
|
+
'stroke-dasharray': lineDash,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
if (existingRect) {
|
|
56
|
+
_setAttributesIfNecessary(attributes, existingRect);
|
|
57
|
+
|
|
58
|
+
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
59
|
+
} else {
|
|
60
|
+
const svgRectElement = document.createElementNS(svgns, 'rect');
|
|
61
|
+
|
|
62
|
+
if (dataId !== '') {
|
|
63
|
+
svgRectElement.setAttribute('data-id', dataId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_setNewAttributesIfValid(attributes, svgRectElement);
|
|
67
|
+
|
|
68
|
+
svgDrawingHelper.appendNode(svgRectElement, svgNodeHash);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { SVGDrawingHelper } from '../types';
|
|
3
|
+
|
|
4
|
+
import _getHash from './_getHash';
|
|
5
|
+
import _setAttributesIfNecessary from './_setAttributesIfNecessary';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Draws a textBox.
|
|
9
|
+
*
|
|
10
|
+
* @param textLines - The text to display.
|
|
11
|
+
* @param position - The x/y position of the textbox
|
|
12
|
+
* @param options - Options for the textBox.
|
|
13
|
+
* @returns Bounding box; can be used for isPointNearTool
|
|
14
|
+
*/
|
|
15
|
+
function drawTextBox(
|
|
16
|
+
svgDrawingHelper: SVGDrawingHelper,
|
|
17
|
+
annotationUID: string,
|
|
18
|
+
textUID: string,
|
|
19
|
+
textLines: Array<string>,
|
|
20
|
+
position: Types.Point2,
|
|
21
|
+
options = {}
|
|
22
|
+
): SVGRect {
|
|
23
|
+
const mergedOptions = Object.assign(
|
|
24
|
+
{
|
|
25
|
+
fontFamily: 'Helvetica, Arial, sans-serif',
|
|
26
|
+
fontSize: '14px',
|
|
27
|
+
color: 'rgb(255, 255, 0)',
|
|
28
|
+
background: '',
|
|
29
|
+
padding: 25,
|
|
30
|
+
centerX: false,
|
|
31
|
+
centerY: true,
|
|
32
|
+
},
|
|
33
|
+
options
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Draw each of the text lines on top of the background box
|
|
37
|
+
const textGroupBoundingBox = _drawTextGroup(
|
|
38
|
+
svgDrawingHelper,
|
|
39
|
+
annotationUID,
|
|
40
|
+
textUID,
|
|
41
|
+
textLines,
|
|
42
|
+
position,
|
|
43
|
+
mergedOptions
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return textGroupBoundingBox;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _drawTextGroup(
|
|
50
|
+
svgDrawingHelper: SVGDrawingHelper,
|
|
51
|
+
annotationUID: string,
|
|
52
|
+
textUID: string,
|
|
53
|
+
textLines: Array<string> = [''],
|
|
54
|
+
position: Types.Point2,
|
|
55
|
+
options: any
|
|
56
|
+
): SVGRect {
|
|
57
|
+
const { padding, color, fontFamily, fontSize, background } = options;
|
|
58
|
+
|
|
59
|
+
let textGroupBoundingBox;
|
|
60
|
+
const [x, y] = [position[0] + padding, position[1] + padding];
|
|
61
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
62
|
+
const svgNodeHash = _getHash(annotationUID, 'text', textUID);
|
|
63
|
+
const existingTextGroup = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
64
|
+
|
|
65
|
+
// Todo: right now textBox gets a re-render even if the textBox has not changed
|
|
66
|
+
// and evenIf the attributes are not set again since they are the same.
|
|
67
|
+
if (existingTextGroup) {
|
|
68
|
+
// TODO: Iterate each node and update color? font-size?
|
|
69
|
+
const textElement = existingTextGroup.querySelector('text');
|
|
70
|
+
const textSpans = Array.from(textElement.children) as Array<SVGElement>;
|
|
71
|
+
|
|
72
|
+
for (let i = 0; i < textSpans.length; i++) {
|
|
73
|
+
const textSpanElement = textSpans[i];
|
|
74
|
+
const text = textLines[i] || '';
|
|
75
|
+
|
|
76
|
+
textSpanElement.textContent = text;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// if the textLines have changed size, we need to create textSpans for them
|
|
80
|
+
if (textLines.length > textSpans.length) {
|
|
81
|
+
for (let i = 0; i < textLines.length - textSpans.length; i++) {
|
|
82
|
+
const textLine = textLines[i + textSpans.length];
|
|
83
|
+
const textSpan = _createTextSpan(textLine);
|
|
84
|
+
|
|
85
|
+
textElement.appendChild(textSpan);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
existingTextGroup.appendChild(textElement);
|
|
89
|
+
svgDrawingHelper.appendNode(existingTextGroup, svgNodeHash);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const textAttributes = {
|
|
93
|
+
fill: color,
|
|
94
|
+
'font-size': fontSize,
|
|
95
|
+
'font-family': fontFamily,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const textGroupAttributes = {
|
|
99
|
+
transform: `translate(${x} ${y})`,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Todo: for some reason this does not work to not re-render the textBox
|
|
103
|
+
_setAttributesIfNecessary(textAttributes, textElement);
|
|
104
|
+
_setAttributesIfNecessary(textGroupAttributes, existingTextGroup);
|
|
105
|
+
|
|
106
|
+
textGroupBoundingBox = _drawTextBackground(existingTextGroup, background);
|
|
107
|
+
|
|
108
|
+
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
109
|
+
} else {
|
|
110
|
+
const textGroup = document.createElementNS(svgns, 'g');
|
|
111
|
+
|
|
112
|
+
textGroup.setAttribute('transform', `translate(${x} ${y})`);
|
|
113
|
+
|
|
114
|
+
//
|
|
115
|
+
const textElement = _createTextElement(svgDrawingHelper, options);
|
|
116
|
+
for (let i = 0; i < textLines.length; i++) {
|
|
117
|
+
const textLine = textLines[i];
|
|
118
|
+
const textSpan = _createTextSpan(textLine);
|
|
119
|
+
|
|
120
|
+
textElement.appendChild(textSpan);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
textGroup.appendChild(textElement);
|
|
124
|
+
svgDrawingHelper.appendNode(textGroup, svgNodeHash);
|
|
125
|
+
textGroupBoundingBox = _drawTextBackground(textGroup, background);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// We translate the group using `position`
|
|
129
|
+
// which means we also need to pluck those values when returning
|
|
130
|
+
// the bounding box
|
|
131
|
+
return Object.assign({}, textGroupBoundingBox, {
|
|
132
|
+
x,
|
|
133
|
+
y,
|
|
134
|
+
height: textGroupBoundingBox.height + padding,
|
|
135
|
+
width: textGroupBoundingBox.width + padding,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function _createTextElement(
|
|
140
|
+
svgDrawingHelper: SVGDrawingHelper,
|
|
141
|
+
options: any
|
|
142
|
+
): SVGElement {
|
|
143
|
+
const { color, fontFamily, fontSize } = options;
|
|
144
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
145
|
+
const textElement = document.createElementNS(svgns, 'text');
|
|
146
|
+
const noSelectStyle =
|
|
147
|
+
'user-select: none; pointer-events: none; -webkit-tap-highlight-color: rgba(255, 255, 255, 0);';
|
|
148
|
+
const dropShadowStyle = `filter:url(#shadow-${svgDrawingHelper.svgLayerElement.id});`;
|
|
149
|
+
const combinedStyle = `${noSelectStyle}${dropShadowStyle}`;
|
|
150
|
+
|
|
151
|
+
// font-size="100"
|
|
152
|
+
textElement.setAttribute('x', '0');
|
|
153
|
+
textElement.setAttribute('y', '0');
|
|
154
|
+
textElement.setAttribute('fill', color);
|
|
155
|
+
textElement.setAttribute('font-family', fontFamily);
|
|
156
|
+
textElement.setAttribute('font-size', fontSize);
|
|
157
|
+
textElement.setAttribute('style', combinedStyle);
|
|
158
|
+
|
|
159
|
+
return textElement;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function _createTextSpan(text): SVGElement {
|
|
163
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
164
|
+
const textSpanElement = document.createElementNS(svgns, 'tspan');
|
|
165
|
+
|
|
166
|
+
// TODO: centerX
|
|
167
|
+
// (parent width / 2) - my width
|
|
168
|
+
// TODO: centerY
|
|
169
|
+
|
|
170
|
+
textSpanElement.setAttribute('x', '0');
|
|
171
|
+
textSpanElement.setAttribute('dy', '1.2em');
|
|
172
|
+
textSpanElement.textContent = text;
|
|
173
|
+
|
|
174
|
+
return textSpanElement;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function _drawTextBackground(group: SVGGElement, color: string) {
|
|
178
|
+
let element = group.querySelector('rect.background');
|
|
179
|
+
|
|
180
|
+
// If we have no background color, remove any element that exists and return
|
|
181
|
+
// the bounding box of the text
|
|
182
|
+
if (!color) {
|
|
183
|
+
if (element) {
|
|
184
|
+
group.removeChild(element);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return group.getBBox();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Otherwise, check if we have a <rect> element. If not, create one
|
|
191
|
+
if (!element) {
|
|
192
|
+
element = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
|
193
|
+
element.setAttribute('class', 'background');
|
|
194
|
+
group.insertBefore(element, group.firstChild);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Get the text groups's bounding box and use it to draw the background rectangle
|
|
198
|
+
const bBox = group.getBBox();
|
|
199
|
+
|
|
200
|
+
const attributes = {
|
|
201
|
+
x: `${bBox.x}`,
|
|
202
|
+
y: `${bBox.y}`,
|
|
203
|
+
width: `${bBox.width}`,
|
|
204
|
+
height: `${bBox.height}`,
|
|
205
|
+
fill: color,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
_setAttributesIfNecessary(attributes, element);
|
|
209
|
+
|
|
210
|
+
return bBox;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export default drawTextBox;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { state } from '../store';
|
|
2
|
+
import { getEnabledElement } from '@cornerstonejs/core';
|
|
3
|
+
import { SVGDrawingHelper } from '../types';
|
|
4
|
+
|
|
5
|
+
const VIEWPORT_ELEMENT = 'viewport-element';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the SVG drawing helper for the given HTML element.
|
|
9
|
+
* @param element - The HTML element to get the SVG drawing helper for.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
function getSvgDrawingHelper(element: HTMLDivElement): SVGDrawingHelper {
|
|
13
|
+
const enabledElement = getEnabledElement(element);
|
|
14
|
+
const { viewportId, renderingEngineId } = enabledElement;
|
|
15
|
+
const canvasHash = `${viewportId}:${renderingEngineId}`;
|
|
16
|
+
const svgLayerElement = _getSvgLayer(element);
|
|
17
|
+
|
|
18
|
+
// Reset touched
|
|
19
|
+
Object.keys(state.svgNodeCache[canvasHash]).forEach((cacheKey) => {
|
|
20
|
+
state.svgNodeCache[canvasHash][cacheKey].touched = false;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
svgLayerElement: svgLayerElement,
|
|
25
|
+
svgNodeCacheForCanvas: state.svgNodeCache,
|
|
26
|
+
getSvgNode: getSvgNode.bind(this, canvasHash),
|
|
27
|
+
appendNode: appendNode.bind(this, svgLayerElement, canvasHash),
|
|
28
|
+
setNodeTouched: setNodeTouched.bind(this, canvasHash),
|
|
29
|
+
clearUntouched: clearUntouched.bind(this, svgLayerElement, canvasHash),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param element
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
function _getSvgLayer(element) {
|
|
39
|
+
const viewportElement = `.${VIEWPORT_ELEMENT}`;
|
|
40
|
+
const internalDivElement = element.querySelector(viewportElement);
|
|
41
|
+
const svgLayer = internalDivElement.querySelector('.svg-layer');
|
|
42
|
+
|
|
43
|
+
return svgLayer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getSvgNode(canvasHash, cacheKey) {
|
|
47
|
+
// If state has been reset
|
|
48
|
+
if (!state.svgNodeCache[canvasHash]) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (state.svgNodeCache[canvasHash][cacheKey]) {
|
|
53
|
+
return state.svgNodeCache[canvasHash][cacheKey].domRef;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function appendNode(svgLayerElement, canvasHash, svgNode, cacheKey) {
|
|
58
|
+
// If state has been reset
|
|
59
|
+
if (!state.svgNodeCache[canvasHash]) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
state.svgNodeCache[canvasHash][cacheKey] = {
|
|
64
|
+
touched: true,
|
|
65
|
+
domRef: svgNode,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
svgLayerElement.appendChild(svgNode);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function setNodeTouched(canvasHash, cacheKey) {
|
|
72
|
+
// If state has been reset
|
|
73
|
+
if (!state.svgNodeCache[canvasHash]) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (state.svgNodeCache[canvasHash][cacheKey]) {
|
|
78
|
+
state.svgNodeCache[canvasHash][cacheKey].touched = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function clearUntouched(svgLayerElement, canvasHash) {
|
|
83
|
+
// If state has been reset
|
|
84
|
+
if (!state.svgNodeCache[canvasHash]) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
Object.keys(state.svgNodeCache[canvasHash]).forEach((cacheKey) => {
|
|
89
|
+
const cacheEntry = state.svgNodeCache[canvasHash][cacheKey];
|
|
90
|
+
|
|
91
|
+
if (!cacheEntry.touched && cacheEntry.domRef) {
|
|
92
|
+
svgLayerElement.removeChild(cacheEntry.domRef);
|
|
93
|
+
delete state.svgNodeCache[canvasHash][cacheKey];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export default getSvgDrawingHelper;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import draw from './draw';
|
|
2
|
+
import drawCircle from './drawCircle';
|
|
3
|
+
import drawEllipse from './drawEllipse';
|
|
4
|
+
import drawHandles from './drawHandles';
|
|
5
|
+
import drawLine from './drawLine';
|
|
6
|
+
import drawPolyline from './drawPolyline';
|
|
7
|
+
import drawLinkedTextBox from './drawLinkedTextBox';
|
|
8
|
+
import drawRect from './drawRect';
|
|
9
|
+
import drawTextBox from './drawTextBox';
|
|
10
|
+
import drawArrow from './drawArrow';
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
draw,
|
|
14
|
+
drawCircle,
|
|
15
|
+
drawEllipse,
|
|
16
|
+
drawHandles,
|
|
17
|
+
drawLine,
|
|
18
|
+
drawPolyline,
|
|
19
|
+
drawLinkedTextBox,
|
|
20
|
+
drawRect,
|
|
21
|
+
drawTextBox,
|
|
22
|
+
drawArrow,
|
|
23
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnnotationStyleStates - This enum defines the 4 possible states available for
|
|
3
|
+
* a Annotation instance.
|
|
4
|
+
*
|
|
5
|
+
* Default:
|
|
6
|
+
* The default state for the annotation instance
|
|
7
|
+
* Highlighted:
|
|
8
|
+
* The annotation should be rendered in "highlighted" mode in response to
|
|
9
|
+
* direct user interaction;
|
|
10
|
+
* Selected:
|
|
11
|
+
* The annotation has been selected by the user;
|
|
12
|
+
* Locked:
|
|
13
|
+
* The annotation has been locked;
|
|
14
|
+
*/
|
|
15
|
+
enum AnnotationStyleStates {
|
|
16
|
+
Default = '',
|
|
17
|
+
Highlighted = 'Highlighted',
|
|
18
|
+
Selected = 'Selected',
|
|
19
|
+
Locked = 'Locked',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default AnnotationStyleStates;
|