fix: the migrated viewport must be the whole square, not the old rectangle

Seen on the live instance: in the editors the dot grid covered only part of the
canvas. The grid is drawn over the space's view_box, and I transformed that box
along with everything else — so it still described the old plan area, and the
margins the square canvas had just added were outside it. Nothing to draw on,
which is precisely the room the change exists to give.

The viewport is now reset to the full square. It is also what 'fit to screen'
fits, so the whole canvas is reachable.
This commit is contained in:
Matysh
2026-07-28 22:28:40 +03:00
parent 94b298962a
commit e1e730560d
2 changed files with 18 additions and 7 deletions
@@ -82,12 +82,12 @@ def migrate_space(space: dict[str, Any]) -> bool:
if shape.get("h") is not None:
shape["h"] = float(shape["h"]) * ky
vb = space.get("view_box")
if isinstance(vb, list) and len(vb) == 4:
space["view_box"] = [
dx + float(vb[0]) * kx, dy + float(vb[1]) * ky,
float(vb[2]) * kx, float(vb[3]) * ky,
]
# The viewport becomes the whole square rather than the transformed old
# rectangle. It is what the grid is drawn over and what "fit to screen"
# fits, so keeping the old box would leave the new margins outside the
# canvas — no dots, nothing to draw on — which is exactly the room this
# change was meant to give.
space["view_box"] = [0.0, 0.0, 1.0, 1.0]
# The grid pitch is a fraction of the WIDTH. A tall plan just got a wider
# canvas, so a wall now covers fewer cells; without this every measurement