diff --git a/crates/engine/src/tests/quickpen.rs b/crates/engine/src/tests/quickpen.rs index 754dda7e42..375f648ac8 100644 --- a/crates/engine/src/tests/quickpen.rs +++ b/crates/engine/src/tests/quickpen.rs @@ -794,6 +794,33 @@ fn a_hovered_arc_shows_the_protractor_with_the_rubber_band() { } } +/// The two arms of a cross centered on `c` among the overlays. +fn crosses_at(o: &[Overlay], c: Point) -> usize { + o.iter().filter(|o| matches!(o, Overlay::Line { a, b, .. } if a.midpoint(*b).distance(c) < 1e-9)).count() +} + +/// While a half circle from (200, 100) to (300, 100) is dragged, or is the piece the next click +/// adds, the tool shows a cross at its center, (250, 100); while a line is dragged, it shows none. +#[test] +fn an_arc_shows_a_cross_at_its_center() { + let mut s = session(); + quick_pen(&mut s); + let center = pt(250.0, 100.0); + for (action, arms) in [("line", 0), ("sharpArc", 2)] { + key(&mut s, ToolKey::Escape); + s.set_tool_option_cmd(&json!({"tool": "quickPen", "key": "action", "value": "line"})).unwrap(); + click(&mut s, 100.0, 100.0); + click(&mut s, 200.0, 100.0); + s.set_tool_option_cmd(&json!({"tool": "quickPen", "key": "action", "value": action})).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Move, 300.0, 100.0), view()).unwrap(); + assert_eq!(crosses_at(&s.overlays(view()), center), arms, "hovering, {action}"); + s.pointer(&PointerEvent::new(PointerKind::Down, 280.0, 150.0), view()).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Drag, 300.0, 100.0), view()).unwrap(); + assert_eq!(crosses_at(&s.overlays(view()), center), arms, "dragging, {action}"); + s.pointer(&PointerEvent::new(PointerKind::Up, 300.0, 100.0), view()).unwrap(); + } +} + /// With Measurement Labels on, hovering after the path's last point shows the distance label /// beside the pointer; with them off, no label shows. #[test] diff --git a/crates/tools/src/quickpen.rs b/crates/tools/src/quickpen.rs index 7acef24638..2e5eb61491 100644 --- a/crates/tools/src/quickpen.rs +++ b/crates/tools/src/quickpen.rs @@ -15,16 +15,16 @@ //! //! While an arc is drawn, by a drag or as the piece the next click adds, the tool shows a //! protractor around the arc's center: a tick across its circle every 15° from where the arc -//! starts, a longer one every 90°, and one where it ends. The piece the next click adds shows its -//! protractor only while the Pen tool's rubber band preference shows that piece. With Smart Guides -//! on, the end of a continuous arc goes onto the nearest tick of that protractor when the tick lies -//! within the snapping tolerance of the pointer, no other Smart Guide snaps the point, and neither -//! the grid nor pixels snap drawn points. A sharp-corner arc, and a continuous arc that has no -//! direction to follow, sweep the arc size, so their ends are not snapped to a tick. After a snap -//! setting changes under a still pointer, the hover's preview, protractor, distance label and -//! Smart Guides are hidden until the pointer moves; when the view, the document or the selection -//! changes, the canvas hovers the still pointer again. Shift does not constrain Quick Pen points, -//! so it does not change the snapping. +//! starts, a longer one every 90°, and one where it ends, with a small cross at the center. The +//! piece the next click adds shows its protractor only while the Pen tool's rubber band preference +//! shows that piece. With Smart Guides on, the end of a continuous arc goes onto the nearest tick +//! of that protractor when the tick lies within the snapping tolerance of the pointer, no other +//! Smart Guide snaps the point, and neither the grid nor pixels snap drawn points. A sharp-corner +//! arc, and a continuous arc that has no direction to follow, sweep the arc size, so their ends are +//! not snapped to a tick. After a snap setting changes under a still pointer, the hover's preview, +//! protractor, distance label and Smart Guides are hidden until the pointer moves; when the view, +//! the document or the selection changes, the canvas hovers the still pointer again. Shift does +//! not constrain Quick Pen points, so it does not change the snapping. use std::f64::consts::{FRAC_PI_2, PI}; use std::sync::Arc; @@ -53,6 +53,8 @@ pub const MAX_TURN: f64 = 359.0; pub const TICK_STEP: f64 = 15.0; /// Half the length (screen points) of a protractor tick; the ticks every 90° are twice as long. const TICK_PX: f64 = 4.0; +/// Half the length (screen points) of each arm of the cross at an arc's center. +const CROSS_PX: f64 = 4.0; /// Screen points the pointer moves after a press before the press drags. const DRAG_PX: f64 = 3.0; /// A continuous arc whose end lies within this angle (radians) of straight ahead, or of straight @@ -871,6 +873,9 @@ impl Tool for QuickPenTool { }; if let Some(arc) = arc { o.push(Overlay::Path { path: protractor(cx, &arc), color: FEEDBACK, width: 1.0, dashed: false }); + let (c, arm) = (arc.center, cx.tol(CROSS_PX)); + o.push(Overlay::Line { a: c - Vec2::new(arm, 0.0), b: c + Vec2::new(arm, 0.0), color: FEEDBACK, dashed: false }); + o.push(Overlay::Line { a: c - Vec2::new(0.0, arm), b: c + Vec2::new(0.0, arm), color: FEEDBACK, dashed: false }); } if self.press.is_none() && !self.hover_stale(cx) diff --git a/docs/mcp.md b/docs/mcp.md index 5410fe7622..7e71701baa 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7446,7 +7446,8 @@ setting (Smart Guides, Snap to Point, Snap to Grid, Snap to Pixel or a snapping pointer, the hover's preview, its protractor, its distance label and its Smart Guides are hidden until the pointer moves. When the view, the document or the selection changes, the canvas hovers the still pointer again. Shift does not constrain Quick Pen points, so it does not change the tick snapping. The -protractor, its 15° step and the tick snapping are VectorCraft's own behavior. +protractor, its 15° step and the tick snapping are VectorCraft's own behavior. A small cross marks the arc's center +wherever the protractor shows; the cross is VectorCraft's own behavior too. Selecting the tool shows its toolbar on the canvas: Straight Line, Continuous Arc and Sharp Corner Arc set `action`, Flip Arc flips the last sharp-corner arc as C does (`tool.quickPen.flipArc {}`, which first finishes any pending tool edit, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3f6c8b9ba8..0fcb58e2c0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -645,6 +645,7 @@ since 2026-10-01. - **Recolor picker follow-up (#8031/#4028):** native Lab numeric entry, document/loaded-library swatches in the Color Picker, and Assign-row Pick from Swatches / Limit to Library menus. #4090 provided the double-click picker and #5113 the Assign sliders. Regression tests `native_lab_entry_in_color_picker` and `row_context_menu_pick_from_swatches_and_limit_to_library` exercise the fields and menu callbacks rather than writing their result state. Area score and hours unchanged. - **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` change the arc size by 15°, a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps, the side an arc bulges to, a dragged piece ending where the press is let go, and C, `[` and `]` changing the arc being dragged are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests`, `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action` and `brackets_size_the_quick_pen_arc_being_dragged`. Score and hours unchanged. - **Quick Pen protractor:** while an arc is drawn, by a drag or as the piece the next click adds, the Quick Pen tool shows a protractor around the arc's center: a tick every 15° from the arc's start, a longer one every 90°, and one at its end; the next click's piece shows it only with Enable Rubber Band for the Pen tool on. With Smart Guides on, the end of a continuous arc snaps onto the nearest tick within the snapping tolerance of the pointer when no other Smart Guide snaps the point and neither Snap to Grid nor Snap to Pixel snaps drawn points; Shift does not change it. A continuous arc that starts a path sweeps the arc size and does not snap to a tick, Alt tapped during a press moves the piece's end onto or off the tick for the new action, and a hover hides its preview after a snap setting changes until the pointer moves. The protractor, its 15° step and the tick snapping are VectorCraft's own behavior. Tests: tools `the_arc_circle_is_the_circle_the_arc_is_drawn_on`, `a_continuous_arc_end_goes_to_the_nearest_tick`, `a_tick_past_the_coordinate_limit_is_not_used`, `a_continuous_arc_without_a_direction_has_no_tick`, `the_protractor_ticks_lie_across_the_arc`; engine `a_continuous_arc_end_snaps_to_the_protractor`, `a_click_puts_a_continuous_arc_end_on_a_tick`, `an_alt_tap_during_a_press_moves_the_end_for_the_new_action`, `a_click_on_a_tick_leaves_no_preview_back_to_the_pointer`, `a_hover_snaps_to_a_tick_only_for_a_continuous_arc`, `a_hover_shows_nothing_after_smart_guides_change`, `a_click_that_adds_nothing_keeps_a_stale_hover_hidden`, `a_hover_is_hovered_again_when_the_art_changes`, `an_arc_drag_shows_the_protractor`, `a_hovered_arc_shows_the_protractor_with_the_rubber_band`. New tests of existing Quick Pen behavior: `a_point_snaps_to_a_smart_guide`, `hovering_shows_the_distance_label`. Score and hours unchanged. +- **Quick Pen arc center:** wherever the Quick Pen tool shows an arc's protractor, it also marks the arc's center with a small cross. The cross is VectorCraft's own behavior. Test: engine `an_arc_shows_a_cross_at_its_center`. Score and hours unchanged. - **Optional compact Tools (#7234):** Window > Toolbars > Compact Tools reduces row and column spacing and the main panel's allocated width in one or two columns, docked or floating. The setting is saved with the UI state and applies to Basic, Advanced and edited main Tools layouts; the selected tool, icon size, footer controls and tool-flyout behavior are retained. Turning it off restores the existing layout, which remains the default. Named custom toolbars and flyout spacing are unchanged. Public regressions in `crates/ui-egui/tests/toolbar_compact.rs` cover the actual toolbar layout against the default control, the command and saved-state roundtrip, tool selection, flyouts, footer controls and short-window reachability. This is an optional layout choice, without a styling-parity or score claim; hours are unchanged.