Skip to content

Split DiagramCanvasView into view, drop zones and renderer - #18

Merged
code4teaching merged 4 commits into
export-actionsfrom
canvas-split
Oct 19, 2026
Merged

code4teaching merged 4 commits into
export-actionsfrom
canvas-split

Conversation

@code4teaching

Copy link
Copy Markdown
Owner

Requested by Holger · project thread

Before: Canvas/DiagramCanvasView.swift was one file of about 1260 lines with layout, drag and drop, and drawing.

After: it is three files of about 340, 450 and 490 lines: DiagramCanvasView.swift (inputs, state, layout, clipboard), DiagramCanvasDropZones.swift (drop bands, tap insert targets, applying drops) and DiagramCanvasRenderer.swift (drawing). The canvas should look and behave exactly as before.

How: the code is moved unchanged into two extensions of DiagramCanvasView. Members that the files share lose private, since Swift's private does not reach across files. Separate types for the renderer and the drop zones would need many more parameters and were not worth the risk here. Step 7, the last step of the plan; stacked on #17.

Check on Mac and iPad: drawing of all element types, selection highlight in edit and simulation mode, drag from the palette onto before/after/replace bands and the strip above the first element, moving elements by drag, tap insert on iPhone, copy/cut/paste from the context menu.


Generated by Claude Code

- DiagramCanvasView.swift: inputs, state, layout and body, clipboard.
- DiagramCanvasDropZones.swift: drop bands, tap insert targets and
  applying drops.
- DiagramCanvasRenderer.swift: Canvas drawing of cells, lines and text.

The two new files are extensions of DiagramCanvasView, so members they
share lose their `private`. Code is moved unchanged otherwise.

No behavior change intended.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cp4EQgFQyGbM8MVLiWbJKQ
@code4teaching code4teaching self-assigned this Oct 18, 2026
@code4teaching
code4teaching marked this pull request as ready for review October 18, 2026 22:29
Carries the VoiceOver block labels from main into
DiagramCanvasDropZones.swift.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cp4EQgFQyGbM8MVLiWbJKQ
@code4teaching
code4teaching merged commit 14d0997 into export-actions Oct 19, 2026
2 checks passed
@code4teaching
code4teaching deleted the canvas-split branch November 5, 2026 21:26
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.

2 participants