lost-sia 2.0.1-alpha9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/Annotation/logic/Annotation.d.ts +17 -0
- package/dist/Annotation/logic/Annotation.js +1 -1
- package/dist/Annotation/ui/AnnotationComponent.d.ts +24 -0
- package/dist/Annotation/ui/AnnotationComponent.js +1 -1
- package/dist/Annotation/ui/atoms/AnnoBar.d.ts +15 -0
- package/dist/Annotation/ui/atoms/AnnoBar.js +1 -1
- package/dist/Annotation/ui/atoms/DaviIcon.d.ts +9 -0
- package/dist/Annotation/ui/atoms/Edge.d.ts +17 -0
- package/dist/Annotation/ui/atoms/Edge.js +1 -1
- package/dist/Annotation/ui/atoms/Node.d.ts +17 -0
- package/dist/Annotation/ui/atoms/Node.js +1 -1
- package/dist/Annotation/ui/atoms/PolygonArea.d.ts +16 -0
- package/dist/Annotation/ui/atoms/PolygonArea.js +1 -1
- package/dist/Annotation/ui/tools/BBox.d.ts +21 -0
- package/dist/Annotation/ui/tools/BBox.js +1 -1
- package/dist/Annotation/ui/tools/Line.d.ts +21 -0
- package/dist/Annotation/ui/tools/Line.js +1 -1
- package/dist/Annotation/ui/tools/Point.d.ts +16 -0
- package/dist/Annotation/ui/tools/Point.js +1 -1
- package/dist/Annotation/ui/tools/Polygon.d.ts +23 -0
- package/dist/Annotation/ui/tools/Polygon.js +1 -1
- package/dist/Canvas/Canvas.d.ts +31 -0
- package/dist/Canvas/Canvas.js +1 -1
- package/dist/Canvas/LabelInput.d.ts +11 -0
- package/dist/Canvas/LabelInput.js +1 -1
- package/dist/IconButton.d.ts +25 -0
- package/dist/IconButton.js +1 -0
- package/dist/Sia.d.ts +33 -0
- package/dist/Sia.js +1 -1
- package/dist/Toolbar/Toolbar.d.ts +21 -0
- package/dist/Toolbar/Toolbar.js +1 -1
- package/dist/Toolbar/ToolbarItems/AccessibilityTools.d.ts +7 -0
- package/dist/Toolbar/ToolbarItems/AccessibilityTools.js +1 -1
- package/dist/Toolbar/ToolbarItems/AnnoToolSelector.d.ts +11 -0
- package/dist/Toolbar/ToolbarItems/AnnoToolSelector.js +1 -1
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.d.ts +11 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.js +1 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.d.ts +11 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.js +1 -1
- package/dist/Toolbar/ToolbarItems/ImageTools.d.ts +13 -0
- package/dist/Toolbar/ToolbarItems/ImageTools.js +1 -1
- package/dist/Toolbar/ToolbarItems/Instructions.d.ts +2 -0
- package/dist/Toolbar/ToolbarItems/InstructionsModal.d.ts +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/models/AnnotationMode.d.ts +11 -0
- package/dist/models/AnnotationStatus.d.ts +8 -0
- package/dist/models/AnnotationTool.d.ts +7 -0
- package/dist/models/CanvasAction.d.ts +28 -0
- package/dist/models/Direction.d.ts +7 -0
- package/dist/models/EditorModes.d.ts +11 -0
- package/dist/models/KeyAction.d.ts +22 -0
- package/dist/models/KeyAction.js +1 -1
- package/dist/models/NotificationType.d.ts +7 -0
- package/dist/models/NotificationType.js +1 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +1 -1
- package/dist/stories/AnnotationTools.stories.d.ts +40 -0
- package/dist/stories/Canvas/Canvas.stories.d.ts +50 -0
- package/dist/stories/Canvas/CanvasOffset.d.ts +13 -0
- package/dist/stories/Canvas/CanvasWithOffset.stories.d.ts +36 -0
- package/dist/stories/FilterDropdown.stories.d.ts +19 -0
- package/dist/stories/MinimalSia.stories.d.ts +66 -0
- package/dist/stories/SIA/DemoWrapper.d.ts +8 -0
- package/dist/stories/SIA/DemoWrapper.stories.d.ts +27 -0
- package/dist/stories/SIA/SIA.stories.d.ts +72 -0
- package/dist/stories/Toolbar/ImageTools/TagLabel.stories.d.ts +21 -0
- package/dist/stories/Toolbar/Instructions.stories.d.ts +11 -0
- package/dist/stories/Toolbar/Toolbar.stories.d.ts +37 -0
- package/dist/stories/exampleData/exampleAnnotations.d.ts +8 -0
- package/dist/stories/exampleData/exampleExternalAnnotations.d.ts +8 -0
- package/dist/stories/exampleData/exampleImage.d.ts +2 -0
- package/dist/stories/exampleData/exampleLabels.d.ts +6 -0
- package/dist/types.d.ts +57 -0
- package/dist/utils/KeyMapper.d.ts +9 -0
- package/dist/utils/KeyMapper.js +1 -1
- package/dist/utils/TimeUtils.d.ts +4 -0
- package/dist/utils/TimeUtils.js +1 -0
- package/dist/utils/color.d.ts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +1 -1
- package/dist/utils/mouse.d.ts +6 -0
- package/dist/utils/mouse.js +1 -1
- package/dist/utils/siaIcons.js +5 -5
- package/dist/utils/transform.d.ts +28 -0
- package/dist/utils/transform.js +1 -1
- package/dist/utils/windowViewport.d.ts +22 -0
- package/dist/utils/windowViewport.js +1 -1
- package/package.json +19 -16
- package/src/AnnoExampleViewer.jsx +18 -18
- package/src/Annotation/logic/Annotation.ts +24 -26
- package/src/Annotation/ui/AnnotationComponent.tsx +115 -86
- package/src/Annotation/ui/atoms/AnnoBar.tsx +51 -53
- package/src/Annotation/ui/atoms/DaviIcon.tsx +12 -22
- package/src/Annotation/ui/atoms/Edge.tsx +25 -22
- package/src/Annotation/ui/atoms/Node.tsx +56 -50
- package/src/Annotation/ui/atoms/PolygonArea.tsx +30 -35
- package/src/Annotation/ui/tools/BBox.tsx +136 -150
- package/src/Annotation/ui/tools/Line.tsx +94 -91
- package/src/Annotation/ui/tools/Point.tsx +19 -17
- package/src/Annotation/ui/tools/Polygon.tsx +126 -95
- package/src/Canvas/Canvas.tsx +748 -594
- package/src/Canvas/LabelInput.tsx +68 -45
- package/src/IconButton.tsx +119 -0
- package/src/InfoBoxes/AnnoDetails.jsx +53 -53
- package/src/InfoBoxes/AnnoStats.jsx +41 -41
- package/src/InfoBoxes/InfoBox.jsx +16 -16
- package/src/InfoBoxes/InfoBoxArea.jsx +32 -34
- package/src/InfoBoxes/LabelInfo.jsx +30 -30
- package/src/SIASettingButton.jsx +25 -25
- package/src/Sia.tsx +484 -0
- package/src/Toolbar/Toolbar.tsx +38 -31
- package/src/Toolbar/ToolbarItems/AccessibilityTools.tsx +26 -46
- package/src/Toolbar/ToolbarItems/AnnoToolSelector.tsx +53 -46
- package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.tsx +127 -0
- package/src/Toolbar/ToolbarItems/ImageToolItems/TagLabel.tsx +29 -28
- package/src/Toolbar/ToolbarItems/ImageTools.tsx +43 -40
- package/src/Toolbar/ToolbarItems/Instructions.tsx +47 -50
- package/src/Toolbar/ToolbarItems/InstructionsModal.tsx +8 -8
- package/src/index.ts +9 -13
- package/src/models/{AnnotationMode.tsx → AnnotationMode.ts} +1 -1
- package/src/models/{AnnotationStatus.tsx → AnnotationStatus.ts} +1 -1
- package/src/models/{AnnotationTool.tsx → AnnotationTool.ts} +1 -1
- package/src/models/{CanvasAction.tsx → CanvasAction.ts} +1 -1
- package/src/models/{Direction.tsx → Direction.ts} +1 -1
- package/src/models/{EditorModes.tsx → EditorModes.ts} +1 -1
- package/src/models/{KeyAction.tsx → KeyAction.ts} +3 -1
- package/src/models/NotificationType.ts +8 -0
- package/src/models/index.ts +6 -7
- package/src/siaDummyData.js +71 -71
- package/src/stories/AnnotationTools.mdx +27 -0
- package/src/stories/AnnotationTools.stories.tsx +104 -0
- package/src/stories/Canvas/Canvas.stories.tsx +59 -113
- package/src/stories/Canvas/CanvasOffset.tsx +54 -38
- package/src/stories/Canvas/CanvasWithOffset.stories.tsx +42 -113
- package/src/stories/FilterDropdown.stories.ts +13 -11
- package/src/stories/MinimalSIA.mdx +20 -0
- package/src/stories/MinimalSia.stories.tsx +90 -0
- package/src/stories/SIA/DemoWrapper.stories.tsx +71 -0
- package/src/stories/SIA/DemoWrapper.tsx +55 -0
- package/src/stories/SIA/SIA.stories.tsx +79 -45
- package/src/stories/Toolbar/ImageTools/TagLabel.stories.tsx +11 -12
- package/src/stories/Toolbar/Instructions.stories.tsx +11 -11
- package/src/stories/Toolbar/Toolbar.stories.tsx +32 -47
- package/src/stories/Welcome.mdx +5 -0
- package/src/stories/development/CoordinateSystems.mdx +25 -0
- package/src/stories/exampleData/exampleAnnotations.ts +65 -0
- package/src/stories/exampleData/exampleExternalAnnotations.ts +115 -0
- package/src/stories/{siaDummyData2.ts → exampleData/exampleImage.ts} +3 -264
- package/src/stories/exampleData/exampleLabels.ts +146 -0
- package/src/stories/main.scss +6 -0
- package/src/styles/style.scss +1 -26
- package/src/types.ts +67 -0
- package/src/utils/KeyMapper.ts +76 -74
- package/src/utils/TimeUtils.ts +11 -0
- package/src/utils/color.ts +25 -25
- package/src/utils/hist.js +22 -22
- package/src/utils/index.ts +2 -3
- package/src/utils/mouse.ts +45 -0
- package/src/utils/siaIcons.jsx +5 -7
- package/src/utils/transform.ts +186 -0
- package/src/utils/uiConfig.js +19 -22
- package/src/utils/windowViewport.ts +34 -0
- package/dist/AnnoExampleViewer.cjs +0 -1
- package/dist/AnnoExampleViewer.js +0 -1
- package/dist/AnnoLabelInput.cjs +0 -1
- package/dist/AnnoLabelInput.js +0 -1
- package/dist/AnnoToolBar.cjs +0 -19
- package/dist/AnnoToolBar.js +0 -19
- package/dist/Annotation/AnnoBar.cjs +0 -1
- package/dist/Annotation/AnnoBar.js +0 -1
- package/dist/Annotation/Annotation.cjs +0 -1
- package/dist/Annotation/Annotation.js +0 -1
- package/dist/Annotation/BBox.cjs +0 -1
- package/dist/Annotation/BBox.js +0 -1
- package/dist/Annotation/Edge.cjs +0 -1
- package/dist/Annotation/Edge.js +0 -1
- package/dist/Annotation/InfSelectionArea.cjs +0 -1
- package/dist/Annotation/InfSelectionArea.js +0 -1
- package/dist/Annotation/Line.cjs +0 -1
- package/dist/Annotation/Line.js +0 -1
- package/dist/Annotation/Node.cjs +0 -1
- package/dist/Annotation/Node.js +0 -1
- package/dist/Annotation/Point.cjs +0 -1
- package/dist/Annotation/Point.js +0 -1
- package/dist/Annotation/Polygon.cjs +0 -1
- package/dist/Annotation/Polygon.js +0 -1
- package/dist/Annotation/logic/Annotation.cjs +0 -1
- package/dist/Annotation/logic/AnnotationUtils.cjs +0 -1
- package/dist/Annotation/logic/AnnotationUtils.js +0 -1
- package/dist/Annotation/ui/AnnotationComponent.cjs +0 -1
- package/dist/Annotation/ui/atoms/AnnoBar.cjs +0 -1
- package/dist/Annotation/ui/atoms/DaviIcon.cjs +0 -19
- package/dist/Annotation/ui/atoms/Edge.cjs +0 -1
- package/dist/Annotation/ui/atoms/Node.cjs +0 -1
- package/dist/Annotation/ui/atoms/PolygonArea.cjs +0 -1
- package/dist/Annotation/ui/tools/BBox.cjs +0 -1
- package/dist/Annotation/ui/tools/Line.cjs +0 -1
- package/dist/Annotation/ui/tools/Point.cjs +0 -1
- package/dist/Annotation/ui/tools/Polygon.cjs +0 -1
- package/dist/Canvas/Canvas.cjs +0 -1
- package/dist/Canvas/LabelInput.cjs +0 -1
- package/dist/Canvas.cjs +0 -1
- package/dist/Canvas.js +0 -1
- package/dist/ImgBar.cjs +0 -1
- package/dist/ImgBar.js +0 -1
- package/dist/InfoBoxes/AnnoDetails.cjs +0 -1
- package/dist/InfoBoxes/AnnoDetails.js +0 -1
- package/dist/InfoBoxes/AnnoStats.cjs +0 -1
- package/dist/InfoBoxes/AnnoStats.js +0 -1
- package/dist/InfoBoxes/InfoBox.cjs +0 -1
- package/dist/InfoBoxes/InfoBox.js +0 -1
- package/dist/InfoBoxes/InfoBoxArea.cjs +0 -1
- package/dist/InfoBoxes/InfoBoxArea.js +0 -1
- package/dist/InfoBoxes/LabelInfo.cjs +0 -1
- package/dist/InfoBoxes/LabelInfo.js +0 -1
- package/dist/LabelInput.cjs +0 -1
- package/dist/LabelInput.js +0 -1
- package/dist/Prompt.cjs +0 -1
- package/dist/Prompt.js +0 -1
- package/dist/SIAFilterButton.cjs +0 -1
- package/dist/SIAFilterButton.js +0 -1
- package/dist/SIASettingButton.cjs +0 -1
- package/dist/SIASettingButton.js +0 -1
- package/dist/Sia.cjs +0 -1
- package/dist/Sia2.cjs +0 -1
- package/dist/Sia2.js +0 -1
- package/dist/SiaPopup.cjs +0 -1
- package/dist/SiaPopup.js +0 -1
- package/dist/ToolBar.cjs +0 -1
- package/dist/ToolBar.js +0 -1
- package/dist/Toolbar/NavigationButtons.cjs +0 -1
- package/dist/Toolbar/NavigationButtons.js +0 -1
- package/dist/Toolbar/Toolbar.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/AccessibilityTools.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/AnnoToolSelector.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabel.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabel.js +0 -1
- package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/ImageTools.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/Instructions.cjs +0 -1
- package/dist/Toolbar/ToolbarItems/InstructionsModal.cjs +0 -1
- package/dist/ToolbarItem.cjs +0 -1
- package/dist/ToolbarItem.js +0 -1
- package/dist/_virtual/_commonjsHelpers.cjs +0 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -1
- package/dist/_virtual/lodash.cjs +0 -1
- package/dist/_virtual/lodash.js +0 -1
- package/dist/assets/Annotation/Annotation-Cd5Ua5TG.css +0 -1
- package/dist/assets/Toolbar-Cp1xyYeH.css +0 -1
- package/dist/filterTools.cjs +0 -1
- package/dist/filterTools.js +0 -1
- package/dist/index.cjs +0 -1
- package/dist/models/AllowedTools.cjs +0 -1
- package/dist/models/AllowedTools.js +0 -1
- package/dist/models/AnnotationMode.cjs +0 -1
- package/dist/models/AnnotationSettings.cjs +0 -1
- package/dist/models/AnnotationSettings.js +0 -1
- package/dist/models/AnnotationStatus.cjs +0 -1
- package/dist/models/AnnotationTool.cjs +0 -1
- package/dist/models/CanvasAction.cjs +0 -1
- package/dist/models/Direction.cjs +0 -1
- package/dist/models/EditorModes.cjs +0 -1
- package/dist/models/ExternalAnnotation.cjs +0 -1
- package/dist/models/ExternalAnnotation.js +0 -1
- package/dist/models/KeyAction.cjs +0 -1
- package/dist/models/Label.cjs +0 -1
- package/dist/models/Label.js +0 -1
- package/dist/models/UiConfig.cjs +0 -1
- package/dist/models/UiConfig.js +0 -1
- package/dist/models/index.cjs +0 -1
- package/dist/siaDummyData.cjs +0 -7
- package/dist/siaDummyData.js +0 -7
- package/dist/stories/Canvas/CanvasOffset.cjs +0 -1
- package/dist/stories/Canvas/CanvasOffset.js +0 -1
- package/dist/stories/FilterDropdown.stories.cjs +0 -1
- package/dist/stories/FilterDropdown.stories.js +0 -1
- package/dist/stories/SIA2/DemoWrapper.cjs +0 -1
- package/dist/stories/SIA2/DemoWrapper.js +0 -1
- package/dist/stories/siaDummyData.cjs +0 -1
- package/dist/stories/siaDummyData.js +0 -1
- package/dist/stories/siaDummyData2.cjs +0 -7
- package/dist/stories/siaDummyData2.js +0 -7
- package/dist/types/annoStatus.cjs +0 -1
- package/dist/types/annoStatus.js +0 -1
- package/dist/types/canvasActions.cjs +0 -1
- package/dist/types/canvasActions.js +0 -1
- package/dist/types/cursorstyles.cjs +0 -1
- package/dist/types/cursorstyles.js +0 -1
- package/dist/types/modes.cjs +0 -1
- package/dist/types/modes.js +0 -1
- package/dist/types/notificationType.cjs +0 -1
- package/dist/types/notificationType.js +0 -1
- package/dist/types/toolbarEvents.cjs +0 -1
- package/dist/types/toolbarEvents.js +0 -1
- package/dist/types/tools.cjs +0 -1
- package/dist/types/tools.js +0 -1
- package/dist/types.cjs +0 -1
- package/dist/utils/KeyMapper.cjs +0 -1
- package/dist/utils/annoConversion.cjs +0 -1
- package/dist/utils/annoConversion.js +0 -1
- package/dist/utils/annoConversion2.cjs +0 -1
- package/dist/utils/annoConversion2.js +0 -1
- package/dist/utils/color.cjs +0 -1
- package/dist/utils/colorlut.cjs +0 -1
- package/dist/utils/colorlut.js +0 -1
- package/dist/utils/constraints.cjs +0 -1
- package/dist/utils/constraints.js +0 -1
- package/dist/utils/hist.cjs +0 -1
- package/dist/utils/hist.js +0 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/keyActions.cjs +0 -1
- package/dist/utils/keyActions.js +0 -1
- package/dist/utils/mouse.cjs +0 -1
- package/dist/utils/mouse2.cjs +0 -1
- package/dist/utils/mouse2.js +0 -1
- package/dist/utils/siaIcons.cjs +0 -12
- package/dist/utils/transform.cjs +0 -1
- package/dist/utils/transform2.cjs +0 -1
- package/dist/utils/transform2.js +0 -1
- package/dist/utils/uiConfig.cjs +0 -1
- package/dist/utils/windowViewport.cjs +0 -1
- package/dist/utils/windowViewport2.cjs +0 -1
- package/dist/utils/windowViewport2.js +0 -1
- package/src/AnnoLabelInput.jsx +0 -109
- package/src/AnnoToolBar.jsx +0 -153
- package/src/Annotation/AnnoBar.jsx +0 -154
- package/src/Annotation/Annotation.jsx +0 -395
- package/src/Annotation/Annotation.scss +0 -47
- package/src/Annotation/BBox.jsx +0 -299
- package/src/Annotation/Edge.jsx +0 -92
- package/src/Annotation/InfSelectionArea.jsx +0 -72
- package/src/Annotation/Line.jsx +0 -68
- package/src/Annotation/Node.jsx +0 -282
- package/src/Annotation/Point.jsx +0 -200
- package/src/Annotation/Polygon.jsx +0 -404
- package/src/Annotation/logic/AnnotationUtils.ts +0 -30
- package/src/Canvas.jsx +0 -2194
- package/src/ImgBar.jsx +0 -131
- package/src/LabelInput.jsx +0 -238
- package/src/Prompt.jsx +0 -45
- package/src/SIAFilterButton.jsx +0 -186
- package/src/Sia.jsx +0 -478
- package/src/Sia2.tsx +0 -392
- package/src/SiaPopup.jsx +0 -15
- package/src/ToolBar.jsx +0 -463
- package/src/Toolbar/NavigationButtons.tsx +0 -21
- package/src/Toolbar/ToolbarItem.jsx +0 -30
- package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabel.tsx +0 -62
- package/src/Toolbar.css +0 -13
- package/src/ToolbarItem.jsx +0 -31
- package/src/filterTools.js +0 -5
- package/src/models/AllowedTools.tsx +0 -9
- package/src/models/AnnotationSettings.tsx +0 -9
- package/src/models/ExternalAnnotation.ts +0 -15
- package/src/models/Label.tsx +0 -8
- package/src/models/UiConfig.tsx +0 -6
- package/src/stories/Button.jsx +0 -54
- package/src/stories/Button.stories.js +0 -48
- package/src/stories/Header.jsx +0 -69
- package/src/stories/Header.stories.js +0 -28
- package/src/stories/Page.jsx +0 -87
- package/src/stories/Page.stories.js +0 -28
- package/src/stories/SIA2/DemoWrapper.stories.tsx +0 -167
- package/src/stories/SIA2/DemoWrapper.tsx +0 -54
- package/src/stories/SIA2/Sia2.stories.tsx +0 -62
- package/src/stories/Toolbar/ImageTools/ImageLabel.stories.tsx +0 -32
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/lost.js +0 -54
- package/src/stories/page.css +0 -69
- package/src/stories/siaDummyData.js +0 -263
- package/src/stories/store.js +0 -18
- package/src/test.js +0 -7
- package/src/types/annoStatus.js +0 -4
- package/src/types/canvasActions.js +0 -58
- package/src/types/cursorstyles.js +0 -3
- package/src/types/modes.js +0 -9
- package/src/types/notificationType.js +0 -11
- package/src/types/toolbarEvents.js +0 -35
- package/src/types/tools.js +0 -17
- package/src/types.tsx +0 -11
- package/src/utils/annoConversion.js +0 -145
- package/src/utils/annoConversion2.ts +0 -145
- package/src/utils/colorlut.js +0 -68
- package/src/utils/constraints.js +0 -81
- package/src/utils/index.js +0 -1
- package/src/utils/keyActions.js +0 -113
- package/src/utils/mouse.js +0 -14
- package/src/utils/mouse2.ts +0 -35
- package/src/utils/transform.js +0 -336
- package/src/utils/transform2.ts +0 -343
- package/src/utils/windowViewport.js +0 -34
- package/src/utils/windowViewport2.ts +0 -50
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import AnnotationTool from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import AnnotationSettings from "../../models/AnnotationSettings";
|
|
1
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
2
|
+
import Annotation from '../logic/Annotation'
|
|
3
|
+
import * as colorUtils from '../../utils/color'
|
|
4
|
+
import PointTool from './tools/Point'
|
|
5
|
+
import Line from './tools/Line'
|
|
6
|
+
import AnnoBar from './atoms/AnnoBar'
|
|
7
|
+
import CanvasAction from '../../models/CanvasAction'
|
|
8
|
+
import BBox from './tools/BBox'
|
|
9
|
+
import Polygon from './tools/Polygon'
|
|
10
|
+
import { useEffect, useRef, useState } from 'react'
|
|
11
|
+
import { AnnotationSettings, Label, Point, SIANotification } from '../../types'
|
|
12
|
+
import AnnotationMode from '../../models/AnnotationMode'
|
|
13
|
+
import TimeUtils from '../../utils/TimeUtils'
|
|
15
14
|
|
|
16
15
|
type AnnotationComponentProps = {
|
|
17
|
-
scaledAnnotation: Annotation
|
|
18
|
-
annotationSettings: AnnotationSettings
|
|
19
|
-
possibleLabels: Label[]
|
|
20
|
-
svgScale: number
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
scaledAnnotation: Annotation
|
|
17
|
+
annotationSettings: AnnotationSettings
|
|
18
|
+
possibleLabels: Label[]
|
|
19
|
+
svgScale: number
|
|
20
|
+
svgTranslation: Point
|
|
21
|
+
pageToStageOffset: Point
|
|
22
|
+
strokeWidth: number
|
|
23
|
+
nodeRadius: number
|
|
24
|
+
isSelected: boolean
|
|
25
|
+
isDisabled?: boolean
|
|
26
|
+
onFinishAnnoCreate: (fullyCreatedAnnotation: Annotation) => void
|
|
27
|
+
onLabelIconClicked: (markerPosition: Point) => void
|
|
28
|
+
onAction?: (annotation: Annotation, canvasAction: CanvasAction) => void
|
|
29
|
+
onAnnoChanged?: (annotation: Annotation) => void
|
|
30
|
+
onAnnotationModeChange?: (annotationMode: AnnotationMode) => void
|
|
31
|
+
onNotification?: (notification: SIANotification) => void
|
|
32
|
+
}
|
|
32
33
|
|
|
33
34
|
const AnnotationComponent = ({
|
|
34
35
|
scaledAnnotation,
|
|
35
36
|
annotationSettings,
|
|
36
37
|
possibleLabels,
|
|
37
38
|
svgScale,
|
|
39
|
+
svgTranslation,
|
|
38
40
|
pageToStageOffset,
|
|
39
41
|
strokeWidth,
|
|
40
42
|
nodeRadius,
|
|
@@ -45,15 +47,21 @@ const AnnotationComponent = ({
|
|
|
45
47
|
onAction = (_, __) => {},
|
|
46
48
|
onAnnoChanged = (_) => {},
|
|
47
49
|
onAnnotationModeChange = (_) => {},
|
|
50
|
+
onNotification = (_) => {},
|
|
48
51
|
}: AnnotationComponentProps) => {
|
|
49
|
-
const [coordinates, setCoordinates] = useState<Point[]>(
|
|
50
|
-
scaledAnnotation.coordinates,
|
|
51
|
-
);
|
|
52
|
+
const [coordinates, setCoordinates] = useState<Point[]>(scaledAnnotation.coordinates)
|
|
52
53
|
|
|
53
54
|
const [annotationMode, setAnnotationMode] = useState<AnnotationMode>(
|
|
54
55
|
scaledAnnotation.mode,
|
|
55
|
-
)
|
|
56
|
-
const [isDragging, setIsDragging] = useState<boolean>(false)
|
|
56
|
+
)
|
|
57
|
+
const [isDragging, setIsDragging] = useState<boolean>(false)
|
|
58
|
+
|
|
59
|
+
const annoTimestampRef = useRef<number | undefined>(undefined)
|
|
60
|
+
const [annoTimestamp, setAnnoTimestamp] = useState<number | undefined>()
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
annoTimestampRef.current = annoTimestamp
|
|
64
|
+
}, [annoTimestamp])
|
|
57
65
|
|
|
58
66
|
/**
|
|
59
67
|
* during user editing of the annotation, multiple events are fired by the children
|
|
@@ -63,94 +71,115 @@ const AnnotationComponent = ({
|
|
|
63
71
|
* since both events are fired during the same render, onMoved would give away old coorinates
|
|
64
72
|
* use this reference as a workaround to get the up-to-date coordinates even in this edge-case
|
|
65
73
|
*/
|
|
66
|
-
const coordinatesRef = useRef<Point[]>(coordinates)
|
|
74
|
+
const coordinatesRef = useRef<Point[]>(coordinates)
|
|
67
75
|
|
|
68
76
|
useEffect(() => {
|
|
69
|
-
coordinatesRef.current = coordinates
|
|
70
|
-
}, [coordinates])
|
|
77
|
+
coordinatesRef.current = coordinates
|
|
78
|
+
}, [coordinates])
|
|
71
79
|
|
|
72
80
|
const finishAnnoCreate = () => {
|
|
73
|
-
setAnnotationMode(AnnotationMode.VIEW)
|
|
81
|
+
setAnnotationMode(AnnotationMode.VIEW)
|
|
74
82
|
|
|
75
83
|
const newAnnotation = {
|
|
76
84
|
...scaledAnnotation,
|
|
77
85
|
coordinates: coordinatesRef.current,
|
|
78
|
-
}
|
|
86
|
+
}
|
|
79
87
|
|
|
80
|
-
onFinishAnnoCreate(newAnnotation)
|
|
81
|
-
}
|
|
88
|
+
onFinishAnnoCreate(newAnnotation)
|
|
89
|
+
}
|
|
82
90
|
|
|
83
91
|
const getLabel = (labelId: number): Label | undefined => {
|
|
84
92
|
return possibleLabels.find((label: Label) => {
|
|
85
|
-
return label.id === labelId
|
|
86
|
-
})
|
|
87
|
-
}
|
|
93
|
+
return label.id === labelId
|
|
94
|
+
})
|
|
95
|
+
}
|
|
88
96
|
|
|
89
97
|
const getColor = () => {
|
|
90
98
|
if (!scaledAnnotation.labelIds || scaledAnnotation.labelIds.length == 0)
|
|
91
|
-
return colorUtils.getDefaultColor()
|
|
99
|
+
return colorUtils.getDefaultColor()
|
|
92
100
|
|
|
93
|
-
const label = getLabel(scaledAnnotation.labelIds[0])
|
|
101
|
+
const label = getLabel(scaledAnnotation.labelIds[0])
|
|
94
102
|
|
|
95
|
-
if (label === undefined || label.color ===
|
|
96
|
-
return colorUtils.getDefaultColor()
|
|
103
|
+
if (label?.color === undefined || label.color === null)
|
|
104
|
+
return colorUtils.getDefaultColor()
|
|
97
105
|
|
|
98
|
-
return label.color
|
|
99
|
-
}
|
|
106
|
+
return label.color
|
|
107
|
+
}
|
|
100
108
|
|
|
101
|
-
const color = getColor()
|
|
109
|
+
const color = getColor()
|
|
102
110
|
const annotationStyle = {
|
|
103
111
|
stroke: color,
|
|
104
112
|
fill: color,
|
|
105
113
|
strokeWidth: strokeWidth / svgScale,
|
|
106
114
|
r: nodeRadius / svgScale,
|
|
107
|
-
}
|
|
115
|
+
}
|
|
108
116
|
|
|
109
117
|
const changeAnnoCoords = (newCoordinates: Point[]) => {
|
|
110
|
-
setCoordinates(newCoordinates)
|
|
118
|
+
setCoordinates(newCoordinates)
|
|
111
119
|
|
|
112
|
-
let newCoordinatesWithoutMouse = newCoordinates
|
|
120
|
+
let newCoordinatesWithoutMouse = newCoordinates
|
|
113
121
|
|
|
114
122
|
// while adding/moving the annotation, the mouse cursor is the last point of the coordinates
|
|
115
123
|
// remove it before saving the annotation
|
|
116
124
|
if ([AnnotationMode.ADD, AnnotationMode.MOVE].includes(annotationMode)) {
|
|
117
125
|
// last point is mouse - remove it before export
|
|
118
|
-
newCoordinatesWithoutMouse = newCoordinates.slice(0, -1)
|
|
126
|
+
newCoordinatesWithoutMouse = newCoordinates.slice(0, -1)
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
onAnnoChanged({
|
|
122
130
|
...scaledAnnotation,
|
|
123
131
|
coordinates: newCoordinatesWithoutMouse,
|
|
124
|
-
})
|
|
125
|
-
}
|
|
132
|
+
})
|
|
133
|
+
}
|
|
126
134
|
|
|
127
135
|
const onMoving = (newCoords: Point[]) => {
|
|
128
|
-
if (
|
|
129
|
-
|
|
136
|
+
if (
|
|
137
|
+
![AnnotationMode.ADD, AnnotationMode.CREATE, AnnotationMode.MOVE].includes(
|
|
138
|
+
annotationMode,
|
|
139
|
+
)
|
|
140
|
+
) {
|
|
141
|
+
setAnnotationMode(AnnotationMode.MOVE)
|
|
130
142
|
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
setAnnoTimestamp(performance.now())
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
setCoordinates(newCoords)
|
|
147
|
+
}
|
|
133
148
|
|
|
134
149
|
const onMoved = () => {
|
|
135
|
-
setAnnotationMode(AnnotationMode.VIEW)
|
|
150
|
+
setAnnotationMode(AnnotationMode.VIEW)
|
|
151
|
+
|
|
152
|
+
const annoEditDuration: number = TimeUtils.getRoundedDuration(
|
|
153
|
+
annoTimestampRef.current,
|
|
154
|
+
performance.now(),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
// add annotation time (or set it if there was no time before)
|
|
158
|
+
// null seems to be a number in the JS world
|
|
159
|
+
const newAnnoTime: number =
|
|
160
|
+
Number.isNaN(scaledAnnotation.annoTime) || scaledAnnotation.annoTime === null
|
|
161
|
+
? annoEditDuration
|
|
162
|
+
: scaledAnnotation.annoTime + annoEditDuration
|
|
136
163
|
|
|
137
164
|
// moving finished - send event to canvas
|
|
138
165
|
onAnnoChanged({
|
|
139
166
|
...scaledAnnotation,
|
|
140
167
|
coordinates: coordinatesRef.current,
|
|
141
|
-
|
|
142
|
-
|
|
168
|
+
annoTime: newAnnoTime,
|
|
169
|
+
})
|
|
170
|
+
}
|
|
143
171
|
|
|
144
172
|
useEffect(() => {
|
|
145
|
-
onAnnotationModeChange(annotationMode)
|
|
146
|
-
}, [annotationMode])
|
|
173
|
+
onAnnotationModeChange(annotationMode)
|
|
174
|
+
}, [annotationMode])
|
|
147
175
|
|
|
148
176
|
// apply coordinate changes from sia (e.g. out of image fixes)
|
|
149
177
|
// ignore outside changes while creating annotation
|
|
150
178
|
useEffect(() => {
|
|
151
|
-
if (annotationMode === AnnotationMode.CREATE)
|
|
152
|
-
|
|
153
|
-
|
|
179
|
+
if (annotationMode === AnnotationMode.CREATE || annotationMode === AnnotationMode.ADD)
|
|
180
|
+
return
|
|
181
|
+
setCoordinates(scaledAnnotation.coordinates)
|
|
182
|
+
}, [scaledAnnotation])
|
|
154
183
|
|
|
155
184
|
const renderAnno = () => {
|
|
156
185
|
switch (scaledAnnotation.type) {
|
|
@@ -162,15 +191,13 @@ const AnnotationComponent = ({
|
|
|
162
191
|
coordinates={coordinates[0]}
|
|
163
192
|
pageToStageOffset={pageToStageOffset}
|
|
164
193
|
svgScale={svgScale}
|
|
194
|
+
svgTranslation={svgTranslation}
|
|
165
195
|
style={annotationStyle}
|
|
166
|
-
onMoving={(
|
|
167
|
-
setAnnotationMode(AnnotationMode.MOVE);
|
|
168
|
-
setCoordinates([newPoint]);
|
|
169
|
-
}}
|
|
196
|
+
onMoving={(point: Point) => onMoving([point])}
|
|
170
197
|
onMoved={onMoved}
|
|
171
198
|
onIsDraggingStateChanged={setIsDragging}
|
|
172
199
|
/>
|
|
173
|
-
)
|
|
200
|
+
)
|
|
174
201
|
case AnnotationTool.Line:
|
|
175
202
|
return (
|
|
176
203
|
<Line
|
|
@@ -179,8 +206,8 @@ const AnnotationComponent = ({
|
|
|
179
206
|
isSelected={isSelected}
|
|
180
207
|
pageToStageOffset={pageToStageOffset}
|
|
181
208
|
annotationMode={annotationMode}
|
|
182
|
-
setAnnotationMode={setAnnotationMode}
|
|
183
209
|
svgScale={svgScale}
|
|
210
|
+
svgTranslation={svgTranslation}
|
|
184
211
|
style={annotationStyle}
|
|
185
212
|
onAddNode={changeAnnoCoords}
|
|
186
213
|
onDeleteNode={changeAnnoCoords}
|
|
@@ -189,7 +216,7 @@ const AnnotationComponent = ({
|
|
|
189
216
|
onIsDraggingStateChanged={setIsDragging}
|
|
190
217
|
onFinishAnnoCreate={finishAnnoCreate}
|
|
191
218
|
/>
|
|
192
|
-
)
|
|
219
|
+
)
|
|
193
220
|
case AnnotationTool.BBox:
|
|
194
221
|
return (
|
|
195
222
|
<BBox
|
|
@@ -201,15 +228,16 @@ const AnnotationComponent = ({
|
|
|
201
228
|
pageToStageOffset={pageToStageOffset}
|
|
202
229
|
style={annotationStyle}
|
|
203
230
|
svgScale={svgScale}
|
|
231
|
+
svgTranslation={svgTranslation}
|
|
204
232
|
onDeleteNode={() => {
|
|
205
|
-
console.log(
|
|
233
|
+
console.log('TODO')
|
|
206
234
|
}}
|
|
207
235
|
onIsDraggingStateChanged={setIsDragging}
|
|
208
236
|
onFinishAnnoCreate={finishAnnoCreate}
|
|
209
237
|
onMoving={onMoving}
|
|
210
238
|
onMoved={onMoved}
|
|
211
239
|
/>
|
|
212
|
-
)
|
|
240
|
+
)
|
|
213
241
|
case AnnotationTool.Polygon:
|
|
214
242
|
return (
|
|
215
243
|
<Polygon
|
|
@@ -219,19 +247,20 @@ const AnnotationComponent = ({
|
|
|
219
247
|
isDisabled={isDisabled}
|
|
220
248
|
pageToStageOffset={pageToStageOffset}
|
|
221
249
|
annotationMode={annotationMode}
|
|
222
|
-
setAnnotationMode={setAnnotationMode}
|
|
223
250
|
svgScale={svgScale}
|
|
251
|
+
svgTranslation={svgTranslation}
|
|
224
252
|
style={annotationStyle}
|
|
225
253
|
onAddNode={changeAnnoCoords}
|
|
226
254
|
onDeleteNode={changeAnnoCoords}
|
|
227
255
|
onMoving={onMoving}
|
|
228
256
|
onMoved={onMoved}
|
|
257
|
+
onNotification={onNotification}
|
|
229
258
|
onIsDraggingStateChanged={setIsDragging}
|
|
230
259
|
onFinishAnnoCreate={finishAnnoCreate}
|
|
231
260
|
/>
|
|
232
|
-
)
|
|
261
|
+
)
|
|
233
262
|
}
|
|
234
|
-
}
|
|
263
|
+
}
|
|
235
264
|
|
|
236
265
|
return (
|
|
237
266
|
<g
|
|
@@ -240,8 +269,8 @@ const AnnotationComponent = ({
|
|
|
240
269
|
// onMouseDown={(e) => this.onMouseDown(e)}
|
|
241
270
|
// onContextMenu={(e) => this.onContextMenu(e)}
|
|
242
271
|
onClick={(e) => {
|
|
243
|
-
e.stopPropagation()
|
|
244
|
-
onAction(scaledAnnotation, CanvasAction.ANNO_SELECTED)
|
|
272
|
+
e.stopPropagation()
|
|
273
|
+
onAction(scaledAnnotation, CanvasAction.ANNO_SELECTED)
|
|
245
274
|
}}
|
|
246
275
|
>
|
|
247
276
|
{!isDragging && annotationMode !== AnnotationMode.CREATE && (
|
|
@@ -259,7 +288,7 @@ const AnnotationComponent = ({
|
|
|
259
288
|
)}
|
|
260
289
|
{renderAnno()}
|
|
261
290
|
</g>
|
|
262
|
-
)
|
|
263
|
-
}
|
|
291
|
+
)
|
|
292
|
+
}
|
|
264
293
|
|
|
265
|
-
export default AnnotationComponent
|
|
294
|
+
export default AnnotationComponent
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { CSSProperties, useEffect, useRef, useState } from
|
|
2
|
-
import Label from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import DaviIcon from "./DaviIcon";
|
|
1
|
+
import { CSSProperties, useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { Label, Point } from '../../../types'
|
|
3
|
+
import transform from '../../../utils/transform'
|
|
4
|
+
import DaviIcon from './DaviIcon'
|
|
6
5
|
|
|
7
|
-
const DEFAULT_FONT_SIZE = 10
|
|
8
|
-
const DEFAULT_RECT_HEIGHT = 15
|
|
9
|
-
const TEXT_PADDING = 3
|
|
6
|
+
const DEFAULT_FONT_SIZE = 10
|
|
7
|
+
const DEFAULT_RECT_HEIGHT = 15
|
|
8
|
+
const TEXT_PADDING = 3
|
|
10
9
|
|
|
11
10
|
type AnnoBarProps = {
|
|
12
|
-
annotationCoordinates: Point[]
|
|
13
|
-
canLabel: boolean
|
|
14
|
-
color: string
|
|
15
|
-
labels: Label[]
|
|
16
|
-
selectedLabelIds: number[]
|
|
17
|
-
isSelected: boolean
|
|
18
|
-
svgScale: number
|
|
19
|
-
style: CSSProperties
|
|
20
|
-
onLabelIconClicked: (markerPosition: Point) => void
|
|
21
|
-
}
|
|
11
|
+
annotationCoordinates: Point[]
|
|
12
|
+
canLabel: boolean
|
|
13
|
+
color: string
|
|
14
|
+
labels: Label[]
|
|
15
|
+
selectedLabelIds: number[]
|
|
16
|
+
isSelected: boolean
|
|
17
|
+
svgScale: number
|
|
18
|
+
style: CSSProperties
|
|
19
|
+
onLabelIconClicked: (markerPosition: Point) => void
|
|
20
|
+
}
|
|
22
21
|
const AnnoBar = ({
|
|
23
22
|
annotationCoordinates,
|
|
24
23
|
canLabel,
|
|
@@ -30,57 +29,56 @@ const AnnoBar = ({
|
|
|
30
29
|
style,
|
|
31
30
|
onLabelIconClicked,
|
|
32
31
|
}: AnnoBarProps) => {
|
|
33
|
-
const [
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
32
|
+
const [topLeftPoint, setTopLeftPoint] = useState<Point>({ x: 0, y: 0 })
|
|
33
|
+
const barPosition: Point = {
|
|
34
|
+
x: topLeftPoint.x + 7 / svgScale,
|
|
35
|
+
y: topLeftPoint.y - 10 / svgScale,
|
|
36
|
+
}
|
|
37
|
+
const [barWidth, setBarWidth] = useState<number>(0)
|
|
38
|
+
const [barHeight, setBarHeight] = useState<number>(0)
|
|
39
|
+
const [fontSize, setFontSize] = useState<number>(0)
|
|
40
|
+
const [labelText, setLabelText] = useState<string>('')
|
|
41
|
+
|
|
42
|
+
const textRef = useRef(null)
|
|
40
43
|
|
|
41
44
|
useEffect(() => {
|
|
42
|
-
setLabelText(getLabelText())
|
|
43
|
-
}, [selectedLabelIds])
|
|
45
|
+
setLabelText(getLabelText())
|
|
46
|
+
}, [selectedLabelIds])
|
|
44
47
|
|
|
45
48
|
useEffect(() => {
|
|
46
49
|
// get the most top left point from the annotation
|
|
47
|
-
const topPoints: Point[] = transform.getTopPoint(annotationCoordinates)
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const newBarPosition: Point = {
|
|
51
|
-
x: topLeftPoint.x + 7 / svgScale,
|
|
52
|
-
y: topLeftPoint.y - 10 / svgScale,
|
|
53
|
-
};
|
|
50
|
+
const topPoints: Point[] = transform.getTopPoint(annotationCoordinates)
|
|
51
|
+
const newTopLeftPoint: Point = transform.getMostLeftPoints(topPoints)[0]
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
setTopLeftPoint(newTopLeftPoint)
|
|
56
54
|
|
|
57
55
|
// calculate scaled font size
|
|
58
|
-
const newFontSize = Math.ceil(DEFAULT_FONT_SIZE / svgScale)
|
|
59
|
-
setFontSize(newFontSize)
|
|
56
|
+
const newFontSize = Math.ceil(DEFAULT_FONT_SIZE / svgScale)
|
|
57
|
+
setFontSize(newFontSize)
|
|
60
58
|
|
|
61
|
-
setBarHeight(DEFAULT_RECT_HEIGHT / svgScale)
|
|
62
|
-
}, [svgScale])
|
|
59
|
+
setBarHeight(DEFAULT_RECT_HEIGHT / svgScale)
|
|
60
|
+
}, [svgScale])
|
|
63
61
|
|
|
64
62
|
useEffect(() => {
|
|
65
|
-
if (textRef === undefined) return
|
|
63
|
+
if (textRef === undefined) return
|
|
66
64
|
|
|
67
65
|
// calculate size of box around label text
|
|
68
|
-
const textElement: DOMRect = textRef.current.getBoundingClientRect()
|
|
69
|
-
const textWidth: number = textElement.width
|
|
70
|
-
const rectWidth = (textWidth + TEXT_PADDING) / svgScale
|
|
66
|
+
const textElement: DOMRect = textRef.current.getBoundingClientRect()
|
|
67
|
+
const textWidth: number = textElement.width
|
|
68
|
+
const rectWidth = (textWidth + TEXT_PADDING) / svgScale
|
|
71
69
|
|
|
72
|
-
setBarWidth(rectWidth)
|
|
73
|
-
}, [textRef, labelText, fontSize])
|
|
70
|
+
setBarWidth(rectWidth)
|
|
71
|
+
}, [textRef, labelText, fontSize])
|
|
74
72
|
|
|
75
73
|
const getLabelText = () => {
|
|
76
74
|
const selectedLabels: Label[] = labels.filter((label: Label) =>
|
|
77
75
|
selectedLabelIds.includes(label.id),
|
|
78
|
-
)
|
|
76
|
+
)
|
|
79
77
|
|
|
80
|
-
const labelText = selectedLabels.map((l) => l.name).join(
|
|
78
|
+
const labelText = selectedLabels.map((l) => l.name).join(', ')
|
|
81
79
|
|
|
82
|
-
return labelText.length ? labelText :
|
|
83
|
-
}
|
|
80
|
+
return labelText.length ? labelText : 'no label'
|
|
81
|
+
}
|
|
84
82
|
|
|
85
83
|
return (
|
|
86
84
|
<g>
|
|
@@ -90,7 +88,7 @@ const AnnoBar = ({
|
|
|
90
88
|
y={barPosition.y - 30 / svgScale}
|
|
91
89
|
color={color}
|
|
92
90
|
size={60 / svgScale}
|
|
93
|
-
onClick={() => onLabelIconClicked(
|
|
91
|
+
onClick={() => onLabelIconClicked(topLeftPoint)}
|
|
94
92
|
/>
|
|
95
93
|
)}
|
|
96
94
|
|
|
@@ -126,7 +124,7 @@ const AnnoBar = ({
|
|
|
126
124
|
onContextMenu={(e) => e.preventDefault()}
|
|
127
125
|
/>
|
|
128
126
|
</g>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
131
129
|
|
|
132
|
-
export default AnnoBar
|
|
130
|
+
export default AnnoBar
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
type DaviIconProps = {
|
|
2
|
-
x: number
|
|
3
|
-
y: number
|
|
4
|
-
color: string
|
|
5
|
-
size: number
|
|
6
|
-
onClick?: () => void
|
|
7
|
-
}
|
|
2
|
+
x: number
|
|
3
|
+
y: number
|
|
4
|
+
color: string
|
|
5
|
+
size: number
|
|
6
|
+
onClick?: () => void
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
const DaviIcon = ({
|
|
10
|
-
|
|
11
|
-
y,
|
|
12
|
-
color,
|
|
13
|
-
size = 60,
|
|
14
|
-
onClick = () => {},
|
|
15
|
-
}: DaviIconProps) => {
|
|
16
|
-
const scale: number = size / 1400;
|
|
9
|
+
const DaviIcon = ({ x, y, color, size = 60, onClick = () => {} }: DaviIconProps) => {
|
|
10
|
+
const scale: number = size / 1400
|
|
17
11
|
|
|
18
12
|
return (
|
|
19
|
-
<g
|
|
20
|
-
transform={`translate(${x} ${y}) scale(${scale})`}
|
|
21
|
-
fill={color}
|
|
22
|
-
onClick={onClick}
|
|
23
|
-
>
|
|
13
|
+
<g transform={`translate(${x} ${y}) scale(${scale})`} fill={color} onClick={onClick}>
|
|
24
14
|
<path
|
|
25
15
|
id="Maps"
|
|
26
16
|
d="M620.561,817.217c-1.568-3.62-3.771-7.101-4.611-10.885
|
|
@@ -51,7 +41,7 @@ const DaviIcon = ({
|
|
|
51
41
|
c-0.074,8.051-6.938,12.819-13.703,12.847C731.482,263.519,724.956,259.059,724.709,250.898z"
|
|
52
42
|
/>
|
|
53
43
|
</g>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
44
|
+
)
|
|
45
|
+
}
|
|
56
46
|
|
|
57
|
-
export default DaviIcon
|
|
47
|
+
export default DaviIcon
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { CSSProperties } from
|
|
2
|
-
import { Point } from
|
|
3
|
-
import
|
|
1
|
+
import { CSSProperties, MouseEvent } from 'react'
|
|
2
|
+
import { Point, Vector2 } from '../../../types'
|
|
3
|
+
import mouse from '../../../utils/mouse'
|
|
4
4
|
|
|
5
5
|
type EdgeProps = {
|
|
6
|
-
startCoordinate: Point
|
|
7
|
-
endCoordinate: Point
|
|
8
|
-
isDisabled?: boolean
|
|
9
|
-
pageToStageOffset: Point
|
|
10
|
-
svgScale: number
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
startCoordinate: Point
|
|
7
|
+
endCoordinate: Point
|
|
8
|
+
isDisabled?: boolean
|
|
9
|
+
pageToStageOffset: Point
|
|
10
|
+
svgScale: number
|
|
11
|
+
svgTranslation: Vector2
|
|
12
|
+
style: CSSProperties
|
|
13
|
+
onAddNode?: (coordinate: Point) => void
|
|
14
|
+
onDoubleClick?: (e: MouseEvent) => void
|
|
15
|
+
onMouseDown: (e: MouseEvent) => void
|
|
16
|
+
onMouseMove: (e: MouseEvent) => void
|
|
17
|
+
}
|
|
17
18
|
|
|
18
19
|
const Edge = ({
|
|
19
20
|
startCoordinate,
|
|
@@ -22,20 +23,22 @@ const Edge = ({
|
|
|
22
23
|
pageToStageOffset,
|
|
23
24
|
style,
|
|
24
25
|
svgScale,
|
|
26
|
+
svgTranslation,
|
|
25
27
|
onAddNode = () => {},
|
|
26
28
|
onDoubleClick = () => {},
|
|
27
29
|
onMouseDown,
|
|
28
30
|
onMouseMove,
|
|
29
31
|
}: EdgeProps) => {
|
|
30
32
|
const addNode = (e: MouseEvent) => {
|
|
31
|
-
const mouseStageCoords: Point =
|
|
33
|
+
const mouseStageCoords: Point = mouse.getAntiScaledMouseStagePosition(
|
|
32
34
|
e,
|
|
33
35
|
pageToStageOffset,
|
|
34
36
|
svgScale,
|
|
35
|
-
|
|
37
|
+
svgTranslation,
|
|
38
|
+
)
|
|
36
39
|
|
|
37
|
-
onAddNode(mouseStageCoords)
|
|
38
|
-
}
|
|
40
|
+
onAddNode(mouseStageCoords)
|
|
41
|
+
}
|
|
39
42
|
|
|
40
43
|
return (
|
|
41
44
|
<line
|
|
@@ -49,9 +52,9 @@ const Edge = ({
|
|
|
49
52
|
onMouseDown={onMouseDown}
|
|
50
53
|
onMouseMove={onMouseMove}
|
|
51
54
|
onContextMenu={(e) => e.preventDefault()}
|
|
52
|
-
|
|
55
|
+
strokeDasharray={isDisabled ? '10,5' : '0'}
|
|
53
56
|
/>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
57
|
+
)
|
|
58
|
+
}
|
|
56
59
|
|
|
57
|
-
export default Edge
|
|
60
|
+
export default Edge
|