Skip to content

Commit 632d4d9

Browse files
authored
Merge pull request #51 from beru/Show_HighlightBox
Add showHighlightBox property to control visibility of Highlight Box
2 parents 09cadc1 + bbab57f commit 632d4d9

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

src/ImageCanvas/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type Props = {
5555
showTags?: boolean,
5656
realSize?: { width: number, height: number, unitName: string },
5757
showCrosshairs?: boolean,
58+
showHighlightBox?: boolean,
5859
showPointDistances?: boolean,
5960
pointDistancePrecision?: number,
6061
regionClsList?: Array<string>,
@@ -99,6 +100,7 @@ export default ({
99100
regionClsList,
100101
regionTagList,
101102
showCrosshairs,
103+
showHighlightBox,
102104
showPointDistances,
103105
allowedArea,
104106
RegionEditLabel = null,
@@ -421,6 +423,7 @@ export default ({
421423
onBeginBoxTransform={onBeginBoxTransform}
422424
onBeginMovePolygonPoint={onBeginMovePolygonPoint}
423425
onAddPolygonPoint={onAddPolygonPoint}
426+
showHighlightBox={showHighlightBox}
424427
/>
425428
)}
426429
{imageLoaded && showTags && (

src/RegionSelectAndTransformBoxes/index.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const RegionSelectAndTransformBoxes = ({
3333
onBeginBoxTransform,
3434
onBeginMovePolygonPoint,
3535
onAddPolygonPoint,
36+
showHighlightBox,
3637
}) => {
3738
return regions
3839
.filter((r) => r.visible || r.visible === undefined)
@@ -43,16 +44,18 @@ export const RegionSelectAndTransformBoxes = ({
4344
return (
4445
<Fragment key={r.id}>
4546
<PreventScrollToParents>
46-
<HighlightBox
47-
region={r}
48-
mouseEvents={mouseEvents}
49-
dragWithPrimary={dragWithPrimary}
50-
createWithPrimary={createWithPrimary}
51-
zoomWithPrimary={zoomWithPrimary}
52-
onBeginMovePoint={onBeginMovePoint}
53-
onSelectRegion={onSelectRegion}
54-
pbox={pbox}
55-
/>
47+
{showHighlightBox && (
48+
<HighlightBox
49+
region={r}
50+
mouseEvents={mouseEvents}
51+
dragWithPrimary={dragWithPrimary}
52+
createWithPrimary={createWithPrimary}
53+
zoomWithPrimary={zoomWithPrimary}
54+
onBeginMovePoint={onBeginMovePoint}
55+
onSelectRegion={onSelectRegion}
56+
pbox={pbox}
57+
/>
58+
)}
5659
{r.type === "box" &&
5760
!dragWithPrimary &&
5861
!zoomWithPrimary &&

src/SettingsDialog/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export const SettingsDialog = ({ open, onClose }) => {
2727
title: "Show Crosshairs",
2828
name: "showCrosshairs",
2929
},
30+
{
31+
type: "boolean",
32+
title: "Show Highlight Box",
33+
name: "showHighlightBox",
34+
},
3035
{
3136
type: "dropdown",
3237
title: "Video Playback Speed",

src/SettingsProvider/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React, { createContext, useContext, useState } from "react"
44

55
const defaultSettings = {
66
showCrosshairs: false,
7+
showHighlightBox: true,
78
}
89

910
export const SettingsContext = createContext(defaultSettings)

0 commit comments

Comments
 (0)