lost-sia 2.0.1-alpha13 → 2.0.1-alpha14
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/AnnotationComponent.js +1 -1
- package/dist/Annotation/ui/atoms/DaviIcon.d.ts +1 -1
- package/dist/Canvas/Canvas.js +1 -1
- package/dist/IconButton.d.ts +25 -0
- package/dist/IconButton.js +1 -0
- package/dist/Sia.js +1 -1
- package/dist/Toolbar/ToolbarItems/AccessibilityTools.js +1 -1
- package/dist/Toolbar/ToolbarItems/AnnoToolSelector.js +1 -1
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.js +1 -1
- package/dist/Toolbar/ToolbarItems/ImageTools.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/models/index.d.ts +1 -1
- package/package.json +3 -2
- package/src/AnnoExampleViewer.jsx +18 -18
- package/src/Annotation/logic/Annotation.ts +24 -24
- package/src/Annotation/ui/AnnotationComponent.tsx +89 -96
- package/src/Annotation/ui/atoms/DaviIcon.tsx +12 -22
- package/src/Annotation/ui/atoms/PolygonArea.tsx +35 -35
- package/src/Annotation/ui/tools/Point.tsx +17 -17
- package/src/Canvas/Canvas.tsx +36 -13
- package/src/Canvas/LabelInput.tsx +27 -34
- 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/LabelInfo.jsx +30 -30
- package/src/SIASettingButton.jsx +25 -25
- package/src/Sia.tsx +29 -12
- package/src/Toolbar/Toolbar.tsx +25 -25
- package/src/Toolbar/ToolbarItems/AccessibilityTools.tsx +23 -43
- package/src/Toolbar/ToolbarItems/AnnoToolSelector.tsx +53 -43
- package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.tsx +71 -71
- package/src/Toolbar/ToolbarItems/ImageToolItems/TagLabel.tsx +24 -24
- package/src/Toolbar/ToolbarItems/ImageTools.tsx +28 -30
- package/src/Toolbar/ToolbarItems/Instructions.tsx +47 -50
- package/src/Toolbar/ToolbarItems/InstructionsModal.tsx +8 -8
- package/src/index.ts +1 -0
- package/src/models/AnnotationMode.ts +1 -1
- package/src/models/AnnotationStatus.ts +1 -1
- package/src/models/AnnotationTool.ts +1 -1
- package/src/models/CanvasAction.ts +1 -1
- package/src/models/Direction.ts +1 -1
- package/src/models/EditorModes.ts +1 -1
- package/src/models/KeyAction.ts +1 -1
- package/src/models/NotificationType.ts +1 -1
- package/src/models/index.ts +6 -12
- package/src/siaDummyData.js +71 -71
- package/src/stories/Button.jsx +11 -15
- package/src/stories/Button.stories.js +17 -17
- package/src/stories/Canvas/CanvasWithOffset.stories.tsx +25 -25
- package/src/stories/FilterDropdown.stories.ts +10 -10
- package/src/stories/Header.jsx +8 -13
- package/src/stories/Header.stories.js +9 -9
- package/src/stories/Page.jsx +21 -26
- package/src/stories/Page.stories.js +14 -14
- package/src/stories/SIA2/DemoWrapper.stories.tsx +22 -22
- package/src/stories/Toolbar/ImageTools/TagLabel.stories.tsx +11 -11
- package/src/stories/Toolbar/Instructions.stories.tsx +11 -11
- package/src/stories/Toolbar/Toolbar.stories.tsx +20 -20
- package/src/stories/siaDummyData.js +71 -71
- package/src/stories/siaDummyData2.ts +72 -72
- package/src/types.ts +47 -47
- package/src/utils/KeyMapper.ts +56 -61
- package/src/utils/TimeUtils.ts +7 -10
- package/src/utils/color.ts +25 -25
- package/src/utils/hist.js +22 -22
- package/src/utils/index.ts +3 -3
- package/src/utils/keyActions.js +81 -81
- package/src/utils/mouse.ts +9 -9
- package/src/utils/transform.ts +66 -72
- package/src/utils/uiConfig.js +19 -22
- package/src/utils/windowViewport.ts +10 -10
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import InfoBox from
|
|
3
|
-
import SiaPopup from
|
|
4
|
-
import AnnoExampleViewer from
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import InfoBox from './InfoBox'
|
|
3
|
+
import SiaPopup from '../SiaPopup'
|
|
4
|
+
import AnnoExampleViewer from '../AnnoExampleViewer'
|
|
5
5
|
const LabelInfo = (props) => {
|
|
6
|
-
const [showExampleViewer, setShowExampleViewer] = useState(false)
|
|
7
|
-
const [myLbl, setMyLbl] = useState(undefined)
|
|
6
|
+
const [showExampleViewer, setShowExampleViewer] = useState(false)
|
|
7
|
+
const [myLbl, setMyLbl] = useState(undefined)
|
|
8
8
|
// const { data: exampleImg, mutate: getAnnoExample } = exampleApi.useGetAnnoExampleImg({})
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
if (props.selectedAnno) {
|
|
11
|
-
const selectedLabelIds = props.selectedAnno.labelIds
|
|
11
|
+
const selectedLabelIds = props.selectedAnno.labelIds
|
|
12
12
|
if (selectedLabelIds) {
|
|
13
13
|
const lbl = props.possibleLabels.find((e) => {
|
|
14
|
-
return selectedLabelIds[0] === e.id
|
|
15
|
-
})
|
|
14
|
+
return selectedLabelIds[0] === e.id
|
|
15
|
+
})
|
|
16
16
|
if (lbl) {
|
|
17
17
|
if (lbl !== myLbl) {
|
|
18
|
-
setMyLbl(lbl)
|
|
18
|
+
setMyLbl(lbl)
|
|
19
19
|
if (props.visible)
|
|
20
20
|
// getAnnoExample({llId:lbl.id, type:'annoBased', drawAnno: true, addContext:0.05})
|
|
21
|
-
requestImg(lbl, props.selectedAnno)
|
|
21
|
+
requestImg(lbl, props.selectedAnno)
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
}, [props.selectedAnno])
|
|
26
|
+
}, [props.selectedAnno])
|
|
27
27
|
const onDismiss = () => {
|
|
28
28
|
if (props.onDismiss) {
|
|
29
|
-
props.onDismiss()
|
|
29
|
+
props.onDismiss()
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
const requestImg = (lbl, anno) => {
|
|
34
34
|
if (props.onGetAnnoExample) {
|
|
35
|
-
props.onGetAnnoExample({ lbl: lbl, anno: anno })
|
|
35
|
+
props.onGetAnnoExample({ lbl: lbl, anno: anno })
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
|
|
39
39
|
const handleImgClick = () => {
|
|
40
40
|
// setShowExampleViewer(true)
|
|
41
41
|
// requestImg(myLbl, props.selectedAnno)
|
|
42
42
|
|
|
43
|
-
setShowExampleViewer(true)
|
|
43
|
+
setShowExampleViewer(true)
|
|
44
44
|
// getAnnoExample({llId:myLbl.id, type:'annoBased', drawAnno: true, addContext:0.05})
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
const renderExampleImg = () => {
|
|
48
|
-
if (!props.exampleImg) return null
|
|
48
|
+
if (!props.exampleImg) return null
|
|
49
49
|
return (
|
|
50
50
|
<div>
|
|
51
51
|
<h4 onClick={() => handleImgClick()}>Example:</h4>
|
|
@@ -54,14 +54,14 @@ const LabelInfo = (props) => {
|
|
|
54
54
|
<img
|
|
55
55
|
src={props.exampleImg.img}
|
|
56
56
|
onClick={() => handleImgClick()}
|
|
57
|
-
style={{ borderRadius: 25, width:
|
|
57
|
+
style={{ borderRadius: 25, width: '100%' }}
|
|
58
58
|
/>
|
|
59
59
|
}
|
|
60
|
-
content={
|
|
60
|
+
content={'Click on image to view more examples'}
|
|
61
61
|
/>
|
|
62
62
|
</div>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
65
|
|
|
66
66
|
const renderDescription = () => {
|
|
67
67
|
// if (props.selectedAnno){
|
|
@@ -71,7 +71,7 @@ const LabelInfo = (props) => {
|
|
|
71
71
|
// const lbl = props.possibleLabels.find( e => {
|
|
72
72
|
// return selectedLabelIds[0] === e.id
|
|
73
73
|
// })
|
|
74
|
-
if (!myLbl) return
|
|
74
|
+
if (!myLbl) return 'No Label'
|
|
75
75
|
return (
|
|
76
76
|
<div>
|
|
77
77
|
<h4>{myLbl.label}</h4>
|
|
@@ -80,18 +80,18 @@ const LabelInfo = (props) => {
|
|
|
80
80
|
<AnnoExampleViewer
|
|
81
81
|
onRequestExample={() => requestImg(myLbl, props.selectedAnno)}
|
|
82
82
|
onClose={() => {
|
|
83
|
-
setShowExampleViewer(false)
|
|
83
|
+
setShowExampleViewer(false)
|
|
84
84
|
}}
|
|
85
85
|
active={showExampleViewer}
|
|
86
86
|
lbl={myLbl}
|
|
87
87
|
exampleImg={props.exampleImg}
|
|
88
88
|
/>
|
|
89
89
|
</div>
|
|
90
|
-
)
|
|
90
|
+
)
|
|
91
91
|
// } else {
|
|
92
92
|
// return 'No Label'
|
|
93
93
|
// }
|
|
94
|
-
}
|
|
94
|
+
}
|
|
95
95
|
|
|
96
96
|
return (
|
|
97
97
|
<InfoBox
|
|
@@ -101,7 +101,7 @@ const LabelInfo = (props) => {
|
|
|
101
101
|
defaultPos={props.defaultPos}
|
|
102
102
|
onDismiss={() => onDismiss()}
|
|
103
103
|
/>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
106
|
|
|
107
|
-
export default LabelInfo
|
|
107
|
+
export default LabelInfo
|
package/src/SIASettingButton.jsx
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import React, { Component } from
|
|
1
|
+
import React, { Component } from 'react'
|
|
2
2
|
|
|
3
|
-
import * as tbe from
|
|
4
|
-
import { faCog } from
|
|
5
|
-
import { CFormSwitch, CPopover } from
|
|
6
|
-
import ToolbarItem from
|
|
3
|
+
import * as tbe from './types/toolbarEvents'
|
|
4
|
+
import { faCog } from '@fortawesome/free-solid-svg-icons'
|
|
5
|
+
import { CFormSwitch, CPopover } from '@coreui/react'
|
|
6
|
+
import ToolbarItem from './ToolbarItem'
|
|
7
7
|
class SIASettingButton extends Component {
|
|
8
8
|
constructor(props) {
|
|
9
|
-
super(props)
|
|
10
|
-
this.state = {}
|
|
9
|
+
super(props)
|
|
10
|
+
this.state = {}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
triggerEvent(e, data) {
|
|
14
14
|
if (this.props.onSettingEvent) {
|
|
15
|
-
this.props.onSettingEvent(e, data)
|
|
15
|
+
this.props.onSettingEvent(e, data)
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
toggleAnnoDetails() {
|
|
19
|
-
this.triggerEvent(tbe.SHOW_ANNO_DETAILS)
|
|
19
|
+
this.triggerEvent(tbe.SHOW_ANNO_DETAILS)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
toggleLabelInfo() {
|
|
23
|
-
this.triggerEvent(tbe.SHOW_LABEL_INFO)
|
|
23
|
+
this.triggerEvent(tbe.SHOW_LABEL_INFO)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
toggleAnnoStats() {
|
|
27
|
-
this.triggerEvent(tbe.SHOW_ANNO_STATS)
|
|
27
|
+
this.triggerEvent(tbe.SHOW_ANNO_STATS)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
handleStrokeWidthChange(e) {
|
|
31
|
-
this.triggerEvent(tbe.EDIT_STROKE_WIDTH, parseInt(e.target.value))
|
|
31
|
+
this.triggerEvent(tbe.EDIT_STROKE_WIDTH, parseInt(e.target.value))
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
handleNodeRadiusChange(e) {
|
|
35
|
-
this.triggerEvent(tbe.EDIT_NODE_RADIUS, parseInt(e.target.value))
|
|
35
|
+
this.triggerEvent(tbe.EDIT_NODE_RADIUS, parseInt(e.target.value))
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
renderInfoBoxContent() {
|
|
@@ -58,26 +58,26 @@ class SIASettingButton extends Component {
|
|
|
58
58
|
onClick={() => this.toggleAnnoStats()}
|
|
59
59
|
/>
|
|
60
60
|
</div>
|
|
61
|
-
)
|
|
61
|
+
)
|
|
62
62
|
}
|
|
63
63
|
renderInfoBoxes() {
|
|
64
|
-
if (!this.props.enabled) return null
|
|
64
|
+
if (!this.props.enabled) return null
|
|
65
65
|
if (this.props.enabled === true) {
|
|
66
|
-
return this.renderInfoBoxContent()
|
|
66
|
+
return this.renderInfoBoxContent()
|
|
67
67
|
} else {
|
|
68
68
|
if (this.props.enabled.infoBoxes) {
|
|
69
|
-
return this.renderInfoBoxContent()
|
|
69
|
+
return this.renderInfoBoxContent()
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
renderAnnoStyle() {
|
|
75
|
-
if (!this.props.enabled) return null
|
|
75
|
+
if (!this.props.enabled) return null
|
|
76
76
|
if (this.props.enabled === true) {
|
|
77
|
-
return this.renderAnnoStyleContent()
|
|
77
|
+
return this.renderAnnoStyleContent()
|
|
78
78
|
} else {
|
|
79
79
|
if (this.props.enabled.annoStyle) {
|
|
80
|
-
return this.renderAnnoStyleContent()
|
|
80
|
+
return this.renderAnnoStyleContent()
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -102,25 +102,25 @@ class SIASettingButton extends Component {
|
|
|
102
102
|
onChange={(e) => this.handleNodeRadiusChange(e)}
|
|
103
103
|
/>
|
|
104
104
|
</div>
|
|
105
|
-
)
|
|
105
|
+
)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
render() {
|
|
109
|
-
if (!this.props.uiConfig) return null
|
|
109
|
+
if (!this.props.uiConfig) return null
|
|
110
110
|
const popupContent = (
|
|
111
111
|
<div>
|
|
112
112
|
{this.renderInfoBoxes()}
|
|
113
113
|
{this.renderAnnoStyle()}
|
|
114
114
|
</div>
|
|
115
|
-
)
|
|
115
|
+
)
|
|
116
116
|
return (
|
|
117
117
|
<CPopover content={popupContent} placement="right">
|
|
118
118
|
<span>
|
|
119
119
|
<ToolbarItem faIcon={faCog} />
|
|
120
120
|
</span>
|
|
121
121
|
</CPopover>
|
|
122
|
-
)
|
|
122
|
+
)
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export default SIASettingButton
|
|
126
|
+
export default SIASettingButton
|
package/src/Sia.tsx
CHANGED
|
@@ -114,6 +114,7 @@ const Sia2 = ({
|
|
|
114
114
|
const removedAnno: Annotation = _annotations.splice(annoListIndex, 1)[0]
|
|
115
115
|
|
|
116
116
|
setAnnotations(_annotations)
|
|
117
|
+
setSelectedAnnotation(undefined)
|
|
117
118
|
|
|
118
119
|
// inform the outside world about our changes
|
|
119
120
|
onAnnoDeleted(removedAnno, _annotations)
|
|
@@ -167,6 +168,33 @@ const Sia2 = ({
|
|
|
167
168
|
return newInternalId
|
|
168
169
|
}
|
|
169
170
|
|
|
171
|
+
const handleAnnoEditing = (annotation: Annotation) => {
|
|
172
|
+
const _annotations: Annotation[] = [...annotations]
|
|
173
|
+
|
|
174
|
+
// annotation is being edited - remove it from current annotations for this time
|
|
175
|
+
const selectedAnnotationIndex: number = _annotations.findIndex(
|
|
176
|
+
(annotation: Annotation) =>
|
|
177
|
+
annotation.internalId === selectedAnnotation?.internalId,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
if (selectedAnnotationIndex === -1) return
|
|
181
|
+
|
|
182
|
+
// remove the old anno
|
|
183
|
+
const removedAnno: Annotation = _annotations.splice(selectedAnnotationIndex, 1)[0]
|
|
184
|
+
|
|
185
|
+
// do deletion state update without the new anno!
|
|
186
|
+
onAnnoDeleted(removedAnno, _annotations)
|
|
187
|
+
|
|
188
|
+
// add the new anno
|
|
189
|
+
const newAnnoations: Annotation[] = [..._annotations]
|
|
190
|
+
newAnnoations.push(annotation)
|
|
191
|
+
|
|
192
|
+
// update the list
|
|
193
|
+
setAnnotations(newAnnoations)
|
|
194
|
+
|
|
195
|
+
setSelectedAnnotation(annotation)
|
|
196
|
+
}
|
|
197
|
+
|
|
170
198
|
const handleImageJunk = (newJunkState: boolean) => {
|
|
171
199
|
setIsImageJunk(newJunkState)
|
|
172
200
|
onIsImageJunk(newJunkState)
|
|
@@ -409,18 +437,7 @@ const Sia2 = ({
|
|
|
409
437
|
// inform the outer world about our changes
|
|
410
438
|
onAnnoCreationFinished(changedAnno, _annotations)
|
|
411
439
|
}}
|
|
412
|
-
onAnnoEditing={
|
|
413
|
-
const _annotations: Annotation[] = [...annotations]
|
|
414
|
-
|
|
415
|
-
const selectedAnnotationId: number = _annotations.findIndex(
|
|
416
|
-
(annotation: Annotation) =>
|
|
417
|
-
annotation.internalId === selectedAnnotation?.internalId,
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
_annotations[selectedAnnotationId] = annotation
|
|
421
|
-
|
|
422
|
-
setAnnotations(_annotations)
|
|
423
|
-
}}
|
|
440
|
+
onAnnoEditing={handleAnnoEditing}
|
|
424
441
|
onSetIsImageJunk={handleImageJunk}
|
|
425
442
|
onNotification={onNotification}
|
|
426
443
|
onRequestNewAnnoId={createNewInternalAnnotationId}
|
package/src/Toolbar/Toolbar.tsx
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { CCol, CRow } from
|
|
1
|
+
import { CCol, CRow } from '@coreui/react'
|
|
2
2
|
|
|
3
|
-
import AnnoToolSelector from
|
|
4
|
-
import ImageTools from
|
|
5
|
-
import AnnotationTool from
|
|
6
|
-
import AccessibilityTools from
|
|
7
|
-
import { ReactElement } from
|
|
8
|
-
import { AllowedTools, AnnotationSettings, Label } from
|
|
3
|
+
import AnnoToolSelector from './ToolbarItems/AnnoToolSelector'
|
|
4
|
+
import ImageTools from './ToolbarItems/ImageTools'
|
|
5
|
+
import AnnotationTool from '../models/AnnotationTool'
|
|
6
|
+
import AccessibilityTools from './ToolbarItems/AccessibilityTools'
|
|
7
|
+
import { ReactElement } from 'react'
|
|
8
|
+
import { AllowedTools, AnnotationSettings, Label } from '../types'
|
|
9
9
|
|
|
10
10
|
type ToolbarProps = {
|
|
11
|
-
annotationSettings: AnnotationSettings
|
|
12
|
-
allowedTools: AllowedTools
|
|
13
|
-
additionalButtons?: ReactElement | undefined
|
|
14
|
-
isImageJunk?: boolean
|
|
15
|
-
imageLabelIds?: number[]
|
|
16
|
-
isDisabled?: boolean
|
|
17
|
-
isFullscreen?: boolean
|
|
18
|
-
possibleLabels: Label[]
|
|
19
|
-
selectedTool: AnnotationTool
|
|
20
|
-
onImageLabelsChanged?: (selectedImageIds: number[]) => void
|
|
21
|
-
onSetIsFullscreen?: (isFullscreen: boolean) => void
|
|
22
|
-
onSetIsImageJunk?: (isImageJunk: boolean) => void
|
|
23
|
-
onSetSelectedTool?: (selectedTool: AnnotationTool) => void
|
|
24
|
-
onShouldDeleteSelectedAnnotation?: () => void
|
|
25
|
-
}
|
|
11
|
+
annotationSettings: AnnotationSettings
|
|
12
|
+
allowedTools: AllowedTools
|
|
13
|
+
additionalButtons?: ReactElement | undefined
|
|
14
|
+
isImageJunk?: boolean
|
|
15
|
+
imageLabelIds?: number[]
|
|
16
|
+
isDisabled?: boolean
|
|
17
|
+
isFullscreen?: boolean
|
|
18
|
+
possibleLabels: Label[]
|
|
19
|
+
selectedTool: AnnotationTool
|
|
20
|
+
onImageLabelsChanged?: (selectedImageIds: number[]) => void
|
|
21
|
+
onSetIsFullscreen?: (isFullscreen: boolean) => void
|
|
22
|
+
onSetIsImageJunk?: (isImageJunk: boolean) => void
|
|
23
|
+
onSetSelectedTool?: (selectedTool: AnnotationTool) => void
|
|
24
|
+
onShouldDeleteSelectedAnnotation?: () => void
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
const Toolbar = ({
|
|
28
28
|
annotationSettings,
|
|
@@ -77,7 +77,7 @@ const Toolbar = ({
|
|
|
77
77
|
|
|
78
78
|
{additionalButtons && additionalButtons}
|
|
79
79
|
</CRow>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
82
|
|
|
83
|
-
export default Toolbar
|
|
83
|
+
export default Toolbar
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { faMaximize, faQuestion } from
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import InstructionsModal from "./InstructionsModal";
|
|
1
|
+
import { CButtonGroup } from '@coreui/react'
|
|
2
|
+
import { faMaximize, faQuestion } from '@fortawesome/free-solid-svg-icons'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import InstructionsModal from './InstructionsModal'
|
|
5
|
+
import IconButton from '../../IconButton'
|
|
7
6
|
|
|
8
7
|
type AccessibilityToolsProps = {
|
|
9
|
-
isDisabled?: boolean
|
|
10
|
-
isFullscreen?: boolean
|
|
11
|
-
onSetIsFullscreen?: (isFullscreen: boolean) => void
|
|
12
|
-
}
|
|
8
|
+
isDisabled?: boolean
|
|
9
|
+
isFullscreen?: boolean
|
|
10
|
+
onSetIsFullscreen?: (isFullscreen: boolean) => void
|
|
11
|
+
}
|
|
13
12
|
|
|
14
13
|
const AccessibilityTools = ({
|
|
15
14
|
isDisabled = false,
|
|
@@ -17,53 +16,34 @@ const AccessibilityTools = ({
|
|
|
17
16
|
onSetIsFullscreen = () => {},
|
|
18
17
|
}: AccessibilityToolsProps) => {
|
|
19
18
|
const [isInstructionsModalVisible, setIsInstructionsModalVisible] =
|
|
20
|
-
useState<boolean>(false)
|
|
19
|
+
useState<boolean>(false)
|
|
21
20
|
|
|
22
21
|
return (
|
|
23
22
|
<CButtonGroup role="group" aria-label="Basic example">
|
|
24
|
-
|
|
23
|
+
<IconButton
|
|
25
24
|
color="primary"
|
|
25
|
+
icon={faMaximize}
|
|
26
|
+
isOutline={!isFullscreen}
|
|
26
27
|
disabled={isDisabled}
|
|
27
|
-
variant="outline"
|
|
28
|
-
onClick={() => {}}
|
|
29
|
-
>
|
|
30
|
-
<FontAwesomeIcon icon={faFilter as IconProp} size="lg" />
|
|
31
|
-
</CButton> */}
|
|
32
|
-
|
|
33
|
-
<CButton
|
|
34
|
-
color="primary"
|
|
35
|
-
disabled={isDisabled}
|
|
36
|
-
variant={isFullscreen ? undefined : "outline"}
|
|
37
28
|
onClick={() => onSetIsFullscreen(!isFullscreen)}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</CButton>
|
|
41
|
-
|
|
42
|
-
{/*
|
|
43
|
-
<CButton
|
|
44
|
-
color="primary"
|
|
45
|
-
disabled={isDisabled}
|
|
46
|
-
variant="outline"
|
|
47
|
-
onClick={() => {}}
|
|
48
|
-
>
|
|
49
|
-
<FontAwesomeIcon icon={faCog as IconProp} size="lg" />
|
|
50
|
-
</CButton> */}
|
|
29
|
+
tooltip="Toggle fullscreen"
|
|
30
|
+
/>
|
|
51
31
|
|
|
52
|
-
<
|
|
32
|
+
<IconButton
|
|
53
33
|
color="primary"
|
|
34
|
+
icon={faQuestion}
|
|
35
|
+
isOutline={true}
|
|
54
36
|
disabled={isDisabled}
|
|
55
|
-
variant="outline"
|
|
56
37
|
onClick={() => setIsInstructionsModalVisible(true)}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</CButton>
|
|
38
|
+
tooltip="Open instructions"
|
|
39
|
+
/>
|
|
60
40
|
|
|
61
41
|
<InstructionsModal
|
|
62
42
|
isOpen={isInstructionsModalVisible}
|
|
63
43
|
setIsOpen={setIsInstructionsModalVisible}
|
|
64
44
|
/>
|
|
65
45
|
</CButtonGroup>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
68
48
|
|
|
69
|
-
export default AccessibilityTools
|
|
49
|
+
export default AccessibilityTools
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as siaIcons from
|
|
1
|
+
import { CButtonGroup } from '@coreui/react'
|
|
2
|
+
import * as siaIcons from '../../utils/siaIcons'
|
|
3
3
|
|
|
4
|
-
import AnnotationTool from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { AllowedTools } from "../../types";
|
|
4
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
5
|
+
import { faTrash } from '@fortawesome/free-solid-svg-icons'
|
|
6
|
+
import { AllowedTools } from '../../types'
|
|
7
|
+
import IconButton from '../../IconButton'
|
|
9
8
|
|
|
10
9
|
type AnnoToolSelectorProps = {
|
|
11
|
-
allowedTools: AllowedTools
|
|
12
|
-
isDisabled?: boolean
|
|
13
|
-
selectedTool: AnnotationTool
|
|
14
|
-
onSetSelectedTool: (selectedTool: AnnotationTool) => void
|
|
15
|
-
onShouldDeleteSelectedAnnotation?: () => void
|
|
16
|
-
}
|
|
10
|
+
allowedTools: AllowedTools
|
|
11
|
+
isDisabled?: boolean
|
|
12
|
+
selectedTool: AnnotationTool
|
|
13
|
+
onSetSelectedTool: (selectedTool: AnnotationTool) => void
|
|
14
|
+
onShouldDeleteSelectedAnnotation?: () => void
|
|
15
|
+
}
|
|
17
16
|
|
|
18
17
|
const AnnoToolSelector = ({
|
|
19
18
|
allowedTools,
|
|
@@ -25,61 +24,72 @@ const AnnoToolSelector = ({
|
|
|
25
24
|
return (
|
|
26
25
|
<CButtonGroup role="group" aria-label="Basic example">
|
|
27
26
|
{allowedTools.point && (
|
|
28
|
-
<CButton
|
|
27
|
+
// <CButton
|
|
28
|
+
// color="primary"
|
|
29
|
+
// disabled={isDisabled}
|
|
30
|
+
// variant={selectedTool == AnnotationTool.Point ? undefined : 'outline'}
|
|
31
|
+
// onClick={() => onSetSelectedTool(AnnotationTool.Point)}
|
|
32
|
+
// >
|
|
33
|
+
// {siaIcons.pointIcon()}
|
|
34
|
+
// </CButton>
|
|
35
|
+
<IconButton
|
|
29
36
|
color="primary"
|
|
37
|
+
text={siaIcons.pointIcon()}
|
|
38
|
+
isOutline={selectedTool != AnnotationTool.Point}
|
|
30
39
|
disabled={isDisabled}
|
|
31
|
-
variant={selectedTool == AnnotationTool.Point ? undefined : "outline"}
|
|
32
40
|
onClick={() => onSetSelectedTool(AnnotationTool.Point)}
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
41
|
+
tooltip="Create Point Annotation"
|
|
42
|
+
margin={0}
|
|
43
|
+
/>
|
|
36
44
|
)}
|
|
37
45
|
|
|
38
46
|
{allowedTools.line && (
|
|
39
|
-
<
|
|
47
|
+
<IconButton
|
|
40
48
|
color="primary"
|
|
49
|
+
text={siaIcons.lineIcon()}
|
|
50
|
+
isOutline={selectedTool != AnnotationTool.Line}
|
|
41
51
|
disabled={isDisabled}
|
|
42
|
-
variant={selectedTool == AnnotationTool.Line ? undefined : "outline"}
|
|
43
52
|
onClick={() => onSetSelectedTool(AnnotationTool.Line)}
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
53
|
+
tooltip="Create Line Annotation"
|
|
54
|
+
margin={0}
|
|
55
|
+
/>
|
|
47
56
|
)}
|
|
48
57
|
|
|
49
58
|
{allowedTools.bbox && (
|
|
50
|
-
<
|
|
59
|
+
<IconButton
|
|
51
60
|
color="primary"
|
|
61
|
+
text={siaIcons.bBoxIcon()}
|
|
62
|
+
isOutline={selectedTool != AnnotationTool.BBox}
|
|
52
63
|
disabled={isDisabled}
|
|
53
|
-
variant={selectedTool == AnnotationTool.BBox ? undefined : "outline"}
|
|
54
64
|
onClick={() => onSetSelectedTool(AnnotationTool.BBox)}
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
65
|
+
tooltip="Create BBox Annotation"
|
|
66
|
+
margin={0}
|
|
67
|
+
/>
|
|
58
68
|
)}
|
|
59
69
|
|
|
60
70
|
{allowedTools.polygon && (
|
|
61
|
-
<
|
|
71
|
+
<IconButton
|
|
62
72
|
color="primary"
|
|
73
|
+
text={siaIcons.polygonIcon()}
|
|
74
|
+
isOutline={selectedTool != AnnotationTool.Polygon}
|
|
63
75
|
disabled={isDisabled}
|
|
64
|
-
variant={
|
|
65
|
-
selectedTool == AnnotationTool.Polygon ? undefined : "outline"
|
|
66
|
-
}
|
|
67
76
|
onClick={() => onSetSelectedTool(AnnotationTool.Polygon)}
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
|
|
77
|
+
tooltip="Create Polygon Annotation"
|
|
78
|
+
margin={0}
|
|
79
|
+
/>
|
|
71
80
|
)}
|
|
72
81
|
|
|
73
|
-
<
|
|
82
|
+
<IconButton
|
|
74
83
|
color="primary"
|
|
75
|
-
|
|
84
|
+
icon={faTrash}
|
|
85
|
+
isOutline={true}
|
|
76
86
|
disabled={isDisabled}
|
|
77
87
|
onClick={onShouldDeleteSelectedAnnotation}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
tooltip="Delete selected annotation"
|
|
89
|
+
margin={0}
|
|
90
|
+
/>
|
|
81
91
|
</CButtonGroup>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
84
94
|
|
|
85
|
-
export default AnnoToolSelector
|
|
95
|
+
export default AnnoToolSelector
|