Skip to content

Commit 56a7499

Browse files
committed
fix header buttons, settings and fullscreen broken
1 parent e855957 commit 56a7499

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"react-hotkeys": "^2.0.0",
1919
"react-json-view": "^1.19.1",
2020
"react-markdown": "^4.0.6",
21-
"react-material-workspace-layout": "^0.1.8",
21+
"react-material-workspace-layout": "^0.1.13",
2222
"react-monaco-editor": "^0.25.1",
2323
"react-remove-scroll": "^2.0.4",
2424
"react-select": "^3.0.8",

src/FullImageSegmentationAnnotator/index.story.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import FullImageSegmentationAnnotator from "./"
1313

1414
storiesOf("FullImageSegmentationAnnotator.Basic", module)
1515
.add("Orange 2 Class", () => (
16-
<div style={{ width: "100vw", height: "100vh" }}>
16+
<div style={{ width: "95vw", height: "95vh" }}>
1717
<FullImageSegmentationAnnotator
1818
images={[
1919
{
@@ -59,7 +59,7 @@ storiesOf("FullImageSegmentationAnnotator.Basic", module)
5959
</div>
6060
))
6161
.add("S3 CORS domain", () => (
62-
<div style={{ width: "100vw", height: "100vh" }}>
62+
<div style={{ width: "95vw", height: "95vh" }}>
6363
<FullImageSegmentationAnnotator
6464
images={[
6565
{
@@ -90,7 +90,7 @@ storiesOf("FullImageSegmentationAnnotator.Basic", module)
9090
</div>
9191
))
9292
.add("Orange 3 Class", () => (
93-
<div style={{ width: "100vw", height: "100vh" }}>
93+
<div style={{ width: "95vw", height: "95vh" }}>
9494
<FullImageSegmentationAnnotator
9595
images={[
9696
{
@@ -120,7 +120,7 @@ storiesOf("FullImageSegmentationAnnotator.Basic", module)
120120
</div>
121121
))
122122
.add("Hard 1, 8 Class, Simple Mode", () => (
123-
<div style={{ width: "100vw", height: "100vh" }}>
123+
<div style={{ width: "95vw", height: "95vh" }}>
124124
<FullImageSegmentationAnnotator
125125
images={[
126126
{
@@ -135,7 +135,7 @@ storiesOf("FullImageSegmentationAnnotator.Basic", module)
135135
</div>
136136
))
137137
.add("Hard 1, 8 Class", () => (
138-
<div style={{ width: "100vw", height: "100vh" }}>
138+
<div style={{ width: "95vw", height: "95vh" }}>
139139
<FullImageSegmentationAnnotator
140140
images={[
141141
{
@@ -149,7 +149,7 @@ storiesOf("FullImageSegmentationAnnotator.Basic", module)
149149
</div>
150150
))
151151
.add("Hard 2, 8 Class", () => (
152-
<div style={{ width: "100vw", height: "100vh" }}>
152+
<div style={{ width: "95vw", height: "95vh" }}>
153153
<FullImageSegmentationAnnotator
154154
images={[
155155
{
@@ -163,7 +163,7 @@ storiesOf("FullImageSegmentationAnnotator.Basic", module)
163163
</div>
164164
))
165165
.add("Hard 3, 8 Class", () => (
166-
<div style={{ width: "100vw", height: "100vh" }}>
166+
<div style={{ width: "95vw", height: "95vh" }}>
167167
<FullImageSegmentationAnnotator
168168
images={[
169169
{

src/MainLayout/index.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import TaskDescription from "../TaskDescriptionSidebarBox"
2929
import RegionSelector from "../RegionSelectorSidebarBox"
3030
import ImageSelector from "../ImageSelectorSidebarBox"
3131
import HistorySidebarBox from "../HistorySidebarBox"
32+
import useEventCallback from "use-event-callback"
3233

3334
const emptyArr = []
3435
const useStyles = makeStyles(styles)
@@ -164,6 +165,14 @@ export const MainLayout = ({
164165
/>
165166
)
166167

168+
const onClickIconSidebarItem = useEventCallback((item) => {
169+
dispatch({ type: "SELECT_TOOL", selectedTool: item.name })
170+
})
171+
172+
const onClickHeaderItem = useEventCallback((item) => {
173+
dispatch({ type: "HEADER_BUTTON_CLICKED", buttonName: item.name })
174+
})
175+
167176
const debugModeOn = Boolean(window.localStorage.$ANNOTATE_DEBUG_MODE && state)
168177

169178
return (
@@ -192,13 +201,18 @@ export const MainLayout = ({
192201
{ name: "Fullscreen" },
193202
{ name: "Save" },
194203
].filter(Boolean)}
195-
onClickHeaderItem={console.log}
196-
onClickIconSidebarItem={console.log}
204+
onClickHeaderItem={onClickHeaderItem}
205+
onClickIconSidebarItem={onClickIconSidebarItem}
206+
selectedTools={[
207+
state.selectedTool,
208+
state.showTags && "show-tags",
209+
state.showMask && "show-mask",
210+
].filter(Boolean)}
197211
iconSidebarItems={[
198212
{
199213
name: "select",
200214
helperText: "Select",
201-
selected: true,
215+
selected: state.selectedTool,
202216
},
203217
{
204218
name: "pan",
@@ -256,7 +270,7 @@ export const MainLayout = ({
256270
/>
257271
),
258272
<RegionSelector
259-
regions={activeImage ? activeImage.regions : null}
273+
regions={activeImage ? activeImage.regions : emptyArr}
260274
onSelectRegion={action("SELECT_REGION", "region")}
261275
onDeleteRegion={action("DELETE_REGION", "region")}
262276
onChangeRegion={action("CHANGE_REGION", "region")}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14522,10 +14522,10 @@ react-markdown@^4.0.6:
1452214522
unist-util-visit "^1.3.0"
1452314523
xtend "^4.0.1"
1452414524

14525-
react-material-workspace-layout@^0.1.8:
14526-
version "0.1.8"
14527-
resolved "https://registry.yarnpkg.com/react-material-workspace-layout/-/react-material-workspace-layout-0.1.8.tgz#b81ca443d6a57b4668ce823c00c52d14d5556020"
14528-
integrity sha512-XgC7ucxKZ1YMxA3hMPAhrrsqcCG0oZ5NAC+ua2brkvr8io4u1Nrj5BFrzGIfpRqJIzO2BVOn4DOZJhpgXIQKOQ==
14525+
react-material-workspace-layout@^0.1.13:
14526+
version "0.1.13"
14527+
resolved "https://registry.yarnpkg.com/react-material-workspace-layout/-/react-material-workspace-layout-0.1.13.tgz#b28d00598a0cabfdd2909b5c0c3c9c645010bb6a"
14528+
integrity sha512-D2ad99pyDxJOZexnjL/IQMqqrGpM8wqh3S2UCqMe/TeMy+9W8zMXgyce6VDUsU4jPEOB+16sVcohuIYWllwZGA==
1452914529
dependencies:
1453014530
"@material-ui/core" "^4.10.0"
1453114531
"@material-ui/icons" "^4.9.1"

0 commit comments

Comments
 (0)