Commit Graph
21 Commits
Author SHA1 Message Date
dotCooCoo eeb5bcab7c Merge main into feat/circle-through-three-points 2026-11-16 08:26:14 -08:00
dotCooCoo 69b4f3ae96 Shape tools: Backtick held at the press measures the first copy from there
A drag that starts with Backtick already down set the copy spacing origin at the first drag event, so a short first stretch of the drag could leave no copy. The press now sets it.
2026-11-16 05:34:43 -08:00
dotCooCoo 9ecc8087c3 Shape tools: Backtick held while dragging leaves copies of the shape
Holding Backtick while dragging out a rectangle, rounded rectangle,
ellipse, polygon, star or line leaves a copy of the shape being drawn
each time the pointer has moved 8 screen points with the key down, up to
128 copies a drag. Each copy is its own object, drawn as the drag showed
it then. The release keeps the copies and the last shape as one undo
step, and Escape takes them all back. The spacing and the limit are
VectorCraft's own values.

The `backquote` descriptions of `pointer_gesture` name the shape tools.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-16 04:53:06 -08:00
BFlat 8cf9cb9dca Merge pull request #8007 from dotCooCoo/feat/line-segment-common-tangent
Line Segment: a line from one curve to another snaps to their common tangent
2026-11-16 11:38:07 +07:00
dotCooCoo fd55592167 Ellipse: a circle drawn from its center snaps its radius to touch a nearby path
With Smart Guides and Snap to Tangent on, an Alt+Shift drag with the
Ellipse tool snaps the circle's radius so that the circle touches a
nearby path, when the radius comes within the snapping tolerance of that
size. The touch point is where the line from the center meets a straight
segment or a curve square, inside a segment or at an anchor where the
path runs smoothly, including an anchor where a curve's handle lies on
the anchor. A circle can touch another circle from outside or from
inside. Corners, open path ends and curves around the same center are
not offered.

The touch point shows the "tangent" label, the radius is measured along
the Constrain Angle's axes, and Space moves the circle at the size it
snapped to, which it keeps when Space is let go. When an anchor, center or crossing is near the pointer, or
the dragged corner snapped onto one, the circle is not resized. An
ellipse without Shift is not snapped. Snap to Grid and pixel snapping
place the point instead, also when turned on during the drag, and
turning Snap to Tangent off during the drag stops the snap. A press
with a small jitter is still a click rather than a drag. Each pointer move
measures at most 256 segments near that radius.
2026-11-15 18:23:55 -08:00
dotCooCoo 6c3a092996 Line Segment: a line from one curve to another snaps to their common tangent
With Smart Guides and Snap to Tangent on, a Line Segment drag pressed
anywhere on a convex closed path with curves and dragged to within the
snapping tolerance of another such path lands on a common tangent of the
two. Both ends move to where the line touches the paths, the start sliding
along the first path. The line is the tangent whose touch point on the
second path is nearest the pointer, so moving the pointer around that path
switches between the outer tangent and the one crossing between the paths.
Each end shows the "tangent" label when Anchor/Path Labels is on, and the
line is drawn as a guide when Alignment Guides is on.

Before this change the start of a Line Segment drag always stayed where it
was pressed. It still does when Shift, Alt or Space is held, when an
anchor, center or crossing lies nearer the pointer than the second path,
when the press snapped to an anchor, center or crossing off the first path,
when Snap to Tangent is off, when Snap to Grid or pixel snapping places
drawn points, or when either path bends inward somewhere or has more than
512 segments.

The tangents come from the Common Tangents geometry. Each pointer move
looks at the 16 nearest closed subpaths within the snapping tolerance and
keeps the tangents of up to 64 pairs for the rest of the drag.
2026-11-15 16:19:42 -08:00
dotCooCoo 5f33c7d7f3 Shapes: Escape during the third Shift-click drops the press
With two points placed, Escape pressed while the third Shift-click is
held now drops the points and the press, so the release draws no circle.
2026-11-15 12:13:53 -08:00
dotCooCoo 78b1c6bf09 Shapes: draw the circle through three points
shape.circleThroughPoints draws the circle whose edge passes through
three points, as a live ellipse with the current paint, in one undo
step. The points come from `points` or, when it is left out, from the
three selected anchor points: anchor points selected with Direct
Selection, or all the anchor points of a path selected whole. The ends
of selected segments do not count. The result gives the circle's
center and radius. The circle is not pixel-aligned, even while Align
New Objects to Pixel Grid is on, so it stays through the points.

