Repository navigation
Drawing tab: Offset, Stretch, Enlarge ,Spot Co-ordinate, Chamfer, Fillet tools, Move with base point + dimension input for shapes - #541
Closed
ghostship25 wants to merge 4 commits into
Conversation
Fills in the three CAD-style editing operations the Drawing tab left as "Coming soon" placeholders (Offset, Stretch) and adds Enlarge (AutoCAD SCALE), and lets users draw rectangles, circles, ellipses, polygons and L-shapes by typing exact dimensions instead of dragging. - Offset: type a distance with the existing CAD input, click a side and get a parallel copy — lines/arrows/walls (perpendicular), boxes/circles (outward or inward), polyline contours (bisector offsetting) - Stretch: drag a crossing window over the vertices that should move, then a base point + drag; the rest of the shape stays put - Enlarge: scale the selection about a base point by a typed factor (1.5 / 0.5), with a live preview that reverts on Escape - Shape tools: a click (instead of a drag) now opens dimension input — type "500,300" for width x height, or one value for a square/diameter, Enter to draw; tooltips mention it - New pure geometry modules (offset/stretch/scale) with 25 unit tests, registered in scripts/unit-testlijst.txt - New English ribbon strings; other locales fall back to English Verified: tsc --noEmit, 2987 unit tests, vite build, and manual browser tests (400x200 rect, 240 diameter circle, +10 offset, +50 stretch, 1.5x enlarge). 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
… guide Extend The floating W/H badge only committed on Enter, so a typed size was silently discarded whenever focus left the field (clicking the canvas deselected first and reverted the field). Commit now also runs on blur and, via a document-level capture listener, just before a click-away deselect — tracked by a dirty flag so a plain focus change without edits stays undo-clean. The badge now also covers circles (a round circle keeps both axes equal, as one undo step) and polygons (both axes scale by the same factor so the shape stays regular); polylines are excluded because their x/y/width/height is only a derived bounding box. Extend gave no feedback at all: clicking anything but a line was a silent no-op, which read as "the tool does nothing". It now announces its two-step workflow in the status bar and explains non-line picks and non-intersecting lines, started through a new startExtendTool() entry point from the ribbon. Verified in the browser: blur/click-away/Enter commits for rectangle, circle and polygon, one-step undo for the linked circle resize, exact intersection geometry and all three Extend messages, plus Stretch (right edge only, x untouched) and Enlarge (exact ×1.5). Typecheck, 2987 unit tests and the production build all pass. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
…splacement The coord-input HUD only rendered once the first character was typed, and at the last raw cursor position — so after clicking a ribbon button the user got no clue where to type the enlarge factor at all. The HUD now stays visible for the whole time a tool has input capture active, shows a tool-specific placeholder (factor / dx,dy / distance / length), and anchors to the tool's input point when the cursor is not over the page instead of drifting to a stale corner. Stretch could only be dragged, with no way to state an exact x/y displacement. The base-point phase now also opens coord-input capture: typing "50,0" or "100<45" plus Enter applies that displacement (same scale-unit conversion and undo path as the drag), while a bare number without direction is rejected with a hint. Enlarge no longer activates into a dead end when nothing is selected — it captures the selection before switching tools and otherwise keeps the current tool while telling the user to select first. Verified in the browser: enlarge HUD visible immediately with its placeholder positioned over the page, typed 1.25 scales exactly 1.25 on both axes and hides the HUD; stretch typed 50,0 grows the right edge by exactly 50 with x untouched, -30,0 shrinks by 30; the line tool still draws with its new placeholder shown; the empty- selection guard leaves the tool untouched. Typecheck, 2987 unit tests and the production build all pass. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Replace the three "Coming soon" placeholders with working CAD tools:
- Fillet/Chamfer (corner-tools.js): two-click corner editing on lines,
arrows and walls; trim one endpoint per line and add the arc/chamfer
segment as one undo step. Pure geometry in corner-geometry.js with
13 unit tests. Typed radius (fillet) or distance(s) "d1,d2" (chamfer)
via the CAD coord-input, remembered between uses.
- Spot Coord (spot-coord-tool.js): one click labels the X,Y coordinates
of a point with a leader, in scale-region-aware document units;
reuses the measureDistance annotation type.
- Move button now runs the AutoCAD-style base-point flow ('mv') instead
of synthesizing a G keypress: click 1 picks the snapped base point,
then drag or type a displacement like 50,0 + Enter.
Verified in the browser against the live app (tool contexts, keyboard
path, undo/redo transactions); tsc, unit tests and build all pass.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Collaborator
|
Thank you, @ghostship25! Your drawing tools are in release 2026.42.0 (#576) as one squashed commit under your name, together with review fixes: locked and hidden objects are not edited, arc segments are kept on stretch, enlarge and offset, measurement labels update after an edit, and an interrupted Enlarge preview is undoable. The PR is closed manually because the commits were squashed into the release. |
philip-tam
pushed a commit
to philip-tam/open-pdf-studio
that referenced
this pull request
Oct 14, 2026
…rdinate tools (OpenAEC-Foundation#541) Adds Offset, Stretch, Enlarge, Fillet, Chamfer and Spot Coordinate to the Drawing tab, Move with a base point, and typed dimensions for boxes, circles, ellipses, polygons and L-shapes.
philip-tam
pushed a commit
to philip-tam/open-pdf-studio
that referenced
this pull request
Oct 14, 2026
- Lao (OpenAEC-Foundation#537): register 'lo' in the language list, count 40 locales in the locale tests, and use one wording for Shift Page. - Pages per sheet (OpenAEC-Foundation#540): flush lazily embedded images and fonts before placing pages, so raster prints no longer give blank cells. - Drawing tools (OpenAEC-Foundation#541): never edit locked, hidden or locked-layer objects; keep arc segments on stretch, enlarge and offset; update measurement labels after an edit; keep spot coordinates on recalculation; fix typed shape dimensions; undo for an interrupted enlarge preview; offset copies through the duplication primitive. - Flattened copy (OpenAEC-Foundation#542): keep hidden layers hidden and warn about form field values before saving. - Add Text (OpenAEC-Foundation#543): only move the start point when the text does not fit. - Translations: every key that exists in English is now translated in all 39 other languages, including the backlog of earlier releases.
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.
Goal
Three CAD-style editing operations in the Drawing tab — two of them already sitting there as disabled "Coming soon" placeholders — plus the ability to draw shapes by entering dimensions instead of dragging.
What's in this PR
Editing tools (Drawing tab → Edit group)
1.5,0.5) + Enter. Live preview while typing; Escape restores the original geometry. Text scales with the shape, line weights stay unchanged.Dimension input for shapes (Drawing tab → Draw group)
A click (instead of a drag) with Rectangle, Circle, Ellipse, Polygon or L-shape now opens the same CAD input HUD used by the line tool:
500,300+ Enter → rectangle 500 × 300 (width × height, in measured units)240+ Enter → circle with Ø240, or a 150 × 150 square for the rectangle tool100<45(polar) and=400,300(absolute) also work, matching the existing coord-input formatsThe Draw-group tooltips now mention it: "Rectangle — click, then type e.g. 500,300 + Enter".
Implementation notes
js/annotations/offset-geometry.js,stretch-geometry.js,scale-geometry.jsonPointerDown/Move/Up/Escape/Deactivate,state._typeLengthCommit,recordAdd/recordBulkModifyundo records, status-bar guidance)dr-offset/dr-stretchplaceholders are replaced anddr-enlargeis added; registration injs/tools/tools/index.jsjs/i18n/locales/en/ribbon.jsononly — other locales fall back to English (fallbackLng: 'en'), so no translations are blockedAcceptance criteria / verification
npx tsc --noEmit— cleannpm run test:unit— 2987 tests, 0 failures (25 new tests covering offset/stretch/scale geometry, added toscripts/unit-testlijst.txt)npx vite build— cleannpx vite) on a blank document:400,200→ rectangle measured 400 × 200 ✅240on circle → Ø240 ✅, typed150on rectangle → 150 × 150 ✅10+ click outside → copy grew 400×200 → 420×220 at −10 offset ✅1.5→ 450×200 → 675×300 around the same centre ✅Out of scope
Fillet, Chamfer and Spot Coord remain "Coming soon" placeholders, as before.
Happy to re-work anything — I saw the note in
CONTRIBUTING.mdthat a clear description is sometimes preferred over a code PR; this branch is meant to make the intent concrete and can be re-implemented against the current code if that is easier.🤖 Generated with Codebuff