Skip to content

Bundle PNG, file, PDF and print export in DiagramExporter - #17

Merged
code4teaching merged 9 commits into
inspector-helpersfrom
export-actions
Oct 19, 2026
Merged

code4teaching merged 9 commits into
inspector-helpersfrom
export-actions

Conversation

@code4teaching

Copy link
Copy Markdown
Owner

Requested by Holger · project thread

Before: ContentView had four export functions (PNG, document file, PDF, print), three of which repeated the same render call and error handling.

After: Export/DiagramExporter.swift does the rendering, temporary files, printing and error messages. ContentView only puts the result into the share sheet or the PDF preview. Export should behave exactly as before.

How: DiagramExporter is a small value built from the document, size class, canvas scale, language and display scale, with setError for messages. It sits next to the existing DiagramSnapshotExport and DiagramExportFilename in Export/. Step 6 of the plan; stacked on #16.

Check on Mac and iPad: share PNG, share document, export PDF (preview opens), print; an empty or tiny diagram shows the "too small" message.


Generated by Claude Code

The four export actions in ContentView each rendered the diagram and
mapped errors themselves. Export/DiagramExporter.swift now does that;
ContentView only stores the share payloads it returns.

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
- 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 merged commit 69d6259 into inspector-helpers Oct 19, 2026
2 checks passed
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