lost-sia 2.0.1-alpha12 → 2.0.1-alpha13
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/dist/Annotation/ui/atoms/AnnoBar.js +1 -1
- package/dist/Annotation/ui/atoms/Edge.js +1 -1
- package/dist/Annotation/ui/atoms/Node.js +1 -1
- package/dist/Annotation/ui/tools/BBox.js +1 -1
- package/dist/Annotation/ui/tools/Line.js +1 -1
- package/dist/Annotation/ui/tools/Polygon.js +1 -1
- package/dist/Canvas/Canvas.d.ts +2 -1
- package/dist/Canvas/Canvas.js +1 -1
- package/dist/Sia.js +1 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.js +1 -1
- package/dist/models/KeyAction.d.ts +2 -1
- package/dist/models/KeyAction.js +1 -1
- package/dist/stories/Canvas/Canvas.stories.d.ts +2 -1
- package/dist/utils/KeyMapper.js +1 -1
- package/dist/utils/mouse.js +1 -1
- package/dist/utils/siaIcons.js +5 -5
- 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 +9 -8
- package/src/Annotation/ui/atoms/AnnoBar.tsx +46 -46
- package/src/Annotation/ui/atoms/Edge.tsx +23 -23
- package/src/Annotation/ui/atoms/Node.tsx +51 -51
- package/src/Annotation/ui/tools/BBox.tsx +129 -145
- package/src/Annotation/ui/tools/Line.tsx +81 -87
- package/src/Annotation/ui/tools/Polygon.tsx +92 -95
- package/src/Canvas/Canvas.tsx +369 -397
- package/src/InfoBoxes/AnnoStats.jsx +1 -1
- package/src/InfoBoxes/InfoBoxArea.jsx +32 -34
- package/src/{Sia2.tsx → Sia.tsx} +156 -175
- package/src/index.ts +6 -17
- package/src/models/KeyAction.ts +1 -0
- package/src/stories/AnnotationTools.stories.tsx +21 -21
- package/src/stories/Canvas/Canvas.stories.tsx +31 -26
- package/src/stories/Canvas/CanvasOffset.tsx +23 -25
- package/src/stories/MinimalSia.stories.tsx +22 -22
- package/src/stories/SIA2/DemoWrapper.tsx +20 -24
- package/src/stories/SIA2/Sia2.stories.tsx +24 -24
- package/src/utils/KeyMapper.ts +3 -0
- package/src/utils/siaIcons.jsx +5 -7
- package/src/utils/windowViewport.ts +34 -0
- package/dist/AnnoExampleViewer.js +0 -1
- package/dist/AnnoLabelInput.js +0 -1
- package/dist/AnnoToolBar.js +0 -19
- package/dist/Annotation/AnnoBar.js +0 -1
- package/dist/Annotation/Annotation.js +0 -1
- package/dist/Annotation/BBox.js +0 -1
- package/dist/Annotation/Edge.js +0 -1
- package/dist/Annotation/InfSelectionArea.js +0 -1
- package/dist/Annotation/Line.js +0 -1
- package/dist/Annotation/Node.js +0 -1
- package/dist/Annotation/Point.js +0 -1
- package/dist/Annotation/Polygon.js +0 -1
- package/dist/Canvas.js +0 -1
- package/dist/ImgBar.js +0 -1
- package/dist/InfoBoxes/AnnoDetails.js +0 -1
- package/dist/InfoBoxes/AnnoStats.js +0 -1
- package/dist/InfoBoxes/InfoBox.js +0 -1
- package/dist/InfoBoxes/InfoBoxArea.js +0 -1
- package/dist/InfoBoxes/LabelInfo.js +0 -1
- package/dist/LabelInput.js +0 -1
- package/dist/Prompt.js +0 -1
- package/dist/SIAFilterButton.js +0 -1
- package/dist/SIASettingButton.js +0 -1
- package/dist/Sia2.js +0 -1
- package/dist/SiaPopup.js +0 -1
- package/dist/ToolBar.js +0 -1
- package/dist/ToolbarItem.js +0 -1
- package/dist/_virtual/_commonjsHelpers.js +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.js +0 -1
- package/dist/siaDummyData.js +0 -7
- package/dist/stories/Canvas/CanvasOffset.js +0 -1
- package/dist/stories/FilterDropdown.stories.js +0 -1
- package/dist/stories/SIA/SIA.stories.d.ts +0 -36
- package/dist/stories/SIA2/DemoWrapper.js +0 -1
- package/dist/stories/Toolbar/ImageTools/ImageLabel.stories.d.ts +0 -13
- package/dist/stories/siaDummyData.js +0 -1
- package/dist/stories/siaDummyData2.js +0 -7
- package/dist/types/annoStatus.js +0 -1
- package/dist/types/canvasActions.js +0 -1
- package/dist/types/cursorstyles.js +0 -1
- package/dist/types/modes.js +0 -1
- package/dist/types/notificationType.js +0 -1
- package/dist/types/toolbarEvents.js +0 -1
- package/dist/types/tools.js +0 -1
- package/dist/utils/annoConversion.js +0 -1
- package/dist/utils/annoConversion2.d.ts +0 -27
- package/dist/utils/annoConversion2.js +0 -1
- package/dist/utils/colorlut.js +0 -1
- package/dist/utils/constraints.js +0 -1
- package/dist/utils/hist.js +0 -1
- package/dist/utils/keyActions.js +0 -1
- package/dist/utils/mouse2.js +0 -1
- package/dist/utils/transform2.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/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/SiaPopup.jsx +0 -15
- package/src/ToolBar.jsx +0 -463
- package/src/Toolbar/ToolbarItem.jsx +0 -30
- package/src/Toolbar.css +0 -13
- package/src/ToolbarItem.jsx +0 -31
- package/src/filterTools.js +0 -5
- package/src/stories/SIA/SIA.stories.tsx +0 -64
- package/src/stories/Toolbar/ImageTools/ImageLabel.stories.tsx +0 -31
- package/src/stories/lost.js +0 -54
- 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/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/mouse.js +0 -14
- package/src/utils/transform.js +0 -336
- package/src/utils/windowViewport.js +0 -34
- /package/dist/{Sia2.d.ts → Sia.d.ts} +0 -0
- /package/dist/utils/{mouse2.d.ts → mouse.d.ts} +0 -0
- /package/dist/utils/{transform2.d.ts → transform.d.ts} +0 -0
- /package/src/utils/{mouse2.ts → mouse.ts} +0 -0
- /package/src/utils/{transform2.ts → transform.ts} +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { imgBlob } from
|
|
5
|
-
import { AllowedTools } from
|
|
3
|
+
import Sia from '../Sia'
|
|
4
|
+
import { imgBlob } from './siaDummyData'
|
|
5
|
+
import { AllowedTools } from '../types'
|
|
6
6
|
|
|
7
|
-
export const ActionsData = {}
|
|
7
|
+
export const ActionsData = {}
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
|
-
title:
|
|
11
|
-
component:
|
|
10
|
+
title: 'Annotation Tools',
|
|
11
|
+
component: Sia,
|
|
12
12
|
parameters: {
|
|
13
13
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
-
layout:
|
|
14
|
+
layout: 'padding',
|
|
15
15
|
},
|
|
16
|
-
tags: [
|
|
16
|
+
tags: ['!autodocs'],
|
|
17
17
|
excludeStories: /.*Data$/,
|
|
18
18
|
args: {
|
|
19
19
|
...ActionsData,
|
|
@@ -22,20 +22,20 @@ const meta = {
|
|
|
22
22
|
(Story) => (
|
|
23
23
|
<div
|
|
24
24
|
style={{
|
|
25
|
-
width:
|
|
26
|
-
height:
|
|
25
|
+
width: '50vw',
|
|
26
|
+
height: '65vh',
|
|
27
27
|
padding: 10,
|
|
28
|
-
overflow:
|
|
28
|
+
overflow: 'hidden',
|
|
29
29
|
}}
|
|
30
30
|
>
|
|
31
31
|
<Story />
|
|
32
32
|
</div>
|
|
33
33
|
),
|
|
34
34
|
],
|
|
35
|
-
} satisfies Meta<typeof
|
|
35
|
+
} satisfies Meta<typeof Sia>
|
|
36
36
|
|
|
37
|
-
export default meta
|
|
38
|
-
type Story = StoryObj<typeof meta
|
|
37
|
+
export default meta
|
|
38
|
+
type Story = StoryObj<typeof meta>
|
|
39
39
|
|
|
40
40
|
const allowedTools: AllowedTools = {
|
|
41
41
|
bbox: true,
|
|
@@ -43,7 +43,7 @@ const allowedTools: AllowedTools = {
|
|
|
43
43
|
point: false,
|
|
44
44
|
polygon: false,
|
|
45
45
|
junk: true,
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
47
|
|
|
48
48
|
export const BBoxOnly: Story = {
|
|
49
49
|
args: {
|
|
@@ -67,7 +67,7 @@ export const BBoxOnly: Story = {
|
|
|
67
67
|
|
|
68
68
|
...
|
|
69
69
|
|
|
70
|
-
<
|
|
70
|
+
<Sia
|
|
71
71
|
allowedTools={allowedTools}
|
|
72
72
|
image={imageBlob}
|
|
73
73
|
possibleLabels={[]}
|
|
@@ -75,7 +75,7 @@ export const BBoxOnly: Story = {
|
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
|
-
}
|
|
78
|
+
}
|
|
79
79
|
|
|
80
80
|
const noJunkTools = {
|
|
81
81
|
bbox: true,
|
|
@@ -83,7 +83,7 @@ const noJunkTools = {
|
|
|
83
83
|
point: true,
|
|
84
84
|
polygon: true,
|
|
85
85
|
junk: false,
|
|
86
|
-
}
|
|
86
|
+
}
|
|
87
87
|
|
|
88
88
|
export const NoJunk: Story = {
|
|
89
89
|
args: {
|
|
@@ -107,7 +107,7 @@ export const NoJunk: Story = {
|
|
|
107
107
|
|
|
108
108
|
...
|
|
109
109
|
|
|
110
|
-
<
|
|
110
|
+
<Sia
|
|
111
111
|
allowedTools={allowedTools}
|
|
112
112
|
image={imageBlob}
|
|
113
113
|
possibleLabels={[]}
|
|
@@ -115,4 +115,4 @@ export const NoJunk: Story = {
|
|
|
115
115
|
},
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
|
-
}
|
|
118
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import { fn } from
|
|
3
|
-
import { imgBlob } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { fn } from '@storybook/test'
|
|
3
|
+
import { imgBlob } from '../siaDummyData'
|
|
4
4
|
|
|
5
|
-
import Canvas from
|
|
6
|
-
import AnnotationTool from
|
|
7
|
-
import Annotation from
|
|
5
|
+
import Canvas from '../../Canvas/Canvas'
|
|
6
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
7
|
+
import Annotation from '../../Annotation/logic/Annotation'
|
|
8
8
|
|
|
9
|
-
import { possibleLabels } from
|
|
10
|
-
import { AnnotationSettings, UiConfig } from
|
|
9
|
+
import { possibleLabels } from '../siaDummyData2'
|
|
10
|
+
import { AnnotationSettings, UiConfig } from '../../types'
|
|
11
11
|
|
|
12
12
|
export const ActionsData = {
|
|
13
13
|
onAnnoEvent: fn(),
|
|
14
14
|
onKeyDown: fn(),
|
|
15
15
|
onKeyUp: fn(),
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
const meta = {
|
|
19
|
-
title:
|
|
19
|
+
title: 'Components/Canvas',
|
|
20
20
|
component: Canvas,
|
|
21
21
|
parameters: {
|
|
22
22
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
23
|
-
layout:
|
|
23
|
+
layout: 'fullscreen',
|
|
24
24
|
},
|
|
25
|
-
tags: [
|
|
25
|
+
tags: ['!autodocs'],
|
|
26
26
|
excludeStories: /.*Data$/,
|
|
27
27
|
args: {
|
|
28
28
|
// ...ActionsData,
|
|
29
29
|
},
|
|
30
|
-
} satisfies Meta<typeof Canvas
|
|
30
|
+
} satisfies Meta<typeof Canvas>
|
|
31
31
|
|
|
32
|
-
export default meta
|
|
33
|
-
type Story = StoryObj<typeof meta
|
|
32
|
+
export default meta
|
|
33
|
+
type Story = StoryObj<typeof meta>
|
|
34
34
|
|
|
35
35
|
const uiConfig: UiConfig = {
|
|
36
36
|
nodeRadius: 4,
|
|
37
37
|
strokeWidth: 4,
|
|
38
38
|
imageCentered: false,
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
|
|
41
41
|
const annotationSettings: AnnotationSettings = {
|
|
42
42
|
canHaveMultipleLabels: true,
|
|
43
43
|
canCreate: true,
|
|
44
44
|
canLabel: true,
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
export const Default: Story = {
|
|
48
48
|
args: {
|
|
@@ -61,10 +61,11 @@ export const Default: Story = {
|
|
|
61
61
|
onAnnoEditing: () => {},
|
|
62
62
|
onRequestNewAnnoId: () => 1,
|
|
63
63
|
onSelectAnnotation: () => {},
|
|
64
|
+
onSetIsImageJunk: () => {},
|
|
64
65
|
onSetSelectedTool: () => {},
|
|
65
66
|
onShouldDeleteAnno: () => {},
|
|
66
67
|
},
|
|
67
|
-
}
|
|
68
|
+
}
|
|
68
69
|
|
|
69
70
|
const samplePointAnnotations: Annotation[] = [
|
|
70
71
|
new Annotation(0, AnnotationTool.Point, [{ x: 10, y: 10 }]),
|
|
@@ -75,7 +76,7 @@ const samplePointAnnotations: Annotation[] = [
|
|
|
75
76
|
new Annotation(5, AnnotationTool.Point, [{ x: 250, y: 250 }]),
|
|
76
77
|
new Annotation(6, AnnotationTool.Point, [{ x: 300, y: 300 }]),
|
|
77
78
|
new Annotation(7, AnnotationTool.Point, [{ x: 350, y: 350 }]),
|
|
78
|
-
]
|
|
79
|
+
]
|
|
79
80
|
|
|
80
81
|
export const WithPoints: Story = {
|
|
81
82
|
args: {
|
|
@@ -94,10 +95,11 @@ export const WithPoints: Story = {
|
|
|
94
95
|
onAnnoEditing: () => {},
|
|
95
96
|
onRequestNewAnnoId: () => 1,
|
|
96
97
|
onSelectAnnotation: () => {},
|
|
98
|
+
onSetIsImageJunk: () => {},
|
|
97
99
|
onSetSelectedTool: () => {},
|
|
98
100
|
onShouldDeleteAnno: () => {},
|
|
99
101
|
},
|
|
100
|
-
}
|
|
102
|
+
}
|
|
101
103
|
|
|
102
104
|
const sampleLineAnnotations: Annotation[] = [
|
|
103
105
|
new Annotation(0, AnnotationTool.Line, [
|
|
@@ -114,7 +116,7 @@ const sampleLineAnnotations: Annotation[] = [
|
|
|
114
116
|
]),
|
|
115
117
|
new Annotation(2, AnnotationTool.Line, [{ x: 150, y: 150 }]),
|
|
116
118
|
new Annotation(3, AnnotationTool.Line, [{ x: 200, y: 200 }]),
|
|
117
|
-
]
|
|
119
|
+
]
|
|
118
120
|
|
|
119
121
|
export const WithLines: Story = {
|
|
120
122
|
args: {
|
|
@@ -133,10 +135,11 @@ export const WithLines: Story = {
|
|
|
133
135
|
onAnnoEditing: () => {},
|
|
134
136
|
onRequestNewAnnoId: () => 1,
|
|
135
137
|
onSelectAnnotation: () => {},
|
|
138
|
+
onSetIsImageJunk: () => {},
|
|
136
139
|
onSetSelectedTool: () => {},
|
|
137
140
|
onShouldDeleteAnno: () => {},
|
|
138
141
|
},
|
|
139
|
-
}
|
|
142
|
+
}
|
|
140
143
|
|
|
141
144
|
const sampleBBoxAnnotations: Annotation[] = [
|
|
142
145
|
new Annotation(0, AnnotationTool.BBox, [
|
|
@@ -151,7 +154,7 @@ const sampleBBoxAnnotations: Annotation[] = [
|
|
|
151
154
|
{ x: 400, y: 325 },
|
|
152
155
|
{ x: 500, y: 375 },
|
|
153
156
|
]),
|
|
154
|
-
]
|
|
157
|
+
]
|
|
155
158
|
|
|
156
159
|
export const WithBBoxes: Story = {
|
|
157
160
|
args: {
|
|
@@ -170,10 +173,11 @@ export const WithBBoxes: Story = {
|
|
|
170
173
|
onAnnoEditing: () => {},
|
|
171
174
|
onRequestNewAnnoId: () => 1,
|
|
172
175
|
onSelectAnnotation: () => {},
|
|
176
|
+
onSetIsImageJunk: () => {},
|
|
173
177
|
onSetSelectedTool: () => {},
|
|
174
178
|
onShouldDeleteAnno: () => {},
|
|
175
179
|
},
|
|
176
|
-
}
|
|
180
|
+
}
|
|
177
181
|
|
|
178
182
|
const samplePolygonAnnotations: Annotation[] = [
|
|
179
183
|
new Annotation(0, AnnotationTool.Polygon, [
|
|
@@ -189,7 +193,7 @@ const samplePolygonAnnotations: Annotation[] = [
|
|
|
189
193
|
{ x: 600, y: 350 },
|
|
190
194
|
{ x: 550, y: 450 },
|
|
191
195
|
]),
|
|
192
|
-
]
|
|
196
|
+
]
|
|
193
197
|
|
|
194
198
|
export const WithPolygonAnnotations: Story = {
|
|
195
199
|
args: {
|
|
@@ -208,7 +212,8 @@ export const WithPolygonAnnotations: Story = {
|
|
|
208
212
|
onAnnoEditing: () => {},
|
|
209
213
|
onRequestNewAnnoId: () => 1,
|
|
210
214
|
onSelectAnnotation: () => {},
|
|
215
|
+
onSetIsImageJunk: () => {},
|
|
211
216
|
onSetSelectedTool: () => {},
|
|
212
217
|
onShouldDeleteAnno: () => {},
|
|
213
218
|
},
|
|
214
|
-
}
|
|
219
|
+
}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import Annotation from
|
|
2
|
-
import Canvas from
|
|
3
|
-
import AnnotationTool from
|
|
4
|
-
import CanvasAction from
|
|
5
|
-
import type { AnnotationSettings, Label, UiConfig } from
|
|
1
|
+
import Annotation from '../../Annotation/logic/Annotation'
|
|
2
|
+
import Canvas from '../../Canvas/Canvas'
|
|
3
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
4
|
+
import CanvasAction from '../../models/CanvasAction'
|
|
5
|
+
import type { AnnotationSettings, Label, UiConfig } from '../../types'
|
|
6
6
|
|
|
7
7
|
type CanvasProps = {
|
|
8
|
-
annotations?: Annotation[]
|
|
9
|
-
image: string
|
|
10
|
-
selectedAnnoTool: AnnotationTool
|
|
11
|
-
possibleLabels: Label[]
|
|
12
|
-
preventScrolling: boolean
|
|
13
|
-
uiConfig: UiConfig
|
|
14
|
-
onAnnoEvent?: (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onKeyDown?: (e) => void | undefined;
|
|
19
|
-
onKeyUp?: (e) => void | undefined;
|
|
20
|
-
};
|
|
8
|
+
annotations?: Annotation[]
|
|
9
|
+
image: string
|
|
10
|
+
selectedAnnoTool: AnnotationTool
|
|
11
|
+
possibleLabels: Label[]
|
|
12
|
+
preventScrolling: boolean
|
|
13
|
+
uiConfig: UiConfig
|
|
14
|
+
onAnnoEvent?: (annotation: Annotation, canvasAction: CanvasAction) => void | undefined
|
|
15
|
+
onKeyDown?: (e) => void | undefined
|
|
16
|
+
onKeyUp?: (e) => void | undefined
|
|
17
|
+
}
|
|
21
18
|
|
|
22
19
|
const annotationSettings: AnnotationSettings = {
|
|
23
20
|
canHaveMultipleLabels: true,
|
|
24
21
|
canCreate: true,
|
|
25
22
|
canLabel: true,
|
|
26
|
-
}
|
|
23
|
+
}
|
|
27
24
|
|
|
28
25
|
const CanvasWithOffset = ({
|
|
29
26
|
annotations = [],
|
|
@@ -38,10 +35,10 @@ const CanvasWithOffset = ({
|
|
|
38
35
|
<h1>A line to generate offset</h1>
|
|
39
36
|
<div
|
|
40
37
|
style={{
|
|
41
|
-
width:
|
|
42
|
-
height:
|
|
38
|
+
width: '100%',
|
|
39
|
+
height: '100%',
|
|
43
40
|
padding: 200,
|
|
44
|
-
background:
|
|
41
|
+
background: 'green',
|
|
45
42
|
}}
|
|
46
43
|
>
|
|
47
44
|
<Canvas
|
|
@@ -59,12 +56,13 @@ const CanvasWithOffset = ({
|
|
|
59
56
|
onAnnoEditing={() => {}}
|
|
60
57
|
onRequestNewAnnoId={() => 1}
|
|
61
58
|
onSelectAnnotation={() => {}}
|
|
59
|
+
onSetIsImageJunk={() => {}}
|
|
62
60
|
onSetSelectedTool={() => {}}
|
|
63
61
|
onShouldDeleteAnno={() => {}}
|
|
64
62
|
/>
|
|
65
63
|
</div>
|
|
66
64
|
</>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
69
67
|
|
|
70
|
-
export default CanvasWithOffset
|
|
68
|
+
export default CanvasWithOffset
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import type { Label } from
|
|
5
|
-
import { imgBlob } from
|
|
3
|
+
import Sia from '../Sia'
|
|
4
|
+
import type { Label } from '../types'
|
|
5
|
+
import { imgBlob } from './siaDummyData'
|
|
6
6
|
|
|
7
|
-
export const ActionsData = {}
|
|
7
|
+
export const ActionsData = {}
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
|
-
title:
|
|
11
|
-
component:
|
|
10
|
+
title: 'Minimal SIA',
|
|
11
|
+
component: Sia,
|
|
12
12
|
parameters: {
|
|
13
13
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
-
layout:
|
|
14
|
+
layout: 'padding',
|
|
15
15
|
},
|
|
16
|
-
tags: [
|
|
16
|
+
tags: ['!autodocs'],
|
|
17
17
|
excludeStories: /.*Data$/,
|
|
18
18
|
args: {
|
|
19
19
|
...ActionsData,
|
|
@@ -22,33 +22,33 @@ const meta = {
|
|
|
22
22
|
(Story) => (
|
|
23
23
|
<div
|
|
24
24
|
style={{
|
|
25
|
-
width:
|
|
26
|
-
height:
|
|
25
|
+
width: '50vw',
|
|
26
|
+
height: '65vh',
|
|
27
27
|
padding: 10,
|
|
28
|
-
overflow:
|
|
28
|
+
overflow: 'hidden',
|
|
29
29
|
}}
|
|
30
30
|
>
|
|
31
31
|
<Story />
|
|
32
32
|
</div>
|
|
33
33
|
),
|
|
34
34
|
],
|
|
35
|
-
} satisfies Meta<typeof
|
|
35
|
+
} satisfies Meta<typeof Sia>
|
|
36
36
|
|
|
37
|
-
export default meta
|
|
38
|
-
type Story = StoryObj<typeof meta
|
|
37
|
+
export default meta
|
|
38
|
+
type Story = StoryObj<typeof meta>
|
|
39
39
|
|
|
40
40
|
const minimalExampleLabels: Label[] = [
|
|
41
41
|
{
|
|
42
42
|
id: 1,
|
|
43
|
-
name:
|
|
44
|
-
description:
|
|
43
|
+
name: 'Cat',
|
|
44
|
+
description: 'Includes all cats',
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
id: 2,
|
|
48
|
-
name:
|
|
49
|
-
description:
|
|
48
|
+
name: 'Dog',
|
|
49
|
+
description: 'Includes all dogs',
|
|
50
50
|
},
|
|
51
|
-
]
|
|
51
|
+
]
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Minimal SIA example
|
|
@@ -79,11 +79,11 @@ export const Minimal: Story = {
|
|
|
79
79
|
|
|
80
80
|
...
|
|
81
81
|
|
|
82
|
-
<
|
|
82
|
+
<Sia
|
|
83
83
|
image={imageBlob}
|
|
84
84
|
possibleLabels={possibleLabels}
|
|
85
85
|
/>`,
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
|
-
}
|
|
89
|
+
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import Annotation from
|
|
2
|
-
import AnnotationTool from
|
|
1
|
+
import Annotation from '../../Annotation/logic/Annotation'
|
|
2
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import Sia from '../../Sia'
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
AnnotationSettings,
|
|
8
|
-
ExternalAnnotation,
|
|
9
|
-
UiConfig,
|
|
10
|
-
} from "../../types";
|
|
6
|
+
import type { AnnotationSettings, ExternalAnnotation, UiConfig } from '../../types'
|
|
11
7
|
|
|
12
|
-
import { imgBlob } from
|
|
13
|
-
import { possibleLabels } from
|
|
8
|
+
import { imgBlob } from '../siaDummyData'
|
|
9
|
+
import { possibleLabels } from '../siaDummyData2'
|
|
14
10
|
|
|
15
11
|
type DemoWrapperProps = {
|
|
16
|
-
annotations?: ExternalAnnotation[]
|
|
17
|
-
annotationSettings?: AnnotationSettings
|
|
18
|
-
isLoading?: boolean
|
|
19
|
-
}
|
|
12
|
+
annotations?: ExternalAnnotation[]
|
|
13
|
+
annotationSettings?: AnnotationSettings
|
|
14
|
+
isLoading?: boolean
|
|
15
|
+
}
|
|
20
16
|
|
|
21
17
|
const DemoWrapper = ({
|
|
22
18
|
annotations = [],
|
|
@@ -27,10 +23,10 @@ const DemoWrapper = ({
|
|
|
27
23
|
nodeRadius: 4,
|
|
28
24
|
strokeWidth: 4,
|
|
29
25
|
imageCentered: false,
|
|
30
|
-
}
|
|
26
|
+
}
|
|
31
27
|
|
|
32
28
|
return (
|
|
33
|
-
<
|
|
29
|
+
<Sia
|
|
34
30
|
annotationSettings={annotationSettings}
|
|
35
31
|
initialAnnotations={annotations}
|
|
36
32
|
isLoading={isLoading}
|
|
@@ -39,22 +35,22 @@ const DemoWrapper = ({
|
|
|
39
35
|
image={imgBlob}
|
|
40
36
|
defaultAnnotationTool={AnnotationTool.Polygon}
|
|
41
37
|
onAnnoCreated={(anno: Annotation, _: Annotation[]) => {
|
|
42
|
-
console.log(
|
|
38
|
+
console.log('CREATED', anno)
|
|
43
39
|
}}
|
|
44
40
|
onAnnoCreationFinished={(anno: Annotation, _: Annotation[]) => {
|
|
45
|
-
console.log(
|
|
41
|
+
console.log('FINISHED CREATION', anno)
|
|
46
42
|
}}
|
|
47
43
|
onAnnoChanged={(anno: Annotation, _: Annotation[]) => {
|
|
48
|
-
console.log(
|
|
44
|
+
console.log('CHANGED', anno)
|
|
49
45
|
}}
|
|
50
46
|
onAnnoDeleted={(anno: Annotation, annos: Annotation[]) => {
|
|
51
|
-
console.log(
|
|
47
|
+
console.log('DELETED', anno, annos)
|
|
52
48
|
}}
|
|
53
49
|
onImageLabelsChanged={(imageLabelIds: number[]) => {
|
|
54
|
-
console.log(
|
|
50
|
+
console.log('IMAGE LABEL IDS CHANGED', imageLabelIds)
|
|
55
51
|
}}
|
|
56
52
|
/>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
59
55
|
|
|
60
|
-
export default DemoWrapper
|
|
56
|
+
export default DemoWrapper
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import Sia from '../../Sia'
|
|
4
4
|
|
|
5
|
-
import { Label, UiConfig } from
|
|
5
|
+
import { Label, UiConfig } from '../../types'
|
|
6
6
|
|
|
7
|
-
import { imgBlob, possibleLabels } from
|
|
7
|
+
import { imgBlob, possibleLabels } from '../siaDummyData'
|
|
8
8
|
|
|
9
|
-
export const ActionsData = {}
|
|
9
|
+
export const ActionsData = {}
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
12
|
-
title:
|
|
13
|
-
component:
|
|
12
|
+
title: 'Components/Sia2',
|
|
13
|
+
component: Sia,
|
|
14
14
|
parameters: {
|
|
15
15
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
16
|
-
layout:
|
|
16
|
+
layout: 'padding',
|
|
17
17
|
},
|
|
18
|
-
tags: [
|
|
18
|
+
tags: ['!autodocs'],
|
|
19
19
|
excludeStories: /.*Data$/,
|
|
20
20
|
args: {
|
|
21
21
|
...ActionsData,
|
|
22
22
|
},
|
|
23
23
|
decorators: [
|
|
24
24
|
(Story) => (
|
|
25
|
-
<div style={{ width:
|
|
25
|
+
<div style={{ width: '50vw', height: '65vh' }}>
|
|
26
26
|
<Story />
|
|
27
27
|
</div>
|
|
28
28
|
),
|
|
29
29
|
],
|
|
30
|
-
} satisfies Meta<typeof
|
|
30
|
+
} satisfies Meta<typeof Sia>
|
|
31
31
|
|
|
32
|
-
export default meta
|
|
33
|
-
type Story = StoryObj<typeof meta
|
|
32
|
+
export default meta
|
|
33
|
+
type Story = StoryObj<typeof meta>
|
|
34
34
|
|
|
35
35
|
const uiConfig: UiConfig = {
|
|
36
36
|
nodeRadius: 4,
|
|
37
37
|
strokeWidth: 4,
|
|
38
38
|
imageCentered: false,
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* SIA with dummy data
|
|
@@ -48,20 +48,20 @@ export const Default: Story = {
|
|
|
48
48
|
image: imgBlob,
|
|
49
49
|
possibleLabels,
|
|
50
50
|
},
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
|
|
53
53
|
const minimalExampleLabels: Label[] = [
|
|
54
54
|
{
|
|
55
55
|
id: 1,
|
|
56
|
-
name:
|
|
57
|
-
description:
|
|
56
|
+
name: 'Cat',
|
|
57
|
+
description: 'Includes all cats',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
id: 2,
|
|
61
|
-
name:
|
|
62
|
-
description:
|
|
61
|
+
name: 'Dog',
|
|
62
|
+
description: 'Includes all dogs',
|
|
63
63
|
},
|
|
64
|
-
]
|
|
64
|
+
]
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Minimal SIA example
|
|
@@ -92,14 +92,14 @@ export const Minimal: Story = {
|
|
|
92
92
|
|
|
93
93
|
...
|
|
94
94
|
|
|
95
|
-
<
|
|
95
|
+
<Sia
|
|
96
96
|
image={imageBlob}
|
|
97
97
|
possibleLabels={possibleLabels}
|
|
98
98
|
/>`,
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
|
|
104
104
|
export const Loading: Story = {
|
|
105
105
|
args: {
|
|
@@ -109,7 +109,7 @@ export const Loading: Story = {
|
|
|
109
109
|
image: imgBlob,
|
|
110
110
|
possibleLabels: [],
|
|
111
111
|
},
|
|
112
|
-
}
|
|
112
|
+
}
|
|
113
113
|
|
|
114
114
|
export const Junk: Story = {
|
|
115
115
|
args: {
|
|
@@ -119,4 +119,4 @@ export const Junk: Story = {
|
|
|
119
119
|
image: imgBlob,
|
|
120
120
|
possibleLabels: [],
|
|
121
121
|
},
|
|
122
|
-
}
|
|
122
|
+
}
|
package/src/utils/KeyMapper.ts
CHANGED
|
@@ -52,6 +52,9 @@ class KeyMapper {
|
|
|
52
52
|
case "e":
|
|
53
53
|
this.triggerKeyAction(KeyAction.RECREATE_ANNO);
|
|
54
54
|
break;
|
|
55
|
+
case "j":
|
|
56
|
+
this.triggerKeyAction(KeyAction.TOGGLE_IMAGE_JUNK);
|
|
57
|
+
break;
|
|
55
58
|
case "c":
|
|
56
59
|
if (isCtrlKeyPressed) this.triggerKeyAction(KeyAction.COPY_ANNOTATION);
|
|
57
60
|
else this.triggerKeyAction(KeyAction.TOGGLE_ANNO_COMMENT_INPUT);
|
package/src/utils/siaIcons.jsx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
1
|
export function textIcon() {
|
|
4
2
|
return (
|
|
5
3
|
<svg
|
|
@@ -32,7 +30,7 @@ export function textIcon() {
|
|
|
32
30
|
C948.049,214.236,926.687,199.643,925.876,172.939z"
|
|
33
31
|
/>
|
|
34
32
|
</svg>
|
|
35
|
-
)
|
|
33
|
+
)
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
export function lineIcon() {
|
|
@@ -58,7 +56,7 @@ export function lineIcon() {
|
|
|
58
56
|
c31.188,24.081,91.974-3.708,123.127-39.312C782.35,323.912,979.191,120.251,986.331,109.582z"
|
|
59
57
|
/>
|
|
60
58
|
</svg>
|
|
61
|
-
)
|
|
59
|
+
)
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
export function bBoxIcon() {
|
|
@@ -84,7 +82,7 @@ export function bBoxIcon() {
|
|
|
84
82
|
h608.264c23.386,0,42.52,19.134,42.52,42.52V710.655z"
|
|
85
83
|
/>
|
|
86
84
|
</svg>
|
|
87
|
-
)
|
|
85
|
+
)
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
export function polygonIcon() {
|
|
@@ -111,7 +109,7 @@ export function polygonIcon() {
|
|
|
111
109
|
c18.31,14.549,14.16,26.901-9.219,27.449L342.327,769.938z"
|
|
112
110
|
/>
|
|
113
111
|
</svg>
|
|
114
|
-
)
|
|
112
|
+
)
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
export function pointIcon() {
|
|
@@ -130,5 +128,5 @@ export function pointIcon() {
|
|
|
130
128
|
c0-151.356,122.7-274.057,274.057-274.057C625.497,134.229,748.197,256.929,748.197,408.286z"
|
|
131
129
|
/>
|
|
132
130
|
</svg>
|
|
133
|
-
)
|
|
131
|
+
)
|
|
134
132
|
}
|