Skip to content

Commit d22c74f

Browse files
committed
map editor improvements
1 parent 8cca2d2 commit d22c74f

13 files changed

+510
-281
lines changed

map-o-matic-v2/src/App.tsx

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ActionIcon, Anchor, AppShell, Burger, Button, Flex, Group, Modal, NavLink, NumberInput, ScrollArea, Stack, Switch, Text } from '@mantine/core'
1+
import { ActionIcon, Anchor, AppShell, Burger, Button, Flex, Grid, Group, MantineStyleProp, Modal, NavLink, NumberInput, rem, ScrollArea, Stack, Switch, Text } from '@mantine/core'
22
import { useDisclosure } from '@mantine/hooks'
33
import { IconApple, IconCamera, IconGraph, IconImageInPicture, IconMap, IconSchema, IconSettings, IconWorld } from '@tabler/icons-react';
44
import { Link, Route, Routes } from 'react-router-dom';
@@ -96,6 +96,22 @@ function App() {
9696

9797
const [noticeOpened, noticeCallbacks] = useDisclosure(false);
9898

99+
const GRID_HEIGHT = "calc(100vh - 68px)"
100+
const GRID_LEFT: MantineStyleProp = {
101+
//backgroundColor: "blue",
102+
overflowY: "auto",
103+
minHeight: GRID_HEIGHT,
104+
maxHeight: GRID_HEIGHT,
105+
padding: "1rem"
106+
}
107+
const GRID_RIGHT: MantineStyleProp = {
108+
// backgroundColor: "red",
109+
padding: "2px",
110+
// overflowY: "auto",
111+
minHeight: GRID_HEIGHT,
112+
maxHeight: GRID_HEIGHT
113+
}
114+
99115
return (
100116
<>
101117
<MapOMaticContext.Provider value={mapOMatic}>
@@ -106,7 +122,6 @@ function App() {
106122
breakpoint: "sm",
107123
collapsed: { desktop: !navOpened },
108124
}}
109-
padding="md"
110125
>
111126
<AppShell.Header>
112127
<Group h="100%" px="md">
@@ -179,8 +194,8 @@ function App() {
179194
</AppShell.Navbar>
180195
<AppShell.Main>
181196
<Notice close={noticeCallbacks.close} open={noticeCallbacks.open} opened={noticeOpened} />
182-
<Flex style={{ height: '85vh' }}> {/* Full height container */}
183-
<ScrollArea style={{ width: '50%', height: '100%' }}> {/* Left pane */}
197+
<Grid align="stretch" gutter={{ base: 0 }}>
198+
<Grid.Col span={6} style={GRID_LEFT}>
184199
<Routes>
185200
<Route path='/' element={<ProjectPage />} />
186201
<Route path='/project' element={<ProjectPage />} />
@@ -189,11 +204,12 @@ function App() {
189204
<Route path='/images' element={<Images />} />
190205
<Route path='/event-graph' element={<EventGraph />} />
191206
</Routes>
192-
</ScrollArea>
193-
<ScrollArea style={{ width: '50%', height: '100%' }}> {/* Right pane */}
207+
208+
</Grid.Col>
209+
<Grid.Col span={6} style={GRID_RIGHT}>
194210
<RendererPage />
195-
</ScrollArea>
196-
</Flex>
211+
</Grid.Col>
212+
</Grid>
197213
</AppShell.Main>
198214
</AppShell >
199215
</MapOMaticContext.Provider >

map-o-matic-v2/src/EventGraph.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function EventGraph() {
190190
<>
191191
<div
192192
ref={containerRef}
193-
style={{ width: '600px', height: '600px', border: '1px solid black' }}
193+
style={{ width: '100%', height: '100%' }}
194194
/>
195195
</>
196196
)

map-o-matic-v2/src/GlobalActions.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function GlobalActions() {
1111
const mapBorderCount = project.maps.filter(x => x.render.showMapBorder === true).length
1212
const mapGridCount = project.maps.filter(x => x.render.showMapGrid === true).length
1313
const mapCollisionCount = project.maps.filter(x => x.render.showCollision === true).length
14+
const mapMoveBoxCount = project.maps.filter(x => x.render.showMoveBoxes === true).length
1415

1516
function toggleGrids(event: ChangeEvent<HTMLInputElement>): void {
1617
updateProject(produce(project, draft => {
@@ -30,8 +31,14 @@ function GlobalActions() {
3031
}))
3132
}
3233

34+
function toggleMoveBoxes(event: ChangeEvent<HTMLInputElement>): void {
35+
updateProject(produce(project, draft => {
36+
draft.maps.forEach(x => x.render.showMoveBoxes = event.target.checked)
37+
}))
38+
}
39+
3340
return (<>
34-
<div>
41+
<Group>
3542
<Stack gap={"xs"}>
3643
<Checkbox
3744
onChange={toggleGrids}
@@ -52,7 +59,15 @@ function GlobalActions() {
5259
label="Show Collisions"
5360
/>
5461
</Stack>
55-
</div>
62+
<Stack gap={"xs"} justify={"flex-start"}>
63+
<Checkbox
64+
onChange={toggleMoveBoxes}
65+
checked={mapMoveBoxCount === totalMaps}
66+
indeterminate={mapMoveBoxCount > 0 && mapMoveBoxCount < totalMaps}
67+
label="Show Move Bounds"
68+
/>
69+
</Stack>
70+
</Group>
5671
</>)
5772
}
5873

0 commit comments

Comments
 (0)