feat: LaTeX labels, decimal coords, ruler angle, shortcut cheatsheet, arrow keys#35
Merged
Merged
Conversation
Text primitives can now contain "\n" to render stacked lines, editable via the in-place canvas editor or the properties panel (both now textareas). Internally the text stores real newlines; the FidoCad file format keeps one physical line per primitive by escaping/unescaping "\n" on save/load, preserving backward compat with existing files that already contain raw backslashes. Rendering, bounding-box/hit-testing, rectangle selection, and the SVG/ PDF/PGF/TikZ exporters all stack additional lines below the first. Math-mode (LaTeX) text is not yet multiline-aware.
Each "\n"-separated line is now laid out through MathLayout independently, so a text primitive can mix math and plain lines (or math on every line) while stacking correctly on canvas, in hit-testing/selection bounds, and in the SVG/PDF exporters (which already laid out per line). All lines share one line-pitch sized to the tallest line's ascent/descent so nothing clips or overlaps.
… arrow keys - Render LaTeX math in macro/primitive Name and value labels (drawText now routes $...$ through layoutMath/drawMathSegments when TeX rendering is on) - Coordinate indicator shows unsnapped X/Y with two decimals - Ruler measurement box reports the angle from horizontal, in logical space - Add a Keyboard Shortcuts cheatsheet to the Help menu (macOS shows Command/ Option); trimmed redundant entries and dropped the non-functional library macro section - New shortcuts: Shift+E / Shift+S toggle an end / start arrowhead on any selected arrow-capable primitive (line, Bezier, complex curve)
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.
Summary
Five editor improvements, each covered by tests (763 unit tests green, typecheck + lint clean, production build passes).
1. LaTeX in Name/value labels
GraphicPrimitive.drawTextnow routes$...$math throughlayoutMath/drawMathSegmentswhen TeX rendering is active, so macros and every arrow-capable/base primitive render typeset math in their Name and value fields (on-screen and in bitmap/PNG export, which force-enables TeX on the same canvas path). Falls back to plain text when TeX is off or there is no delimiter.2. Two-decimal coordinate indicator
The X:/Y: readout shows
toFixed(2)and is fed unsnapped cursor coordinates, so the decimals carry real sub-grid precision. Snapped placement logic downstream is unchanged.3. Ruler angle
The ruler measurement box gained a third line: the angle from horizontal (e.g.
-53.13°), computed in logical space so it reflects the true drawing geometry regardless of independent X/Y zoom.4. Keyboard Shortcut cheatsheet (Help menu)
A grouped, scrollable modal listing every shortcut, keys rendered as
<kbd>caps. On macOSCtrl/Altdisplay as⌘/⌥. Redundant entries were trimmed (Home, Backspace, duplicate Redo) and the non-functional library-macro section removed.5. Arrowhead shortcuts (new)
Shift+E/Shift+Stoggle an end / start arrowhead on any selected arrow-capable primitive (line, Bézier, complex curve). Handled before the single-key tool/transform bindings so they don't fall through to Ellipse/Mirror. Group-consistent toggle, undo-aware, round-trips through save/load for free.Tests
test/primitives/name-value-latex.test.ts,test/ui/shortcuts-dialog.test.tstest/circuit/keyboard-shortcuts.test.ts(arrow toggles),test/circuit/ruler.test.ts(angle),test/ui/toolbar-controller.test.ts(decimal format)