Skip to content

Add Sketch anchor switch (Center / Top Left)#16

Merged
vecnode merged 1 commit into
mainfrom
sketch-anchor-toggle
Jul 1, 2026
Merged

Add Sketch anchor switch (Center / Top Left)#16
vecnode merged 1 commit into
mainfrom
sketch-anchor-toggle

Conversation

@vecnode

@vecnode vecnode commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What & why

Adds an Anchor control to the Sketch section of the side panel, above Background — a two-button segmented switch (only one active at a time):

  • Center — the current behaviour; the canvas is centred in the preview.
  • Top Left — the canvas anchors to the top-left corner (p5's natural default position).

It maps to the sketch iframe body's flex alignment (center vs flex-start), baked in on Run and pushed live to a running sketch via postMessage({type:'set-anchor'}) (handled by the injected capture controller), so switching repositions the canvas immediately without a restart.

Reviewer notes

  • node --check passes; Debug build links cleanly.
  • Note on the request: the button is labelled Top Left (as specified) — the message also mentioned "top right", so if you actually want top-right, it's a one-line change (flex-startflex-end on justify-content).
  • Worth an eyeball in WebView2: run a sketch whose canvas is smaller than the preview, then toggle Center/Top Left.

🤖 Generated with Claude Code

New segmented two-button switch in the Sketch section, above Background:
choose whether the canvas is anchored Center (default, as before) or Top
Left within the preview. Baked into the iframe body flex alignment on run
and pushed live to a running sketch via postMessage ('set-anchor').

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vecnode vecnode merged commit 6f4c3f8 into main Jul 1, 2026
@vecnode vecnode deleted the sketch-anchor-toggle branch July 1, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant