Skip to content

Commit bebad8f

Browse files
committed
minor fixes
1 parent 8beeee6 commit bebad8f

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

src/ImageCanvas/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export const ImageCanvas = ({
202202
// Pattern to indicate the NOT allowed areas
203203
const { x, y, w, h } = allowedArea
204204
context.save()
205-
context.globalAlpha = 0.25
205+
context.globalAlpha = 1
206206
const outer = [
207207
[0, 0],
208208
[iw, 0],
@@ -326,7 +326,7 @@ export const ImageCanvas = ({
326326
</PreventScrollToParents>
327327
)}
328328
{!showTags && highlightedRegion && (
329-
<div className={classes.fixedRegionLabel}>
329+
<div key="topLeftTag" className={classes.fixedRegionLabel}>
330330
<RegionLabel
331331
disableClose
332332
allowedClasses={regionClsList}
@@ -387,6 +387,7 @@ export const ImageCanvas = ({
387387
mat={mat}
388388
imagePosition={imagePosition}
389389
regions={regions}
390+
fullSegmentationMode={fullImageSegmentationMode}
390391
/>
391392
<VideoOrImageCanvasBackground
392393
videoPlaying={videoPlaying}

src/ImageCanvas/region-tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const getEnclosingBox = (region: Region) => {
8686
return { x: region.x, y: region.y, w: 0, h: 0 }
8787
}
8888
default: {
89-
return
89+
return { x: 0, y: 0, w: 0, h: 0 }
9090
}
9191
}
9292
throw new Error("unknown region")

src/RegionShapes/index.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const RegionComponents = {
3131
/>
3232
</g>
3333
)),
34-
polygon: memo(({ region, iw, ih, fullImageSegmentationMode }) => {
34+
polygon: memo(({ region, iw, ih, fullSegmentationMode }) => {
3535
const Component = region.open ? "polyline" : "polygon"
36-
const alphaBase = fullImageSegmentationMode ? 0.5 : 1
36+
const alphaBase = fullSegmentationMode ? 0.5 : 1
3737
return (
3838
<Component
3939
points={region.points
@@ -113,7 +113,7 @@ const RegionComponents = {
113113
}
114114

115115
export const WrappedRegionList = memo(
116-
({ regions, iw, ih, fullImageSegmentationMode }) => {
116+
({ regions, iw, ih, fullSegmentationMode }) => {
117117
return regions
118118
.filter((r) => r.visible !== false)
119119
.map((r) => {
@@ -124,15 +124,20 @@ export const WrappedRegionList = memo(
124124
region={r}
125125
iw={iw}
126126
ih={ih}
127-
fullImageSegmentationMode={fullSegmentationMode}
127+
fullgeSegmentationMode={fullSegmentationMode}
128128
/>
129129
)
130130
})
131131
},
132132
(n, p) => n.regions === p.regions && n.iw === p.iw && n.ih === p.ih
133133
)
134134

135-
export const RegionShapes = ({ mat, imagePosition, regions = [] }) => {
135+
export const RegionShapes = ({
136+
mat,
137+
imagePosition,
138+
regions = [],
139+
fullSegmentationMode,
140+
}) => {
136141
const iw = imagePosition.bottomRight.x - imagePosition.topLeft.x
137142
const ih = imagePosition.bottomRight.y - imagePosition.topLeft.y
138143
if (isNaN(iw) || isNaN(ih)) return null
@@ -150,7 +155,12 @@ export const RegionShapes = ({ mat, imagePosition, regions = [] }) => {
150155
height: ih,
151156
}}
152157
>
153-
<WrappedRegionList regions={regions} iw={iw} ih={ih} />
158+
<WrappedRegionList
159+
regions={regions}
160+
iw={iw}
161+
ih={ih}
162+
fullSegmentationMode={fullSegmentationMode}
163+
/>
154164
</svg>
155165
)
156166
}

0 commit comments

Comments
 (0)