Skip to content

Commit 01edfd4

Browse files
committed
Made diamonds for points when user in full image segmentation annotator and removed from wrapper
1 parent a7d8c01 commit 01edfd4

File tree

6 files changed

+55
-20
lines changed

6 files changed

+55
-20
lines changed

src/Annotator/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const Annotator = ({
5858
imageClsList = [],
5959
keyframes = {},
6060
taskDescription,
61+
fullImageSegmentationMode,
6162
RegionEditLabel,
6263
videoSrc,
6364
videoTime = 0,
@@ -137,6 +138,7 @@ export const Annotator = ({
137138
alwaysShowNextButton={Boolean(onNextImage)}
138139
alwaysShowPrevButton={Boolean(onPrevImage)}
139140
mask={mask}
141+
fullImageSegmentationMode={fullImageSegmentationMode}
140142
// maskVersion={maskVersion}
141143
state={state}
142144
dispatch={dispatch}

src/FullImageSegmentationAnnotator/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,11 @@ const imageData = new ImageData(uint8Array, width, height)
2020
// TODO remove this !!!!
2121

2222
export default ({ onExit, images }) => {
23-
return <Annotator mask={imageData} images={images} onExit={onExit} />
23+
return (
24+
<Annotator
25+
images={images}
26+
onExit={onExit}
27+
fullImageSegmentationMode={true}
28+
/>
29+
)
2430
}

src/HighlightBox/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ export const HighlightBox = ({
101101
top: pbox.y - 5,
102102
width: pbox.w + 10,
103103
height: pbox.h + 10,
104-
transform: 'rotate(-45deg)'
105104
}}
106105
>
107106
<path

src/ImageCanvas/index.js

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const ImageCanvas = ({
9090
videoPlaying = false,
9191
mask,
9292
maskVersion,
93-
93+
fullImageSegmentationMode,
9494
onImageOrVideoLoaded,
9595
onChangeRegion,
9696
onBeginRegionEdit,
@@ -237,22 +237,41 @@ export const ImageCanvas = ({
237237
)) {
238238
switch (region.type) {
239239
case "point": {
240-
context.save()
241-
242-
context.beginPath()
243-
context.strokeStyle = region.color
244-
context.moveTo(region.x * iw - 10, region.y * ih)
245-
context.lineTo(region.x * iw - 2, region.y * ih)
246-
context.moveTo(region.x * iw + 10, region.y * ih)
247-
context.lineTo(region.x * iw + 2, region.y * ih)
248-
context.moveTo(region.x * iw, region.y * ih - 10)
249-
context.lineTo(region.x * iw, region.y * ih - 2)
250-
context.moveTo(region.x * iw, region.y * ih + 10)
251-
context.lineTo(region.x * iw, region.y * ih + 2)
252-
context.moveTo(region.x * iw + 5, region.y * ih)
253-
context.arc(region.x * iw, region.y * ih, 5, 0, 2 * Math.PI)
254-
context.stroke()
255-
context.restore()
240+
if(!fullImageSegmentationMode){
241+
context.save()
242+
243+
context.beginPath()
244+
context.strokeStyle = region.color
245+
context.moveTo(region.x * iw - 10, region.y * ih)
246+
context.lineTo(region.x * iw - 2, region.y * ih)
247+
context.moveTo(region.x * iw + 10, region.y * ih)
248+
context.lineTo(region.x * iw + 2, region.y * ih)
249+
context.moveTo(region.x * iw, region.y * ih - 10)
250+
context.lineTo(region.x * iw, region.y * ih - 2)
251+
context.moveTo(region.x * iw, region.y * ih + 10)
252+
context.lineTo(region.x * iw, region.y * ih + 2)
253+
context.moveTo(region.x * iw + 5, region.y * ih)
254+
context.arc(region.x * iw, region.y * ih, 5, 0, 2 * Math.PI)
255+
context.stroke()
256+
context.restore()
257+
}else {
258+
const length = 4
259+
context.save()
260+
261+
context.beginPath()
262+
context.strokeStyle = region.color
263+
264+
context.moveTo(region.x * iw, region.y * ih+ length)
265+
context.lineTo(region.x * iw + length, region.y * ih)
266+
context.moveTo(region.x * iw, region.y * ih- length)
267+
context.lineTo(region.x * iw + length, region.y * ih)
268+
context.moveTo(region.x * iw, region.y * ih-length)
269+
context.lineTo(region.x * iw - length, region.y * ih)
270+
context.moveTo(region.x * iw, region.y * ih+length)
271+
context.lineTo(region.x * iw - length, region.y * ih)
272+
context.stroke()
273+
context.restore()
274+
}
256275
break
257276
}
258277
case "box": {

src/ImageMask/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
// @flow
22

33
import React, { useState, useEffect, useMemo } from "react"
4-
export default ({ imageData, imagePosition, videoPlaying, maskVersion, pointerEvents = "none", opacity = 0.5, zIndex = 999, position = 'absolute'}) => {
4+
export default ({ imageData,
5+
imagePosition,
6+
videoPlaying, maskVersion,
7+
pointerEvents = "none",
8+
opacity = 0.5,
9+
zIndex = 999,
10+
position = 'absolute'
11+
}) => {
512
const [canvasRef, setCanvasRef] = useState(null)
613

714
useEffect(() => {

src/MainLayout/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const MainLayout = ({
4242
alwaysShowNextButton = false,
4343
alwaysShowPrevButton = false,
4444
mask,
45+
fullImageSegmentationMode,
4546
RegionEditLabel,
4647
}: Props) => {
4748
const classes = useStyles()
@@ -156,6 +157,7 @@ export const MainLayout = ({
156157
{...settings}
157158
key={state.selectedImage}
158159
mask={mask}
160+
fullImageSegmentationMode={fullImageSegmentationMode}
159161
showTags={state.showTags}
160162
allowedArea={state.allowedArea}
161163
regionClsList={state.regionClsList}

0 commit comments

Comments
 (0)