mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 05:53:08 -05:00
Blend: live rectangle steps need keys with no scale left in their transforms
Live rectangle steps keep the first key's rotation and reflection. A key whose transform still held a scale could pass the comparison with a large scale on one axis hiding a difference on the other, and Align to Path then folded that scale into each step, so its corners changed shape along the spine. Only keys whose transforms are a rotation or a reflection, the same for both, now take the live rectangle route; the rest keep anchor matching.
This commit is contained in:
1 parent
b4580f9fb9
commit
3537d1bb60
3 files changed
+11
-16
No files matched your search
+7
-11
@@ -1034,7 +1034,7 @@ enum Shape {
|
||||
/// compound paths.
|
||||
Path { pair: PathPair, rules: (FillRule, FillRule), members: Option<(Vec<usize>, Vec<usize>)> },
|
||||
/// Two live rectangles: each step is a live rectangle whose size, transform and corner radii
|
||||
/// lie between the keys'. A shared shear or nonuniform scale makes the corners elliptical.
|
||||
/// lie between the keys', so their rounded corners stay circular arcs.
|
||||
LiveRect(Box<(LiveRectParts, LiveRectParts)>),
|
||||
/// Text, symbols and images: their transforms interpolate.
|
||||
Placed,
|
||||
@@ -1076,19 +1076,15 @@ fn live_rect(s: &LiveShape) -> Option<LiveRectParts> {
|
||||
}
|
||||
|
||||
/// The parts of `a` and `b` when steps between them can be live rectangles: both are live
|
||||
/// rectangles with the same corner kinds and the same rotation, reflection and shear, so each step
|
||||
/// only moves and resizes.
|
||||
/// rectangles with the same corner kinds, turned and reflected alike, and with no scale or shear
|
||||
/// left in their transforms, so each step only moves and resizes and its corners stay circular.
|
||||
fn live_rect_pair(a: &LiveShape, b: &LiveShape) -> Option<(LiveRectParts, LiveRectParts)> {
|
||||
let (x, y) = (live_rect(a)?, live_rect(b)?);
|
||||
let (p, q) = (x.xf.as_coeffs(), y.xf.as_coeffs());
|
||||
let scale = p[..4].iter().chain(&q[..4]).map(|c| c.abs()).fold(0.0, f64::max);
|
||||
let determinant_sign = |c: [f64; 6]| {
|
||||
let scale = if scale > 0.0 { scale } else { 1.0 };
|
||||
let det = (c[0] / scale) * (c[3] / scale) - (c[1] / scale) * (c[2] / scale);
|
||||
(det > 0.0, det < 0.0)
|
||||
};
|
||||
(x.kinds == y.kinds && p[..4].iter().zip(&q[..4]).all(|(a, b)| (a - b).abs() <= 1e-9 * scale) && determinant_sign(p) == determinant_sign(q))
|
||||
.then_some((x, y))
|
||||
// A rotation or a reflection: unit columns at right angles.
|
||||
let rigid =
|
||||
|c: [f64; 6]| (c[0].hypot(c[1]) - 1.0).abs() < 1e-9 && (c[2].hypot(c[3]) - 1.0).abs() < 1e-9 && (c[0] * c[2] + c[1] * c[3]).abs() < 1e-9;
|
||||
(x.kinds == y.kinds && rigid(p) && rigid(q) && p[..4].iter().zip(&q[..4]).all(|(a, b)| (a - b).abs() < 1e-9)).then_some((x, y))
|
||||
}
|
||||
|
||||
/// `n` shrunk to a point at `c`: the counterpart of an object only one of two groups has.
|
||||
|
||||
+3
-4
@@ -16809,10 +16809,9 @@ bounding-box edges divided by their mean width (left and right edges) or height
|
||||
from 1 to 1000. Keys with no width or no height are measured by their other side, keys with neither in points, and
|
||||
keys without bounds make 1 step. `starts` gives, per object, the anchor of its first subpath the blend starts
|
||||
from (as the Blend tool's clicks on anchor points do; an open path's last anchor runs it the other way). Steps
|
||||
between two live rectangles with the same corner kinds and the same rotation, reflection and shear are live
|
||||
rectangles whose width, height, position and corner radii lie between the keys'. Rounded corners stay circular
|
||||
arcs only when the keys are not sheared and have no nonuniform scale in their transforms; a shared shear draws
|
||||
elliptical corners on the canvas. Other path and live-shape pairs use anchor matching. A start anchor given in
|
||||
between two live rectangles with the same corner kinds and the same rotation and reflection, and with no scale
|
||||
or shear left in their transforms, are live rectangles whose width, height, position and corner radii lie between
|
||||
the keys', so their rounded corners stay circular arcs. Other path and live-shape pairs use anchor matching. A start anchor given in
|
||||
`starts` for either key also sends live rectangles through anchor matching; an all-null `starts` does not. With the
|
||||
Blend tool, `press_key` Escape drops the object clicked first and stops the next click adding to the blend
|
||||
just made; the document and the selection stay as they are. A blend
|
||||
|
||||
@@ -2132,7 +2132,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
A double-click with the Live Paint Selection tool on a face selects it and the faces of its group that no stroked edge parts from it ([the help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html)), and on an edge selects it and the edges joined to it end to end that have its stroke paint ([the help page](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)); Shift-double-click adds them to the selection or removes them from it. A triple-click on a face selects every face of its group with that face's fill, and on an edge every edge of its group that has its stroke paint ([the help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html)); hidden faces and edges are left out, and Shift-triple-click adds them to the selection or removes them from it.
|
||||
When the object the Blend tool picked first is deleted or undone away before the second click, the next click on an object picks that object first instead of doing nothing. Regression tests: `blend_tool_picks_again_when_its_first_pick_is_gone` in `meshblend.rs` and `the_blend_tool_picks_again_when_its_first_pick_is_deleted` in `tests/blendopts.rs`.
|
||||
Window › Blend opens the Blend panel: Make, the selected blend's Spacing and Orientation (with no blend selected, the options new blends start with), Reverse Front to Back, Reverse Spine, Replace Spine, Expand and Release, each running its Object › Blend command. Make is dimmed until two or more objects are selected. Spacing and Orientation are dimmed until a blend or two or more objects are selected, and the other buttons are dimmed until a blend is selected.
|
||||
Steps between live rectangles with matching corner kinds and equivalent linear transforms stay live rectangles with interpolated sizes, positions and corner radii. A start anchor given for either key selects anchor matching instead; all-null `starts` keeps live rectangles. Rounded corners stay circular only without shear or a nonuniform scale in the keys' transforms. Evidence: `blend::tests::steps_between_rounded_rectangles_keep_round_corners` in `crates/doc/src/blend.rs`.
|
||||
Steps between two live rectangles with the same corner kinds, turned and reflected alike, are live rectangles whose sizes, positions and corner radii lie between the keys', so their rounded corners stay circular arcs (#10707). A start point clicked on either key, a scale or shear left in a key's transform, and every other pair of paths keep anchor-by-anchor matching. Evidence: `blend::tests::steps_between_rounded_rectangles_keep_round_corners` in `crates/doc/src/blend.rs`.
|
||||
The Blend panel's Create Spine menu (Auto, Always, Never; `object.blend.createSpine`) sets whether new blends get a spine, from the Blend tool, Make and `object.blend.make` alike ([Blend panel overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blend-panel-overview.html)). Auto and Always give every new blend a straight spine, as before; Never makes blends without one, which keep their steps on the straight lines between the keys, have Type and Ramp dimmed, refuse Reverse Spine and spine edits, release without a spine path, and get a spine from Replace Spine. The setting is kept with the preferences and leaves blends already made as they are; Auto as the starting value and keeping the setting across sessions are VectorCraft's own rules. Builds on #5177 by adambelis. Evidence: `tests::blendopts::{create_spine_sets_whether_new_blends_get_a_spine, a_blend_without_a_spine_has_none_to_edit_reverse_ease_or_release, whether_a_blend_has_a_spine_is_saved_and_old_blends_have_one}` and `panels::tests_blend::create_spine_sets_what_new_blends_get_whatever_is_selected`.
|
||||
Blend Options on several selected blends (the Blend Options dialog, the Blend panel's Type, Ramp and Shift, and `object.blend.options`) sets only the values given or set in the dialog, and each blend keeps its own spacing, orientation, type, ramp and shift for the rest instead of taking the first blend's; a spacing mode given without a count keeps the count of a blend already in that mode. `object.blend.options {id}` edits that blend alone; a hidden or locked blend, an object that is not a blend, a value out of range and an unknown orientation are errors that change nothing, and a call that changes nothing records no undo step. A drag of the panel's Ramp or Shift slider previews on the canvas and records one undo step on release, and Type, Ramp and Reverse Spine are dimmed while a selected blend, or the blend of a key selected with Direct Selection, has no spine. Builds on #8022 by ruchirguitar. Evidence: `tests::blendopts::{options_on_several_blends_set_only_the_values_given, options_with_an_id_edit_that_blend_alone, options_that_change_nothing_or_are_refused_record_no_undo_step}`, `dialogs::blend_options::tests::on_several_blends_ok_sets_only_the_fields_changed` and `panels::tests_blend::{a_ramp_or_shift_drag_is_one_undo_step, ramp_and_shift_edit_every_selected_blend_and_keep_their_other_options, ramp_is_dimmed_while_a_selected_blend_has_no_spine, ramp_and_reverse_spine_are_dimmed_while_a_selected_key_belongs_to_a_blend_with_no_spine}`.
|
||||
The Blend panel, the Object › Blend, Envelope Distort and Gradient Mesh menu items and their commands find each selected object's nearest blend, envelope or mesh by reading the object's place in the tree once, instead of looking up every ancestor by id, and the checks of whether one is selected stop at the first one found. The results, their order and the errors are the same. With Select All of 102,200 objects (100,000 rectangles, 2,000 blends and 200 envelopes in 10 layers), a release build took a median of 16.5 ms of thread CPU time for the Blend check before and 0.5 ms after, and 18.4 ms before and 8.2 ms after to list the selected blends. Evidence: `cmd::live::selected_tests` and `tests::lookups::nearest_finder_*`.
|
||||
|
||||
Reference in new issue
Block a user