Wiresheet: grey margin strip, saved-state tint on and off the sheet

- The top/left margin no box may enter is grey and ungridded, so the white
  sheet starts where boxes can actually be placed.
- Saving/unsaved state no longer resets the canvas to white: the sheet goes
  white/pink and the area around it grey/greyish pink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 13:18:58 +03:00
co-authored by Claude Opus 5.5
parent b3d96d96b6
commit 3d9db54956
3 changed files with 28 additions and 10 deletions
+5 -4
View File
@@ -123,7 +123,6 @@ FIT_PADDING = 20
# as a grey wash rather than a grid, so the grid is left off instead.
MIN_GRID_STEP = 3
SHEET_MARGIN_GRIDS = 3 # grid squares of grey kept past anything that overflows the sheet
OFF_SHEET_COLOUR = "#f3f3f3" # canvas outside the area a box's origin can be stored in
def snap_up(value, grid_size):
@@ -240,16 +239,18 @@ def measure_box(comp, fonts, linked_slot_index):
def draw_grid():
"""Paints the sheet white and grids it; the canvas around it stays OFF_SHEET_COLOUR.
"""Paints the sheet and grids it; the canvas around it is the off-sheet tint.
Drawn at the sheet's zoom, so a box still lands on a line at every scale.
"""
canvas = app_state.canvas
canvas.delete("grid")
x1, y1 = 0, 0
# The sheet starts past the margin strip no box may enter, which stays grey too.
x1 = y1 = layout_margin(app_state.meta_scale) * app_state.zoom
x2, y2 = (coord * app_state.zoom for coord in sheet_extent())
canvas.create_rectangle(x1, y1, x2, y2, fill="white", outline="#c8c8c8", tags="grid")
canvas.create_rectangle(x1, y1, x2, y2, outline="#c8c8c8", tags=("grid", "sheet_bg"))
app_state.paint_sheet_tint() # white or pink by saved state, grey or pink around it
step = app_state.GRID_SIZE * app_state.zoom
if step >= MIN_GRID_STEP: