Skip to content

Commit d07387f

Browse files
committed
fix: add hiding next/prev/header/header text
1 parent 23ec553 commit d07387f

File tree

5 files changed

+60
-7
lines changed

5 files changed

+60
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"react-hotkeys": "^2.0.0",
2020
"react-json-view": "^1.19.1",
2121
"react-markdown": "^4.0.6",
22-
"react-material-workspace-layout": "^1.0.6",
22+
"react-material-workspace-layout": "^1.0.8",
2323
"react-monaco-editor": "^0.25.1",
2424
"react-remove-scroll": "^2.0.4",
2525
"react-select": "^3.0.8",

src/Annotator/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ type Props = {
4848
autoSegmentationOptions?:
4949
| {| type: "simple" |}
5050
| {| type: "autoseg", maxClusters?: number, slicWeightFactor?: number |},
51+
hideHeader?: boolean,
52+
hideHeaderText?: boolean,
53+
hideNext?: boolean,
54+
hidePrev?: boolean,
5155
}
5256

5357
export const Annotator = ({
@@ -82,6 +86,10 @@ export const Annotator = ({
8286
onPrevImage,
8387
keypointDefinitions,
8488
autoSegmentationOptions = { type: "autoseg" },
89+
hideHeader,
90+
hideHeaderText,
91+
hideNext,
92+
hidePrev,
8593
}: Props) => {
8694
if (typeof selectedImage === "string") {
8795
selectedImage = (images || []).findIndex((img) => img.src === selectedImage)
@@ -172,6 +180,10 @@ export const Annotator = ({
172180
state={state}
173181
dispatch={dispatch}
174182
onRegionClassAdded={onRegionClassAdded}
183+
hideHeader={hideHeader}
184+
hideHeaderText={hideHeaderText}
185+
hideNext={hideNext}
186+
hidePrev={hidePrev}
175187
/>
176188
</SettingsProvider>
177189
)

src/Annotator/index.story.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,3 +666,36 @@ storiesOf("Annotator", module)
666666
]}
667667
/>
668668
))
669+
.add("Hide Next, Hide Header Text", () => (
670+
<Annotator
671+
onExit={actionAddon("onExit")}
672+
labelImages
673+
hideNext
674+
hideHeaderText
675+
fullImageSegmentationMode
676+
enabledTools={["modify-allowed-area"]}
677+
regionClsList={["Alpha", "Beta", "Charlie", "Delta"]}
678+
images={[
679+
{
680+
src: exampleImage,
681+
name: "Frame 0036",
682+
},
683+
]}
684+
/>
685+
))
686+
.add("Hide Header", () => (
687+
<Annotator
688+
onExit={actionAddon("onExit")}
689+
labelImages
690+
hideHeader
691+
fullImageSegmentationMode
692+
enabledTools={["modify-allowed-area"]}
693+
regionClsList={["Alpha", "Beta", "Charlie", "Delta"]}
694+
images={[
695+
{
696+
src: exampleImage,
697+
name: "Frame 0036",
698+
},
699+
]}
700+
/>
701+
))

src/MainLayout/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ type Props = {
5454
alwaysShowNextButton?: boolean,
5555
alwaysShowPrevButton?: boolean,
5656
onRegionClassAdded: () => {},
57+
hideHeader?: boolean,
58+
hideHeaderText?: boolean,
5759
}
5860

5961
export const MainLayout = ({
@@ -63,6 +65,10 @@ export const MainLayout = ({
6365
alwaysShowPrevButton = false,
6466
RegionEditLabel,
6567
onRegionClassAdded,
68+
hideHeader,
69+
hideHeaderText,
70+
hideNext = false,
71+
hidePrev = false,
6672
}: Props) => {
6773
const classes = useStyles()
6874
const settings = useSettings()
@@ -226,6 +232,8 @@ export const MainLayout = ({
226232
<Workspace
227233
allowFullscreen
228234
iconDictionary={iconDictionary}
235+
hideHeader={hideHeader}
236+
hideHeaderText={hideHeaderText}
229237
headerLeftSide={[
230238
state.annotationType === "video" ? (
231239
<KeyframeTimeline
@@ -239,8 +247,8 @@ export const MainLayout = ({
239247
) : null,
240248
].filter(Boolean)}
241249
headerItems={[
242-
{ name: "Prev" },
243-
{ name: "Next" },
250+
!hidePrev && { name: "Prev" },
251+
!hideNext && { name: "Next" },
244252
state.annotationType !== "video"
245253
? null
246254
: !state.videoPlaying

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14566,10 +14566,10 @@ react-markdown@^4.0.6:
1456614566
unist-util-visit "^1.3.0"
1456714567
xtend "^4.0.1"
1456814568

14569-
react-material-workspace-layout@^1.0.6:
14570-
version "1.0.6"
14571-
resolved "https://registry.yarnpkg.com/react-material-workspace-layout/-/react-material-workspace-layout-1.0.6.tgz#d4495bb62bdc764ee3ccc77cdd1f7c33e4022c92"
14572-
integrity sha512-CiqdpivEC9ZEELDpJFrrzwfnZgtz2Ijl465bf1ehU7tflJ3Z9Dhm2cYXzGPzeNrqJ0pdmKQoCn27Ht943oHefQ==
14569+
react-material-workspace-layout@^1.0.8:
14570+
version "1.0.8"
14571+
resolved "https://registry.yarnpkg.com/react-material-workspace-layout/-/react-material-workspace-layout-1.0.8.tgz#3825b7ee2f5d2b219adac98afce4670fd3935bbb"
14572+
integrity sha512-UT4qIVXJA2MhHiv4D/18jxo5vFnn+q/xWk0x+b01V/niKzIRE6jx/MNSJdmzgAyhzTxU2XixMCMhGVQu19JyOw==
1457314573
dependencies:
1457414574
"@material-ui/core" "^4.10.0"
1457514575
"@material-ui/icons" "^4.9.1"

0 commit comments

Comments
 (0)