Two points that are the same, or three on one line (twice the
triangle's area at most 1e-10 of its longest side squared), are
refused with a message and nothing is drawn. The center is computed
from the corner opposite the longest side, so nearly collinear points
and points far from the origin keep their precision.

With the Ellipse tool, the first two Shift-clicks place points and the
third draws the circle through the three. After two points the tool
previews the circle through the snapped pointer as a dashed outline;
the preview goes when the pointer leaves the canvas. Once a point is
placed, a Shift-click on the selection's handles or shape widgets
places a point too. Escape, a click without Shift, a drag, a press
without Shift on the selection or a shape widget, and an edit, Undo or
Redo made outside the tool remove the points placed so far. A
Shift-click without a drag used to open the size dialog, as a plain
click does; a plain click still opens it, and so does a Shift-click
while the perspective grid shows with an active plane, so that shape
still goes on the plane.

Docs: docs/mcp.md, ROADMAP. Messages translated in the 24 catalogs
with complete messages.
2026-11-15 11:09:55 -08:00
dotCooCoo a17acb852f Selection: Show Bounding Box While Moving and Drawing shows the box during moves and shape drawing
The new General preference Show Bounding Box While Moving and Drawing
(`boundingBoxWhileMovingAndDrawing`, off by default) keeps the bounding
box and its handles visible during two kinds of drag, with View › Show
Bounding Box on. While a drag moves the selection (a Selection tool
move, an Alt-drag copy, or a shape tool's move by the center point),
the box is drawn where the drag has moved the selection. The box is
measured once when the drag starts and offset by each step's move.
While the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools
draw a shape, the box is drawn around the shape. A rotation and a
widget drag still hide the box until the release. The Line Segment
tool, the Pen, the Pencil and the Paintbrush draw no box.

With the preference off, the box hides during a move (#737, for #712)
and while a shape is drawn (#5839), as before. A Selection tool move
with Real-time Drawing off still moves the box with the pointer, and a
shape tool's move by the center point hides it in both modes.

With Real-time Drawing off, the box of a shape being drawn is measured
from the pending preview, in the color of the layer the shape goes on.
A shape being drawn shows no box until a preview step has succeeded,
so a failed preview does not show the box of the selection from before
the drag. The preference's label has a row in every catalog.

Session::deferred_move() is replaced by Session::move_drag_box(), which
returns the moved box, and Session::deferred_transform_box() now also
returns the layer color of the box.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-12 08:28:21 -08:00
dotCooCoo 7c90c6e93d Shape tools: a press scales only on the drawn handle square
A shape tool now takes a press as a bounding-box handle's only on the
drawn handle square, kept square to the screen: 3 screen points from the
handle's centre along each axis at the default Anchor Size, a half point
more or less per step. A press just beside a handle draws a new shape.

drawing_gestures_snap_to_smart_guides started its second rectangle on the
first rectangle's corner handle, which stays selected; it now deselects
first.
2026-11-11 17:57:08 -08:00
dotCooCoo b576a4e39a Shape tools: a drag on a bounding-box handle scales the selection
Since #5839 the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star
tools draw the selection's bounding box with its eight handles, but a
press on a handle drew a new shape from it. A shape just drawn could not
be resized without switching to the Selection tool.

A press on a handle now scales the selection as the Selection tool's
handles do: the same cursors, snapping, Shift and Alt, Use Preview
Bounds, area type frames and Backtick for patterns. The box stays on
show at the changing bounds during the drag. With the bounding box
hidden, a press there still draws.

Docs: docs/target-app-parity.md.
2026-11-11 15:07:21 -08:00
dotCooCoo ed3429dace Merge main into fix/shape-escape-restores-options 2026-11-08 17:13:57 -08:00
FractalEncrypt 6d3c0fef99 Shape tools: guides take the centre point's pointer too, and more regressions
The Selection tool's cursor now checks the ruler guides before a selected
object's centre point, as a press does. Tests: a ruler guide under the centre
point keeps the pointer and drags; on a box too thin for its centre to clear the
handles the handles take both; a shape-tool move from the centre snaps and shows
the hollow arrow; and Alt pressed mid-drag copies the shape through the engine.
2026-11-07 05:15:04 +07:00
FractalEncrypt c36971afe9 Shape tools: the centre point's cursor comes after the box's handles
The Selection tool's cursor now checks the bounding-box handles before a
selected object's centre point, as a press does (on a thin box the centre lies
within a handle's reach). The shape tools' tests cover a Live Corners widget
that lands on another selected shape's centre (the widget rounds), Alt pressed
mid-drag (the preview copies and the copy cursor shows), and the engine tests
check the copy's place and both gestures' Undo and Redo. The cursor catalog says
which arrow a drag of the selection shows.
2026-11-07 05:15:03 +07:00
FractalEncrypt cd88b15912 Shape tools: review follow-ups (Shift, handle boundary, cursor order, feedback)
- The Selection tool takes a Shift-press on a selected object's centre point
  too: a Shift-drag moves the selection held to 45° steps, and a Shift-click
  there takes the object out of the selection, as a Shift-press on the object
  does.
- One rotate zone for the Selection tool and the shape tools
  (`select::rotate_zone`): a press on a bounding-box handle is not a turn, so
  the shape tools' zone matches the Selection tool's classification exactly.
- The shape tools' hover cursor follows the press order (corner and pie widgets,
  then the centre point, then the rotate zone), and a move of the selection
  shows the Selection tool's feedback: SelectionCopy with Alt, ArrowHollow while
  it snaps.
- Engine-level tests for the whole gesture (`crates/engine/src/tests/shapetools.rs`):
  repeated previews and one undo step, Alt copy, Escape then release, a turn
  about the centre, the corner widget still rounding, and an unfilled shape
  moved by the Selection tool.
- docs: evidence in target-app-parity.md's Shapes bullet and the M2 milestone,
  and the Move cursor's entry names the copy and snap cursors.
2026-11-07 05:15:03 +07:00
FractalEncrypt adbcb3a224 Shape tools: the selection moves from its centre point and turns outside a corner
A shape just drawn keeps its bounding box with the Rectangle, Rounded Rectangle,
Ellipse, Polygon and Star tools, but its centre point (Attributes › Show Center)
did nothing and the box's handles only drew: a press anywhere started a new
shape, and with the Selection tool a press on the centre of an unfilled shape
started a marquee.

- The Selection tool now takes a press on a selected object's centre point as
  the start of a move (held by that point, so it snaps and Alt copies), as
  Direct Selection has since #4891. A click there still makes the object the
  key object of a multi-selection.
- The shape tools take it too, and take a press in the rotate zone just outside
  a bounding-box corner (the Selection tool's own zone and cursor) as the start
  of a rotation about the box's centre. Live Corners widgets keep the corners
  themselves, so a press on a corner still rounds it; every other press still
  draws a new shape. Escape cancels, as for the Selection tool's drags.

`hit_center` moves from direct.rs to select.rs, shared by the three tools.
2026-11-07 05:15:02 +07:00
Don Omondi 87a656cdef Shape tools: a shape just drawn shows its bounding box and Live Shape widgets, and its corner and pie widgets drag with the shape tool (#5477) 2026-11-06 01:50:55 +07:00
dotCooCoo 2f2d2255ad Drawing tools: Escape on a polygon, star or rounded rectangle drag puts back the option it changed
While a polygon, star or rounded rectangle is dragged out, Up and Down
change its side count, point count or corner radius, and Ctrl/Cmd on a
star changes its inner-to-outer ratio. Escape canceled the drag but kept
those values, so the next drag and the tool's options started from a
shape that was never made.

- ShapeTool keeps those options as they were when the drag began and
  Escape puts them back. A drag that is let go keeps the changed values.
  An option set with tool.setOption during the drag stays.
- Session::tool_key saves the tool's options when a key cancels a
  gesture, so the saved options and General > Corner Radius hold the
  values Escape put back.
- docs/target-app-parity.md has one line for it.
2026-11-01 18:37:11 -08:00
dotCooCoo 4651e80973 Star tool: Ctrl/Cmd holds the inner radius the star shows when the key goes down
The reference app keeps the inner radius of a star constant when Ctrl
or Command is held after the drag starts. VectorCraft's Star tool took
the held radius from the first drag event that carried the key, using
that event's outer radius. The canvas sends a drag only once the
pointer moves, so a key pressed with the pointer still scaled the
inner radius with the next move before holding it.

Ctrl/Cmd now holds the inner radius the star showed at the last drag
position before the key went down, with Alt's straight shoulders when
Alt was held. A new press and Escape clear the held radius. Before,
after a drag canceled with Escape, the next star took the canceled
star's inner radius when Ctrl/Cmd went down before that star's first
drag event.

Docs: docs/target-app-parity.md.
2026-10-29 11:07:53 +07:00
aiongg f1d427762b style: cargo fmt on files moved without formatting 2026-10-26 19:32:10 +00:00
aiongg 8bafcb0444 refactor(tools): move shape.rs tests to shape/tests.rs 2026-10-26 18:18:18 +00:00