Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

1113 adjust defaults new map defaults #1302

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Syntax: `- short text describing the change _(Your Name)_`
- Added Meeting Agenda&Notes for 15.04.2024 9:00 _(Markus Raab, Daniel)_
- _()_
- _()_
- _()_
- Adjusted size and positon of initial view of map, as well as default map polygon, to have entire map in view by default _(Andrei Dinu)_
- _()_
- _()_
- _()_
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/features/map_planning/components/BaseStage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ export const BaseStage = ({
const viewRect = useMapStore((store) => store.untrackedState.editorViewRect);
useEffect(() => {
if (viewRect.width !== 0 || viewRect.height !== 0) return;
// If we don't have a view or height set, set the initial stage and view rectangle to be centered on coordinates (0,0)

stage.x = Math.floor((containerRef.current?.offsetWidth ?? 0) / 2);
stage.y = Math.floor((containerRef.current?.offsetHeight ?? 0) / 2);

updateViewRect({
x: 0,
y: 0,
x: Math.floor((containerRef.current?.offsetWidth ?? 0) / 2),
y: Math.floor((containerRef.current?.offsetHeight ?? 0) / 2),
width: Math.floor(window.innerWidth / stage.scale),
height: Math.floor(window.innerHeight / stage.scale),
});
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/features/maps/routes/MapCreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ export default function MapCreateForm() {
geometry: {
rings: [
[
{ x: -5_000.0, y: -5_000.0 },
{ x: -5_000.0, y: 5_000.0 },
{ x: 5_000.0, y: 5_000.0 },
{ x: 5_000.0, y: -5_000.0 },
{ x: -5_000.0, y: -5_000.0 },
{ x: -500.0, y: -500.0 },
{ x: -500.0, y: 500.0 },
{ x: 500.0, y: 500.0 },
{ x: 500.0, y: -500.0 },
{ x: -500.0, y: -500.0 },
],
],
srid: 4326,
Expand Down