Live Corners: a straightened corner rounds again when a later move bends it

Moving the anchor of a path's only rounded corner into a straight line kept
its radius, but the next anchor move found no corner drawn with an arc and
edited the drawn path instead, dropping the live shape and its radius.
edit_corner_anchors now decides on the stored radii, so the corner rounds
again once a move bends it.
This commit is contained in:
dotCooCoo committed 2026-12-04 11:29:52 -08:00
1 parent 603a938d34
commit 1406dc8604
3 files changed
+37 -4

No files matched your search

+34 -2
View File
@@ -292,7 +292,7 @@ pub fn set_corners(path: &mut PathData, live: &mut Option<Box<LiveShape>>, corne
/// [`LiveShape::Path`] with that outline. [`LiveCorners::sources`] before and after the edit map
/// the anchors as drawn to the corners they come from.
/// Returns `None`, leaving the path unchanged, when the path has no live shape or
/// no cut corner, or is a rectangle sheared or scaled unevenly.
/// no corner with a radius, or is a rectangle sheared or scaled unevenly.
pub fn edit_corner_anchors(
path: &mut PathData,
live: &mut Option<Box<LiveShape>>,
@@ -309,7 +309,9 @@ pub fn edit_corner_anchors(
}
let (mut base, moved, radii, kinds, relative) = {
let lc = LiveCorners::new(path, live.as_deref())?;
if !lc.drawn.iter().any(|r| *r > 0.0) {
// The stored radii decide, not the drawn ones: a corner the edit straightened draws no
// arc but keeps its radius, and rounds again when a later edit bends it.
if !lc.radii.iter().any(|r| *r > 0.0) {
return None;
}
let moved: BTreeSet<usize> = anchors.iter().filter_map(|(si, ai)| lc.sources.get(*si)?.get(*ai).copied()).collect();
@@ -423,6 +425,36 @@ mod tests {
assert!(!p.transform(Affine::translate((5.0, 0.0))), "a move needs no new cuts");
}
/// Moving the anchor of the only rounded corner into a straight line and back keeps its
/// stored radius, so the corner is rounded again.
#[test]
fn a_straightened_corner_rounds_again_when_it_bends_back() {
let pen = PathData::single(SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(100.0, 0.0), Point::new(100.0, 80.0)], false));
let (mut path, mut live) = (pen.clone(), None);
set_corners(&mut path, &mut live, &set(&[1]), Some(10.0), None);
let corner = LiveCorners::new(&path, live.as_deref()).unwrap().anchors_of(&set(&[1]));
let move_corner = |path: &mut PathData, live: &mut Option<Box<LiveShape>>, to: Point| {
let sel = LiveCorners::new(path, live.as_deref()).unwrap().anchors_of(&set(&[1]));
let sel = if sel.is_empty() { anchors(&[1]) } else { sel };
edit_corner_anchors(path, live, &sel, |base, on_base| {
for &(si, ai) in on_base {
if let Some(a) = base.anchor_mut(si, ai) {
(a.p, a.h_in, a.h_out) = (to, to, to);
}
}
})
};
assert_eq!(corner.len(), 2, "the corner is cut");
// Straight: the corner has nothing to cut.
assert!(move_corner(&mut path, &mut live, Point::new(50.0, 40.0)).is_some());
assert!(matches!(live.as_deref(), Some(LiveShape::Path { radii, .. }) if radii.get(1) == Some(&10.0)));
assert_eq!(LiveCorners::new(&path, live.as_deref()).unwrap().drawn_radius(1), 0.0, "the straight corner draws no arc");
// Bent again: the stored radius cuts it again.
assert!(move_corner(&mut path, &mut live, Point::new(100.0, 0.0)).is_some(), "the straightened corner stays live");
let c = LiveCorners::new(&path, live.as_deref()).unwrap();
assert!(c.drawn_radius(1) > 0.0, "the corner is rounded again: {live:?}");
}
#[test]
fn relative_radii_scale_with_rectangle_size() {
let l = LiveShape::Rectangle {
+2 -1
View File
@@ -9253,7 +9253,8 @@ rectangle or polygon becomes a path with live corners. The delta is measured fro
move that anchor again: a grabbed arc end can finish away from a snap target, and `path.moveAnchor` can leave the drawn
anchor away from `(x, y)`. When the recut changes the anchor layout, all selected anchors of that path are remapped
through their uncut outline anchors and its selected segments are cleared. An unchanged layout keeps the selection.
Anchor edits instead make the shape a plain path when it has no rounded corner, when a live rectangle is sheared or
A corner that a move straightens draws no arc but keeps its radius, so a later move that bends it again rounds it again.
Anchor edits instead make the shape a plain path when no corner has a radius, when a live rectangle is sheared or
unevenly scaled, when an arrow-key nudge's selected curved segments bend or hold their anchors, or when a transform of
direct-selected anchors is other than a move. A nudge that changes nothing, including one that the pixel-grid snap of a
pixel-aligned path takes back (objects selected whole beside the anchors included), records no undo step and leaves Live Corners as they are: a live rectangle stays a live
+1 -1
View File
@@ -865,7 +865,7 @@ since 2026-10-01.
- **A Shift-click inside a selected group** (VectorCraft's own rule): with Direct Selection, a Shift-click on the fill of a path inside a selected group deselects that path, and the group's other objects stay selected (`select.remove`); a Shift-drag from there moves nothing. A Shift-click on one of the path's anchors deselects only that anchor, and the path's other anchors and the group's other objects stay selected. Tests: `direct::tests::a_shift_press_inside_a_selected_group_deselects_the_path`, `selection_commands::remove_and_anchor_toggle_open_a_selected_group`, `selection::tests::expand_to_selects_a_member_in_place_of_its_selected_group`.
- **Shift-click on corner widgets (#5188):** with Direct Selection, when every corner of every selected path is selected (the paths selected whole), a Shift-click on a corner widget picks that corner alone, so the next drag rounds just it. When another selected path has only some corners picked, a Shift-click on a widget of a path selected whole deselects that corner and keeps the other picks. The other corners' widgets then show as not picked; a Shift-click on another corner's anchor or widget adds that corner, and a Shift-click on a picked widget deselects its corner. Corner widgets are chosen by clicking one and Shift-clicking the others ([a tutorial on rounded corners](https://logosbynick.com/?p=15787)). Test: `corners::tests::a_shift_click_on_a_widget_of_a_whole_path_picks_its_corner`.
- **Picking corner widgets (#1232):** with Direct Selection, every corner's widget shows while some corners are picked: a picked corner's widget has a dot at its center and the others are hollow. A click on a widget that is not picked picks its corner alone, a Shift-click adds or removes a corner across selected paths, and a double-click on a picked widget opens Corners for the picked corners of its path ([Live Corners help page, archived](https://web.archive.org/web/2019/https://helpx.adobe.com/illustrator/using/reshape-with-live-corners.html)). As VectorCraft's own rules, a plain click on a picked widget keeps the picks (while every corner of every selected path is picked, it picks that corner alone, and a double-click then opens Corners for that corner), a drag or Alt-click on a widget that is not picked edits its corner together with the picked ones, and over a widget that is not picked, a selected anchor's handle end or a nearer anchor takes the press. Tests: `corners::tests::a_press_on_a_widget_not_picked_edits_it_with_the_picked_corners`, `corners::tests::widgets_are_picked_across_paths`, `corners::tests::a_handle_end_over_a_widget_not_picked_takes_the_press`, `corners::tests::a_nearer_anchor_over_a_widget_not_picked_takes_the_press`, `corners::tests::a_shift_click_toggles_a_rounded_corner_whole`, `corners::tests::a_path_with_hidden_widgets_keeps_its_picks`, `tests::corner_widgets_pick_corners_across_paths_through_the_session`.
- **Anchor edits keep Live Corners (#10545):** moving an anchor of a path with rounded corners (Direct Selection drag, arrow keys, `path.moveAnchor`) moves its uncut corner by the drag delta and recuts it at its radius. A grabbed arc end can finish away from a snap target. A live rectangle or polygon becomes a path with live corners. When the anchor layout changes, the path's whole anchor selection is remapped and its segment selection is cleared. An anchor edit makes the shape a plain path when there is no rounded corner, a live rectangle is sheared or unevenly scaled, an arrow-key nudge bends selected curved segments or holds their anchors, or direct-selected anchors receive a transform other than a move. A nudge that changes nothing, including one that the pixel-grid snap of pixel-aligned paths takes back (with objects selected whole too), records no undo step and leaves Live Corners as they are: a live rectangle stays a live rectangle. These are VectorCraft's own rules. Tests: `tests::livecorners::moving_an_anchor_keeps_the_corners_live`, `tests::livecorners::dragging_selected_anchors_keeps_the_corners_live`, `tests::livecorners::moving_an_anchor_of_a_distorted_rectangle_edits_the_drawn_path`, `tests::livecorners::a_recut_remaps_the_whole_anchor_selection`, `tests::livecorners::a_recut_clears_segments_even_when_selected_anchor_indices_stay_the_same`, `tests::livecorners::an_unchanged_corner_layout_keeps_the_selection`.
- **Anchor edits keep Live Corners (#10545):** moving an anchor of a path with rounded corners (Direct Selection drag, arrow keys, `path.moveAnchor`) moves its uncut corner by the drag delta and recuts it at its radius. A grabbed arc end can finish away from a snap target. A live rectangle or polygon becomes a path with live corners. When the anchor layout changes, the path's whole anchor selection is remapped and its segment selection is cleared. A corner that a move straightens keeps its radius and rounds again when a later move bends it. An anchor edit makes the shape a plain path when no corner has a radius, a live rectangle is sheared or unevenly scaled, an arrow-key nudge bends selected curved segments or holds their anchors, or direct-selected anchors receive a transform other than a move. A nudge that changes nothing, including one that the pixel-grid snap of pixel-aligned paths takes back (with objects selected whole too), records no undo step and leaves Live Corners as they are: a live rectangle stays a live rectangle. These are VectorCraft's own rules. Tests: `tests::livecorners::moving_an_anchor_keeps_the_corners_live`, `tests::livecorners::dragging_selected_anchors_keeps_the_corners_live`, `tests::livecorners::moving_an_anchor_of_a_distorted_rectangle_edits_the_drawn_path`, `tests::livecorners::a_recut_remaps_the_whole_anchor_selection`, `tests::livecorners::a_recut_clears_segments_even_when_selected_anchor_indices_stay_the_same`, `tests::livecorners::an_unchanged_corner_layout_keeps_the_selection`, `corners::tests::a_straightened_corner_rounds_again_when_it_bends_back`.
- **TIFF in screen and asset export:** both format menus expose the existing TIFF encoder and Format Settings. Headless UI regressions choose TIFF and check scaled dimensions, artboard selection, filenames, encoding options, saved settings and collected-asset output. Public reference: [Export for Screens](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/export-for-screens.html), updated 2026-09-28, lists TIFF for both artboards and assets. Adobe staff [confirmed support in 30.2.1](https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/49081034-add-tiff-format-into-export-for-screens-assets-d) on 2026-02-19; the older 2025 Collect assets guide omits TIFF.
- **Lossy WebP with a Quality setting:** WebP Options has a Compression menu (Lossless, Lossy) and a Quality slider from 0 to 100 that is enabled for Lossy. Lossy writes a `VP8 ` WebP file, with an `ALPH` chunk that keeps the alpha exactly when some pixels are not opaque. `document.export`, `document.serialize` and Export for Screens take `lossless: false` with `quality` (default 90, VectorCraft's own value), in a format row or in `settings.webp`; Format Settings for WebP keeps both. Lossless stays the default, and a quality above 100 or one that is not a whole number is refused. Public reference: [export file format options](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/export-file-format-options-in-illustrator.html) describes Lossless and Lossy WebP and a Quality setting for Lossy (`webp_is_lossless_by_default_and_lossy_when_asked`, `lossy_webp_keeps_translucent_pixels`, `webp_quality_out_of_its_range_is_refused` in `crates/engine/src/cmd/fileio/tests_text.rs`, `webp_options_choose_lossless_or_lossy_at_a_quality`).
- **Export for Screens of the selected artboards:** while the Artboard tool is in use, File › Export › Export for Screens… (`file.exportForScreens`) opens with the artboards the tool has selected checked on its Artboards tab, and Export Artboard writes only those. Shift-clicks on the canvas, or Shift- or Ctrl/Cmd-clicks on the Artboards panel's rows, select several. The other fields show the settings the document last exported with. With another tool in use, the dialog takes its artboard choice from those settings too. Public reference: [Export selected artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/export-artboards.html).