mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 20:01:07 +01:00
Transform: Polygon Properties' Sides row has a 3 to 20 slider beside the field
The Sides field of Polygon Properties (Transform panel, the Properties panel's Transform section and the task bar's Shape Properties) gets a slider after it over 3 to 20 sides, as the help page describes (https://helpx.adobe.com/illustrator/using/live-shapes.html); the field still takes 3 to 1000. - A drag previews the count through object.setLiveShape {sides} and its release adds one undo step, none when it ends at its starting count. Escape during the drag puts the count back. A click or an arrow key on the rail sets the count in one undo step. - A count above 20 shows the handle at the rail's right end; the field and screen readers show the real count until the rail moves. - A drag whose rows stop being drawn keeps its preview as one undo step at the end of that frame.
This commit is contained in:
1 parent
063f550802
commit
0ddd5539ad
4 files changed
+319
-6
No files matched your search
@@ -654,6 +654,7 @@ impl VectorcraftApp {
|
||||
crate::toasts::show(self, &ctx);
|
||||
// After every panel had its chance to draw in this pass.
|
||||
crate::panels::three_d::end_stale_drag(self, &ctx);
|
||||
panels::transform::end_stale_sides_drag(self, &ctx);
|
||||
if self.custom_titlebar {
|
||||
titlebar::resize_zones(ui);
|
||||
}
|
||||
|
||||
@@ -588,9 +588,9 @@ fn pie_link(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// A live polygon's Polygon Properties (Transform and Properties panels): its side count, angle
|
||||
/// (counterclockwise), corner type and radius, radius (centre to vertex) and side length, and Make
|
||||
/// Sides Equal, which an uneven scale enables.
|
||||
/// A live polygon's Polygon Properties (Transform and Properties panels): its side count (a field
|
||||
/// and [`sides_slider`]), angle (counterclockwise), corner type and radius, radius (center to
|
||||
/// vertex) and side length, and Make Sides Equal, which an uneven scale enables.
|
||||
pub(crate) fn polygon_rows(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, live: &LiveShape, id: &str) {
|
||||
let LiveShape::Polygon { sides, .. } = live else { return };
|
||||
let (units, fw) = (app.session.general_unit(), super::field_width(ui));
|
||||
@@ -603,9 +603,12 @@ pub(crate) fn polygon_rows(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, live
|
||||
let mut set = None;
|
||||
egui::Grid::new((id, "grid")).num_columns(2).spacing([6.0, 6.0]).show(ui, |ui| {
|
||||
widgets::dim_label(ui, tl!("Sides:"));
|
||||
if let Some(s) = widgets::range_field_named(ui, (id, "sides"), Some(tl!("Sides:")), f64::from(*sides), 3.0..=1000.0, "", 0, fw) {
|
||||
set = Some(("sides", json!(s as u64)));
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
if let Some(s) = widgets::range_field_named(ui, (id, "sides"), Some(tl!("Sides:")), f64::from(*sides), 3.0..=1000.0, "", 0, fw) {
|
||||
set = Some(("sides", json!(s as u64)));
|
||||
}
|
||||
sides_slider(app, ui, id, *sides, fw);
|
||||
});
|
||||
ui.end_row();
|
||||
widgets::dim_label(ui, tl!("Angle:"));
|
||||
if let Some(a) = widgets::mixed_field_named(ui, (id, "angle"), Some(tl!("Angle:")), angle, "°", 1, fw) {
|
||||
@@ -641,6 +644,97 @@ pub(crate) fn polygon_rows(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, live
|
||||
}
|
||||
}
|
||||
|
||||
/// The side counts the Sides slider of Polygon Properties spans; the field beside it takes 3 to
|
||||
/// 1,000.
|
||||
pub(crate) const SIDES_SLIDER: std::ops::RangeInclusive<f64> = 3.0..=20.0;
|
||||
|
||||
/// A drag on a Sides slider in progress: the rows it is in, whether Escape canceled it (the rest
|
||||
/// of it is ignored until the button is up), and the main window's pass the rail was last drawn in.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
struct SidesDrag {
|
||||
rows: String,
|
||||
canceled: bool,
|
||||
pass: u64,
|
||||
}
|
||||
|
||||
/// Panel state key of the [`SidesDrag`] in progress.
|
||||
const SIDES_DRAG: &str = "polygon-sides-drag";
|
||||
|
||||
/// The main window's pass in progress, which a floating window's panel also marks its drag with.
|
||||
fn root_pass(ctx: &egui::Context) -> u64 {
|
||||
ctx.cumulative_pass_nr_for(egui::ViewportId::ROOT)
|
||||
}
|
||||
|
||||
/// Keeps the count a Sides slider drag previewed as one undo step when its rail was not drawn in
|
||||
/// this pass (the task bar's popover or the panel closed during the drag), so no preview stays open
|
||||
/// into a later pass; a drag Escape canceled only ends. The app runs this at the end of every
|
||||
/// pass, after the panels.
|
||||
pub(crate) fn end_stale_sides_drag(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let Some(drag) = pstate::<Option<SidesDrag>>(ctx, SIDES_DRAG) else { return };
|
||||
if drag.pass == root_pass(ctx) {
|
||||
return;
|
||||
}
|
||||
if !drag.canceled && app.session.in_interaction() {
|
||||
if let Err(e) = app.session.commit_interaction() {
|
||||
app.ui.status = e.to_string();
|
||||
}
|
||||
app.sync_views();
|
||||
}
|
||||
set_pstate(ctx, SIDES_DRAG, None::<SidesDrag>);
|
||||
}
|
||||
|
||||
/// The Sides slider of Polygon Properties (rows `id`), `width` wide, for a polygon of `sides`
|
||||
/// sides. A drag, a press on the rail included, previews the side count and its release records
|
||||
/// one undo step; Escape during the drag puts the polygon back as it was and ignores the rest of
|
||||
/// the drag. A key step sets the count at once. A count past 20 shows at the rail's right end and
|
||||
/// stays until the rail moves. Screen readers get the count the field shows.
|
||||
fn sides_slider(app: &mut VectorcraftApp, ui: &mut Ui, id: &str, sides: u32, width: f32) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let (lo, hi) = (*SIDES_SLIDER.start(), *SIDES_SLIDER.end());
|
||||
let n = f64::from(sides);
|
||||
let shown = widgets::SliderValue::field(n, SIDES_SLIDER, "", 0);
|
||||
let at = ((n.clamp(lo, hi) - lo) / (hi - lo)) as f32;
|
||||
let (dragged, phase, keyed) = widgets::color_slider_stepped(ui, (id, "sides-slider"), tl!("Sides:"), Some(shown), at, width, &|_| t.input_border);
|
||||
let ctx = ui.ctx().clone();
|
||||
let held = pstate::<Option<SidesDrag>>(&ctx, SIDES_DRAG).filter(|d| d.rows == id);
|
||||
let down = ui.input(|i| i.pointer.any_down());
|
||||
let pass = root_pass(&ctx);
|
||||
// `None` leaves another rows' drag as it is.
|
||||
let mut next = None;
|
||||
if let Some(d) = held.as_ref().filter(|d| d.canceled) {
|
||||
next = Some(down.then(|| SidesDrag { pass, ..d.clone() }));
|
||||
} else if held.is_some() && ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) {
|
||||
if let Err(e) = app.session.cancel_interaction() {
|
||||
app.ui.status = e.to_string();
|
||||
}
|
||||
app.sync_views();
|
||||
next = Some(down.then(|| SidesDrag { rows: id.to_string(), canceled: true, pass }));
|
||||
} else if let Some(x) = dragged {
|
||||
let count = (lo + f64::from(x) * (hi - lo)).round();
|
||||
super::live_run(app, "Live Shape Properties", "object.setLiveShape", json!({ "sides": count as u64 }), phase);
|
||||
next = Some((phase == widgets::Live::Dragging).then(|| SidesDrag { rows: id.to_string(), canceled: false, pass }));
|
||||
} else if let Some(k) = keyed.map(f64::round).filter(|k| *k != n) {
|
||||
app.run("object.setLiveShape", json!({ "sides": k as u64 })).ok();
|
||||
} else if let Some(d) = held {
|
||||
if down {
|
||||
next = Some(Some(SidesDrag { pass, ..d }));
|
||||
} else {
|
||||
// The button is up but the rail reported no release: keep the preview as a release
|
||||
// on the rail would.
|
||||
if app.session.in_interaction() {
|
||||
if let Err(e) = app.session.commit_interaction() {
|
||||
app.ui.status = e.to_string();
|
||||
}
|
||||
app.sync_views();
|
||||
}
|
||||
next = Some(None);
|
||||
}
|
||||
}
|
||||
if let Some(next) = next {
|
||||
set_pstate(&ctx, SIDES_DRAG, next);
|
||||
}
|
||||
}
|
||||
|
||||
/// The Control bar's underlined "Transform" link: a click toggles the Transform panel in a
|
||||
/// popover under it, as the Stroke link does with the Stroke panel.
|
||||
pub fn link(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
|
||||
@@ -1305,3 +1305,220 @@ fn a_frame_after_a_shape_shows_the_transform_panel() {
|
||||
assert_eq!(texts.iter().any(|t| t == heading), on, "on: {on}, {texts:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The selected live polygon's side count.
|
||||
fn polygon_sides(app: &VectorcraftApp) -> u32 {
|
||||
match &first_selected(app).unwrap().kind {
|
||||
NodeKind::Path { live: Some(l), .. } => match **l {
|
||||
LiveShape::Polygon { sides, .. } => sides,
|
||||
ref k => panic!("{k:?}"),
|
||||
},
|
||||
k => panic!("{k:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// The Shape Properties rows of the contextual task bar's popover for the selected live shape.
|
||||
fn task_bar_shape_rows(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let n = first_selected(app).unwrap();
|
||||
if let NodeKind::Path { live: Some(live), .. } = &n.kind {
|
||||
let live = live.clone();
|
||||
live_shape_rows(app, ui, &n, &live, "task-bar-shape", true);
|
||||
}
|
||||
}
|
||||
|
||||
/// A headless harness drawing `draw` with a live hexagon selected, its side count then set to
|
||||
/// `sides`, after its first frames.
|
||||
fn polygon_harness(sides: u32, draw: fn(&mut VectorcraftApp, &mut Ui)) -> egui_kittest::Harness<'static, VectorcraftApp> {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
|
||||
app.run("shape.polygon", json!({"cx": 150, "cy": 150, "radius": 50, "sides": 6})).unwrap();
|
||||
if sides != 6 {
|
||||
app.run("object.setLiveShape", json!({ "sides": sides })).unwrap();
|
||||
}
|
||||
let mut fonts = false;
|
||||
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(320.0, 900.0)).with_accessibility_check(false).build_ui_state(
|
||||
move |ui, app: &mut VectorcraftApp| {
|
||||
if !std::mem::replace(&mut fonts, true) {
|
||||
crate::theme::install_fonts(ui.ctx());
|
||||
return;
|
||||
}
|
||||
draw(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(3);
|
||||
h
|
||||
}
|
||||
|
||||
/// Where on the Sides slider's rail a press picks `count` sides.
|
||||
fn sides_rail_at(h: &egui_kittest::Harness<'_, VectorcraftApp>, count: f64) -> egui::Pos2 {
|
||||
use egui_kittest::kittest::Queryable;
|
||||
let r = h.get_by_role_and_label(egui::accesskit::Role::Slider, "Sides:").rect();
|
||||
let (lo, hi) = (*SIDES_SLIDER.start(), *SIDES_SLIDER.end());
|
||||
egui::pos2(r.left() + 4.0 + ((count - lo) / (hi - lo)) as f32 * (r.width() - 8.0), r.center().y)
|
||||
}
|
||||
|
||||
/// Press the primary button at `from` and move to `to` in four frames, keeping it down.
|
||||
fn sides_press_and_move(h: &mut egui_kittest::Harness<'_, VectorcraftApp>, from: egui::Pos2, to: egui::Pos2) {
|
||||
h.event(egui::Event::PointerMoved(from));
|
||||
h.run_steps(1);
|
||||
h.event(egui::Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
for i in 1..=4 {
|
||||
h.event(egui::Event::PointerMoved(from + (to - from) * (i as f32 / 4.0)));
|
||||
h.run_steps(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// Release the primary button at `at`.
|
||||
fn sides_release(h: &mut egui_kittest::Harness<'_, VectorcraftApp>, at: egui::Pos2) {
|
||||
h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
/// Polygon Properties' Sides row has a slider beside its field, in the Transform panel, the
|
||||
/// Properties panel's Transform section and the task bar's Shape Properties: screen readers get it
|
||||
/// as a slider named Sides with the side count over 3 to 20.
|
||||
#[test]
|
||||
fn polygon_sides_slider_is_shared_by_transform_and_properties() {
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
for draw in [show as fn(&mut VectorcraftApp, &mut Ui), crate::panels::properties::transform_section, task_bar_shape_rows] {
|
||||
let h = polygon_harness(6, draw);
|
||||
let slider = h.get_by_role_and_label(egui::accesskit::Role::Slider, "Sides:");
|
||||
let node = slider.accesskit_node();
|
||||
assert_eq!(node.numeric_value(), Some(6.0));
|
||||
assert_eq!(node.min_numeric_value(), Some(3.0));
|
||||
assert_eq!(node.max_numeric_value(), Some(20.0));
|
||||
let field = h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Sides:");
|
||||
assert_eq!(field.value().as_deref(), Some("6"));
|
||||
assert!(slider.rect().left() >= field.rect().right(), "the slider follows the field on its row");
|
||||
assert!((slider.rect().center().y - field.rect().center().y).abs() < 6.0, "one row");
|
||||
}
|
||||
}
|
||||
|
||||
/// A count past the slider's 20, typed or set by a command, stays as it is while the panel is
|
||||
/// drawn: the field and screen readers show it, and the rail's handle sits at its right end. A
|
||||
/// press on the rail then sets a count from 3 to 20 in one undo step, and an arrow key steps it by
|
||||
/// one in one undo step.
|
||||
#[test]
|
||||
fn polygon_sides_above_slider_range_remain_editable() {
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
let undo = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
|
||||
let mut h = polygon_harness(50, show);
|
||||
let (depth, revision) = (undo(h.state()), h.state().session.active().unwrap().revision);
|
||||
h.run_steps(3);
|
||||
assert_eq!(polygon_sides(h.state()), 50);
|
||||
assert_eq!(undo(h.state()), depth);
|
||||
assert_eq!(h.state().session.active().unwrap().revision, revision, "drawing the slider leaves the document as it is");
|
||||
let slider = h.get_by_role_and_label(egui::accesskit::Role::Slider, "Sides:");
|
||||
let node = slider.accesskit_node();
|
||||
assert_eq!(node.numeric_value(), Some(50.0));
|
||||
assert_eq!(node.max_numeric_value(), Some(50.0));
|
||||
assert_eq!(h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Sides:").value().as_deref(), Some("50"));
|
||||
let at = sides_rail_at(&h, 12.0);
|
||||
h.event(egui::Event::PointerMoved(at));
|
||||
h.run_steps(1);
|
||||
for pressed in [true, false] {
|
||||
h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
}
|
||||
h.run_steps(1);
|
||||
assert_eq!(polygon_sides(h.state()), 12);
|
||||
assert_eq!(undo(h.state()), depth + 1, "a press on the rail is one undo step");
|
||||
h.key_press(egui::Key::ArrowRight);
|
||||
h.run_steps(2);
|
||||
assert_eq!(polygon_sides(h.state()), 13);
|
||||
assert_eq!(undo(h.state()), depth + 2, "a key step is one undo step");
|
||||
h.state_mut().run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(polygon_sides(h.state()), 12);
|
||||
}
|
||||
|
||||
/// A drag on the Sides slider previews the side count and its release records one undo step,
|
||||
/// which Undo takes back. Escape during a drag puts the polygon back and ignores the rest of the
|
||||
/// drag, and a drag that ends at the count it started from records nothing.
|
||||
#[test]
|
||||
fn polygon_sides_slider_drag_is_one_undo_step() {
|
||||
let undo = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
|
||||
let mut h = polygon_harness(6, show);
|
||||
let depth = undo(h.state());
|
||||
let (six, fifteen, ten) = (sides_rail_at(&h, 6.0), sides_rail_at(&h, 15.0), sides_rail_at(&h, 10.0));
|
||||
sides_press_and_move(&mut h, six, fifteen);
|
||||
assert!(h.state().session.in_interaction(), "the drag is in progress");
|
||||
assert_eq!(polygon_sides(h.state()), 15, "the drag previews the count");
|
||||
assert_eq!(undo(h.state()), depth);
|
||||
sides_release(&mut h, fifteen);
|
||||
assert!(!h.state().session.in_interaction());
|
||||
assert_eq!(polygon_sides(h.state()), 15);
|
||||
assert_eq!(undo(h.state()), depth + 1, "the whole drag is one undo step");
|
||||
h.state_mut().run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(polygon_sides(h.state()), 6);
|
||||
// Escape cancels the drag; the rest of it changes nothing.
|
||||
sides_press_and_move(&mut h, six, fifteen);
|
||||
assert_eq!(polygon_sides(h.state()), 15);
|
||||
h.key_press(egui::Key::Escape);
|
||||
h.run_steps(1);
|
||||
assert!(!h.state().session.in_interaction(), "Escape ends the drag");
|
||||
assert_eq!(polygon_sides(h.state()), 6, "Escape puts the count back");
|
||||
h.event(egui::Event::PointerMoved(ten));
|
||||
h.run_steps(1);
|
||||
sides_release(&mut h, ten);
|
||||
assert_eq!(polygon_sides(h.state()), 6);
|
||||
assert_eq!(undo(h.state()), depth, "a canceled drag records no undo step");
|
||||
// Back where it started: no undo step.
|
||||
sides_press_and_move(&mut h, six, fifteen);
|
||||
sides_press_and_move_back(&mut h, fifteen, six);
|
||||
sides_release(&mut h, six);
|
||||
assert_eq!(polygon_sides(h.state()), 6);
|
||||
assert_eq!(undo(h.state()), depth, "a drag back to its start records no undo step");
|
||||
}
|
||||
|
||||
/// A Sides drag whose rows stop being drawn (the task bar's popover closed under it) keeps the
|
||||
/// count it previewed as one undo step at the end of that pass, as the app ends it; the release
|
||||
/// and the rows drawn again change nothing more.
|
||||
#[test]
|
||||
fn polygon_sides_slider_drag_released_unseen_is_kept() {
|
||||
let undo = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
|
||||
app.run("shape.polygon", json!({"cx": 150, "cy": 150, "radius": 50, "sides": 6})).unwrap();
|
||||
let depth = undo(&app);
|
||||
let shown = std::rc::Rc::new(std::cell::Cell::new(true));
|
||||
let drawn = shown.clone();
|
||||
let mut fonts = false;
|
||||
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(320.0, 900.0)).with_accessibility_check(false).build_ui_state(
|
||||
move |ui, app: &mut VectorcraftApp| {
|
||||
if !std::mem::replace(&mut fonts, true) {
|
||||
crate::theme::install_fonts(ui.ctx());
|
||||
return;
|
||||
}
|
||||
if drawn.get() {
|
||||
show(app, ui);
|
||||
}
|
||||
end_stale_sides_drag(app, ui.ctx());
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(3);
|
||||
let (six, fifteen) = (sides_rail_at(&h, 6.0), sides_rail_at(&h, 15.0));
|
||||
sides_press_and_move(&mut h, six, fifteen);
|
||||
assert!(h.state().session.in_interaction());
|
||||
assert_eq!(polygon_sides(h.state()), 15);
|
||||
shown.set(false);
|
||||
h.run_steps(1);
|
||||
assert!(!h.state().session.in_interaction(), "the drag ends with the pass that did not draw it");
|
||||
assert_eq!(polygon_sides(h.state()), 15);
|
||||
assert_eq!(undo(h.state()), depth + 1, "one undo step");
|
||||
sides_release(&mut h, fifteen);
|
||||
shown.set(true);
|
||||
h.run_steps(2);
|
||||
assert_eq!(polygon_sides(h.state()), 15);
|
||||
assert_eq!(undo(h.state()), depth + 1);
|
||||
}
|
||||
|
||||
/// Move from `from` to `to` in four frames with the primary button still down.
|
||||
fn sides_press_and_move_back(h: &mut egui_kittest::Harness<'_, VectorcraftApp>, from: egui::Pos2, to: egui::Pos2) {
|
||||
for i in 1..=4 {
|
||||
h.event(egui::Event::PointerMoved(from + (to - from) * (i as f32 / 4.0)));
|
||||
h.run_steps(1);
|
||||
}
|
||||
}
|
||||
@@ -1494,6 +1494,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
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`).
|
||||
- **Polygon side widget:** a selected live polygon shows a small diamond beside the middle of the right side of its bounding box, with the Selection tool and with the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools, while the bounding box and the edges are shown. Dragging the widget sets the polygon's side count, from 3 to 11, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/add-or-remove-sides-from-polygons.html) describes; typed counts in the Transform panel and `object.setLiveShape` still go from 3 to 1000. A drag down adds one side and a drag up removes one for every 12 screen pixels along the box's own vertical axis, and the pointer shows the count while measurement labels are on. A polygon of more than 11 sides keeps its count until the drag goes up, which gives it 11. The drag sends `object.setLiveShape {sides}`, so the polygon keeps its center, radius and rotation; the release adds one undo step when the count changed and none when it ends where it began, and Escape puts the count back. The widget's look and place, the drag direction, the step and the rule for more than 11 sides are VectorCraft's own (`crates/tools/src/sidewidget.rs`).
|
||||
- **Polygon side slider:** Polygon Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Sides slider after the Sides field, over 3 to 20 sides. [The help page](https://helpx.adobe.com/illustrator/using/live-shapes.html) gives the slider that range and leaves larger counts, up to 1000, to the typed field, which still takes 3 to 1000. A drag previews the count through `object.setLiveShape {sides}`; its release adds one undo step when the count changed and none when it ends where it began, and Escape during the drag puts the count back and ignores the rest of it. A click on the rail or an arrow key on it sets the count in one undo step. A count above 20 shows the handle at the rail's right end, and screen readers and the field show the real count, until the rail moves. The slider's place, the rule for counts above 20 and the undo steps are VectorCraft's own (`polygon_sides_slider_is_shared_by_transform_and_properties`, `polygon_sides_above_slider_range_remain_editable`, `polygon_sides_slider_drag_is_one_undo_step`, `polygon_sides_slider_drag_released_unseen_is_kept`).
|
||||
- **Hide/Show Shape Widgets:** with the Rectangle, Rounded Rectangle, Ellipse, Polygon or Star tool, the Control bar shows a Hide Shape Widgets button, which reads Show Shape Widgets while the widgets are hidden (`view.shapeWidgets {on?}`). [The help page](https://helpx.adobe.com/illustrator/using/live-shapes.html) describes this Control panel button, offered with any live shape drawing tool, as switching the on-canvas widgets of selected shapes off and on. While they are hidden, a selected live rectangle's or polygon's corner widgets, a live ellipse's pie widgets and a live polygon's side widget are not drawn, and the Selection tool and those shape tools do not answer a press, a double-click or the cursor on their place (a shape tool draws from there). The bounding box and its handles, the center point and Direct Selection's corner widgets (View › Hide Corner Widget) stay as they are. The setting is on by default, kept with the interface state across sessions and tool switches, and adds no undo step. Its scope beyond the shape tools, its default and what it leaves shown are VectorCraft's own rules (tests `hidden_shape_widgets_leave_the_bounding_box`, `the_shape_tools_control_bar_hides_and_shows_the_shape_widgets`, `shape_widgets_command_toggles_and_takes_on`, `hidden_shape_widgets_do_not_answer_a_shape_tool` and `hidden_shape_widgets_leave_direct_selections_corners`).
|
||||
- **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html).
|
||||
- **Anchor Point tool, Alt-drag on a handle:** with the Anchor Point tool chosen, dragging a direction handle with Alt (Option) held links it with the opposite handle and makes the anchor smooth, on a path and on a selected blend's spine, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/create-smooth-paths-with-the-smooth-tool.html) describes; a drag without Alt still moves one handle on its own (`path.setHandle` and `object.blend.spine.moveAnchor` with `link`). VectorCraft's own rules: the opposite handle keeps its length; a retracted one is pulled out to the dragged handle's length where a segment leaves the anchor on its side and stays retracted at an open end; Shift with Alt keeps the 45° steps; an Alt-click still retracts the handle; the Pen with Alt keeps moving a handle on its own. Tests: `anchor_point_alt_drag_links_*` in `crates/tools/src/draw2/anchor/tests.rs`, `a_linked_handle_makes_the_anchor_smooth` in `crates/engine/src/tests/anchor_edit_work.rs`, `a_linked_spine_handle_makes_the_point_smooth` in `crates/engine/src/tests/blendspine.rs`.
|
||||
|
||||
Reference in new issue
Block a user