From a53b820b85af2ebd26a33d98175ba694f5569b98 Mon Sep 17 00:00:00 2001 From: Deepfold <45855410+deepfold9118@users.noreply.github.com> Date: Sun, 22 Nov 2026 23:29:10 -0600 Subject: [PATCH] =?UTF-8?q?Anchor=20Point:=20Shift=20keeps=20handles=20pul?= =?UTF-8?q?led=20out=20of=20an=20anchor=20at=2045=C2=B0=20steps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dragging from an anchor with the Anchor Point tool pulls out smooth handles, but Shift pressed during that drag did nothing: the handles kept following the pointer at any angle. The tool's other drags already honour Shift (a handle drag at 45° steps round its anchor, a Shift-press moving the anchor at 45° steps, a segment drag making the handles perpendicular), as does the Pen when it pulls a handle out. With Shift held, the Convert and SpineConvert previews now send the pointer constrained round the anchor with constrain_angle_from(.., 45, Constrain Angle), the rule HandleSnap::snap and the Pen use. Shift at the press still moves the anchor instead; releasing Shift frees the handles again. No engine command changes. Docs: docs/ui-parity.md, docs/target-app-parity.md. Co-Authored-By: Claude Opus 5.5 --- crates/tools/src/draw2/anchor.rs | 45 ++++++++++++++++++++------ crates/tools/src/draw2/anchor/tests.rs | 38 ++++++++++++++++++++++ docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 4 files changed, 76 insertions(+), 11 deletions(-) diff --git a/crates/tools/src/draw2/anchor.rs b/crates/tools/src/draw2/anchor.rs index 66e2eea0b0..25f052f122 100644 --- a/crates/tools/src/draw2/anchor.rs +++ b/crates/tools/src/draw2/anchor.rs @@ -2,7 +2,8 @@ //! //! Add: click a segment to insert an anchor without changing the shape (Alt = delete). //! Delete: click an anchor to remove it, re-fitting the neighbouring curve (Alt = add). -//! Anchor Point: click a smooth anchor → corner; drag an anchor → pull out smooth handles; click a +//! Anchor Point: click a smooth anchor → corner; drag an anchor → pull out smooth handles (Shift +//! pressed once the drag is under way: at 45° steps round the anchor); click a //! handle end → retract that handle only (#2267); drag a handle → move it independently (Shift: at //! 45° steps round its anchor; Alt: link it with the opposite handle, the anchor made smooth, except //! when the Pen lends the tool); drag a segment → reshape the curve, a selected blend's spine's too, @@ -278,6 +279,24 @@ impl AnchorTool { cx.doc.node(id).and_then(|n| n.path_data()).and_then(|pd| pd.subpaths.get(si)?.anchors.get(ai).map(|a| a.p)) } + /// Where a selected blend's spine point `ai` is. + fn spine_pos(cx: &ToolContext, id: NodeId, ai: usize) -> Option { + crate::direct::spines(cx) + .into_iter() + .find(|(blend, _)| *blend == id) + .and_then(|(_, path)| path.subpaths.first()?.anchors.get(ai).map(|a| a.p)) + } + + /// Where handles pulled out of an anchor to `p` go: with Shift held, at 45° steps round the + /// anchor (`anchor` finds it) from General › Constrain Angle, as the Pen pulls handles out; + /// otherwise, or when the anchor is gone, `p`. + fn pulled_out(cx: &ToolContext, p: Point, shift: bool, anchor: impl FnOnce() -> Option) -> Point { + if !shift { + return p; + } + anchor().map_or(p, |a| a + constrain_angle_from(p - a, 45.0, cx.constrain_angle)) + } + /// Nearest point of this eligible spine, in document coordinates. fn spine_point(path: &vectorcraft_geom::PathData, p: Point, tol: f64) -> Option { path.anchors() @@ -582,10 +601,15 @@ impl Tool for AnchorTool { } let preview = match self.state { State::Idle => return out, - State::Convert { id, si, ai, .. } => Action::Preview( - "path.convertAnchor".into(), - json!({"id": id.0, "subpath": si, "anchor": ai, "to": "smooth", "x": p.x, "y": p.y}), - ), + State::Convert { id, si, ai, .. } => { + // Shift pressed once the drag is under way keeps the pulled-out handles at + // 45° steps; Shift at the press moved the anchor instead (`moving`). + let q = Self::pulled_out(cx, p, ev.mods.shift, || Self::anchor_pos(cx, id, si, ai)); + Action::Preview( + "path.convertAnchor".into(), + json!({"id": id.0, "subpath": si, "anchor": ai, "to": "smooth", "x": q.x, "y": q.y}), + ) + } State::Move { id, si, ai, from, start, .. } => { let d = Self::move_delta(cx, start, p, ev.mods.shift); self.measure = Some((p, d.x, d.y)); @@ -598,10 +622,13 @@ impl Tool for AnchorTool { let q = from + d; Action::Preview("object.blend.spine.moveAnchor".into(), json!({"id": id.0, "anchor": ai, "x": q.x, "y": q.y})) } - State::SpineConvert { id, ai, .. } => Action::Preview( - "object.blend.spine.convertAnchor".into(), - json!({"id": id.0, "anchor": ai, "to": "smooth", "x": p.x, "y": p.y}), - ), + State::SpineConvert { id, ai, .. } => { + let q = Self::pulled_out(cx, p, ev.mods.shift, || Self::spine_pos(cx, id, ai)); + Action::Preview( + "object.blend.spine.convertAnchor".into(), + json!({"id": id.0, "anchor": ai, "to": "smooth", "x": q.x, "y": q.y}), + ) + } State::SpineHandle { id, ai, out, .. } => { // Shift keeps the handle at 45-degree steps round its anchor, as for // ordinary Anchor Point handles. The spine anchor is a blend point, not diff --git a/crates/tools/src/draw2/anchor/tests.rs b/crates/tools/src/draw2/anchor/tests.rs index d6d4896526..4f1685812d 100644 --- a/crates/tools/src/draw2/anchor/tests.rs +++ b/crates/tools/src/draw2/anchor/tests.rs @@ -821,6 +821,44 @@ fn anchor_point_shift_drag_moves_the_anchor() { assert!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 200.0, 300.0).with_mods(shift)).is_empty()); } +/// Shift pressed once a drag from an anchor is under way keeps the handles it pulls out at 45° +/// steps round the anchor, on a path and on a selected blend's spine; released, it frees them. +#[test] +fn anchor_point_shift_mid_drag_constrains_pulled_out_handles() { + let shift = Mods { shift: true, ..Mods::default() }; + // The handle point a drag's preview gives `cmd`. + let target = |a: &[Action], cmd: &str| match a.last() { + Some(Action::Preview(c, v)) if c == cmd => v["x"].as_f64().zip(v["y"].as_f64()).map(|(x, y)| Point::new(x, y)), + _ => None, + }; + // The rectangle's corner at (100, 100). + let (d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let mut t = AnchorTool::new("anchorPoint"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 140.0, 92.0)); + assert_eq!(target(&a, "path.convertAnchor"), Some(Point::new(140.0, 92.0)), "free without Shift: {a:?}"); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 140.0, 92.0).with_mods(shift)); + let q = target(&a, "path.convertAnchor").unwrap_or_default(); + assert!((q.y - 100.0).abs() < 1e-9 && q.x > 100.0, "level with the anchor: {a:?}"); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 106.0, 140.0).with_mods(shift)); + let q = target(&a, "path.convertAnchor").unwrap_or_default(); + assert!((q.x - 100.0).abs() < 1e-9 && q.y > 100.0, "straight below the anchor: {a:?}"); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 106.0, 140.0)); + assert_eq!(target(&a, "path.convertAnchor"), Some(Point::new(106.0, 140.0)), "free again once Shift is up: {a:?}"); + assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 106.0, 140.0)), vec![Action::Commit]); + // A selected blend's spine corner at (160, 310). + let (d, _, sel) = blend_spine_doc(false); + let c = cx(&d, &sel, &p); + let mut t = AnchorTool::new("anchorPoint"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 160.0, 310.0)); + t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 160.0, 340.0)); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 200.0, 318.0).with_mods(shift)); + let q = target(&a, "object.blend.spine.convertAnchor").unwrap_or_default(); + assert!((q.y - 310.0).abs() < 1e-9 && q.x > 160.0, "level with the spine point: {a:?}"); +} + /// #3694: Space held mid-drag on a convert moves the anchor, handles and all. #[test] fn anchor_point_space_mid_drag_moves_the_anchor() { diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e84ce63592..8b790b2be0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1500,7 +1500,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Group Selection (#2441):** a click picks one path of a compound path (its outline within the pick tolerance, else the innermost path whose area holds the click: the outer shape or a hole), Shift-click adds another, and a click on a selected path adds the compound path, as a click on a group member climbs to its group. A path selected this way moves, rotates and scales on its own; paint still goes to the compound path. With Direct Selection, an Alt-click on a path selected whole adds its group, and each further Alt-click adds the next group up, as Group Selection's clicks do; the climb stops below the layer and its sublayers and at the isolated object. An Alt-drag still copies the selection, and Alt+Shift-click on a segment or the fill still adds or removes the path. Public references: [Select objects](https://web.archive.org/web/20250904012025/https://helpx.adobe.com/illustrator/using/selecting-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copies). With Alt held at the press, a Direct Selection marquee is Group Selection's for the drag: it selects every path it touches, whole (Shift toggles them), not the anchors inside it, and the Group Selection pointer stays until the release (#4890; test `an_alt_marquee_selects_the_paths_it_touches_whole`). - With Direct Selection, Shift pressed during the drag of a curved segment keeps both of its handles at right angles to the line between its anchors, on the same side and at the same length (`path.reshapeSegment {perpendicular}`). Shift held while any segment is dragged with the Anchor Point tool or the Pen with Alt does the same. With the Anchor Point tool, Shift held at the press on an anchor (or a selected blend's spine point) moves it, handles and all, instead of pulling out handles; Shift kept down keeps the move at 45° steps, and a Shift-click that doesn't move leaves the anchor as it was (`path.moveAnchor`). A selected blend spine's segment dragged with the Anchor Point tool, or a curved one dragged with Direct Selection, bends the same way (`object.blend.spine.reshapeSegment`). + With Direct Selection, Shift pressed during the drag of a curved segment keeps both of its handles at right angles to the line between its anchors, on the same side and at the same length (`path.reshapeSegment {perpendicular}`). Shift held while any segment is dragged with the Anchor Point tool or the Pen with Alt does the same. With the Anchor Point tool, Shift held at the press on an anchor (or a selected blend's spine point) moves it, handles and all, instead of pulling out handles; Shift kept down keeps the move at 45° steps, and a Shift-click that doesn't move leaves the anchor as it was (`path.moveAnchor`). Shift pressed once a drag from an anchor (or a spine point) is under way keeps the handles it pulls out at 45° steps round the anchor from the Constrain Angle, as with the Pen, and released frees them. A selected blend spine's segment dragged with the Anchor Point tool, or a curved one dragged with Direct Selection, bends the same way (`object.blend.spine.reshapeSegment`). - **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). A link toggle behind Corner Radius (the `singleCornerRadius` preference) switches the panels to a field for each corner of a live rectangle: Top Left, Top Right, Bottom Right and Bottom Left. Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two sides meet at an angle at an anchor that isn't smooth: curved sides too, trimmed to what the cut leaves of them (#1144). Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply. With Direct Selection a click on a widget (no drag) selects its corner, as a click on the corner's anchor does, so the next drag on it rounds that corner alone; Shift-click toggles it (#1239). While a corner widget is dragged with the Selection tool the bounding box hides, so the rounding shows against the path alone (#1229). A round corner next to a curved side curves smoothly instead of sticking out of the shape (#1547, fixes #1512). View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them. - **Rectangle Properties corner type:** a live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Corner menu with Round, Inverted Round and Chamfer. With Corner Radius linked, one menu sets the kind of every corner of each selected rectangle, also corners with no radius, and shows blank when the shown rectangle's kinds differ; unlinked, each corner's row has its own menu beside its radius field, or under it in a panel too narrow for both; the unlinked radius fields and menus leave other selected paths and polygons as they are. A pick is one undo step, and picking the kind the corners already have adds none (`object.setLiveShape {kind, rectanglesOnly, corners}`); an action that records them acts on the rectangles selected when it plays. The help page says a rectangle's corner type can be set for each corner or for all of them at once ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)); tying the number of menus to the Corner Radius link, the blank value and the undo steps are VectorCraft's own rules (`a_rectangle_shows_linked_and_unlinked_corner_types`, `the_shape_properties_popup_changes_a_rectangle_corner_type`, `the_linked_corner_menu_sets_every_selected_rectangle`, `the_unlinked_corner_menus_fit_a_narrow_panel`, `an_unlinked_corner_radius_leaves_other_selected_shapes`, `a_rectangle_corner_kind_without_a_selected_rectangle_changes_nothing`, `rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo`, `rectangles_only_sets_the_selected_rectangles_when_an_action_plays`, `a_radius_reaches_a_rectangle_that_already_draws_it`). diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e9fd857a9d..1d511ab176 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -222,7 +222,7 @@ tools, never checked side by side) isn't captured row by row. | Blend spine Anchor Point conversion and handle editing (#2544) | implemented | symmetric handles, independent drag/retraction, visible-handle policy and selection/stacking covered by tool and engine regressions; Windows native canvas checks and screenshots reviewed in PR #2643 | | Blend Replace Spine, move and Undo redraw (#5179) | CPU regression-tested | Renderer damage bounds include keys and steps rotated along a curved spine. Both original straight and curved CPU regressions pass, checking full-frame agreement and that every changed pixel lies inside the advertised redraw area. | | Several blend spine points picked and dragged together (#5285) | done | with Direct Selection, Shift-click picks more points of a selected blend's spine or takes one away, as on a path; dragging any picked point moves them all, and the key objects on them, in one undo step (`object.blend.spine.moveAnchor {with}`); a marquee picks the spine points inside it on the topmost selected blend, and with Shift adds or takes them away | -| Add/Delete/Anchor Point tools; Anchor Point tool drags segments to reshape | done | #2267: a click on a handle end retracts that handle and leaves the anchor a corner with the other one; Shift held at the press on an anchor moves it, handles and all (Shift kept down: at 45° steps) instead of pulling out handles; Alt held while dragging a handle links it with the opposite handle and makes the anchor smooth, on a blend's spine too | +| Add/Delete/Anchor Point tools; Anchor Point tool drags segments to reshape | done | #2267: a click on a handle end retracts that handle and leaves the anchor a corner with the other one; Shift held at the press on an anchor moves it, handles and all (Shift kept down: at 45° steps) instead of pulling out handles; Shift pressed once a drag from an anchor is under way keeps the handles it pulls out at 45° steps round the anchor, on a blend's spine too; Alt held while dragging a handle links it with the opposite handle and makes the anchor smooth, on a blend's spine too | | Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity is in screen pixels, the same at any zoom, and goes down to 0.01 px in the dialog and the tool, which sends `path.freehand` the value in points at the current zoom (#5729; the Smooth tool keeps 0.05 pt); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 px, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 px, tenths up to 1 px and whole pixels above (Shift ×10) (#3328); Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor (a short level line) while Shift or Alt is held before the press, and a path-continuation cursor (a short rising line) over an end of a selected open path, where the stroke continues the path, freehand or straight, and while a continuing stroke ends near an open end of another selected path it connects to; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, or a stroke continuing a selected path (a straight line too) to within it of that path's other end, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path; a Pencil stroke from an end of one selected open path to an end of another connects the two into one path | | Drop Shadow, Outer Glow and Inner Glow: Opacity, the offsets, Blur and Darkness have spinner arrows that step by one (a unit for distances), repeat when held and stop at the fields' ends (#5367, #5368) | done | dialogs::effect test drop_shadow_and_outer_glow_fields_have_spinner_arrows; other effect dialogs' number fields still have none | | Effect dialogs' colour fields: a swatch beside the hex follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills it and Cancel comes back unchanged (#5365) | done | dialogs::effect tests outer_glow_colour_swatch_opens_the_color_picker and drop_shadow_colour_swatch_opens_the_color_picker (Drop Shadow's Color, #5364); the picker previews nothing itself, the effect dialog previews the returned colour |