Repository navigation
editor: SVG export, drawing frame optional (0.11) - #31
Merged
Merged
Conversation
File › Export SVG… writes the sheet shown, drawn by the canvas renderer on an SVG recording context, in the theme's light colors at the paper's scale. The frame and title block are included unless File › Export with Drawing Frame (or Settings › Export) is off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
File › Export SVG… writes the sheet on screen (the root sheet or an off-page sheet) as an SVG file.
svg.tsis a Canvas 2D context that records SVG. It covers the callsrender.tsandicons.tsmake: paths, arcs, rects, text, nested clips, translate/scale and dashes. The export runsrenderSheeton it, so the file matches what the editor draws. Text widths come from the editor's canvas fonts.exportFramein settings.json (written only when false).dimmer.svg, orcanvas-sheet3.svgfor sheet 3.Tests:
export-svg.test.ts(9 tests: the context, both exports, an off-page sheet of canvas.ufsm, the editor's colors restored, file names, the setting). The browser check has 13 new checks: the file parses, its text advances equal the canvas's, it is rasterized and checked, and the menu, the setting and the download work. It passed in full: 455 passed, 0 failed.npm test,typecheckandformat:checkare green on Windows.Still to try: the Tauri save dialog in
npm run dev, and opening the file in Inkscape.