mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 08:26:28 +00:00
Merge pull request #8224 from dotCooCoo/perf/transform-pixel-grid-state-once
Transform: the Align to Pixel Grid state is worked out once per document revision
This commit is contained in:
@@ -89,6 +89,7 @@ impl VectorcraftApp {
|
||||
selection_box: None,
|
||||
selection_bounds: None,
|
||||
content_bounds: None,
|
||||
pixel_aligned: None,
|
||||
plugin_keys: Default::default(),
|
||||
placed_keys: Default::default(),
|
||||
cursors: Default::default(),
|
||||
|
||||
@@ -61,6 +61,9 @@ pub struct CanvasCache {
|
||||
pub selection_bounds: Option<((u64, u64), Option<vectorcraft_geom::Rect>)>,
|
||||
/// [`VectorcraftApp::content_bounds`] for (document uid, revision).
|
||||
pub content_bounds: Option<((u64, u64), Option<vectorcraft_geom::Rect>)>,
|
||||
/// The Transform panel's Align to Pixel Grid state (on, off or mixed, and whether every
|
||||
/// selected object can be aligned) for (document uid, revision).
|
||||
pub pixel_aligned: Option<((u64, u64), Option<PixelAligned>)>,
|
||||
/// [`CacheKey::plugins`] by document uid, with the plug-in revision
|
||||
/// ([`vectorcraft_render::effects::plugin_revision`]) it was last checked at.
|
||||
pub plugin_keys: std::collections::HashMap<u64, (u64, u64)>,
|
||||
@@ -108,6 +111,10 @@ pub type SliceCache = ((u64, u64), std::sync::Arc<Vec<vectorcraft_doc::SliceArea
|
||||
/// uid, revision).
|
||||
pub type LivePaintGapsCache = ((u64, u64), std::sync::Arc<Vec<vectorcraft_tools::Overlay>>);
|
||||
|
||||
/// [`CanvasCache::pixel_aligned`]: the selected objects' Align to Pixel Grid, on or off when they
|
||||
/// agree and `None` when they differ, with whether every one can be aligned.
|
||||
pub type PixelAligned = (Option<bool>, bool);
|
||||
|
||||
/// [`CanvasCache::print_tiling`]: the print tiling of (document uid, revision).
|
||||
pub type PrintTilingCache = ((u64, u64), std::sync::Arc<Vec<vectorcraft_pdf::TilingPage>>);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use vectorcraft_geom::shapes::CornerKind;
|
||||
use vectorcraft_geom::{Point, Rect, Vec2};
|
||||
|
||||
use super::{corner_radius_row, first_selected, pstate, set_pstate};
|
||||
use crate::caches::PixelAligned;
|
||||
use crate::dialogs::corners::kind_label as corner_kind;
|
||||
use crate::theme::Tokens;
|
||||
use crate::widgets::{self, menu_item};
|
||||
@@ -368,29 +369,53 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
|
||||
/// The selected objects' Align to Pixel Grid: on or off when they agree, `None` when they differ,
|
||||
/// with whether every one can be aligned (a path that is not a guide and not inside a compound path,
|
||||
/// or a compound path) and their ids. `None` with nothing selected.
|
||||
fn pixel_aligned_state(app: &VectorcraftApp) -> Option<(Option<bool>, bool, Vec<u64>)> {
|
||||
/// or a compound path). `None` with nothing selected.
|
||||
fn pixel_aligned_state(app: &VectorcraftApp) -> Option<PixelAligned> {
|
||||
let st = app.session.active()?;
|
||||
let nodes: Vec<&Node> = st.selection.objects.iter().filter_map(|id| st.doc.node(*id)).collect();
|
||||
let first = nodes.first()?.extras().pixel_aligned;
|
||||
let value = nodes.iter().all(|n| n.extras().pixel_aligned == first).then_some(first);
|
||||
let in_compound = |n: &Node| st.doc.parent_of(n.id).and_then(|p| st.doc.node(p)).is_some_and(|p| matches!(p.kind, NodeKind::Compound { .. }));
|
||||
let alignable = nodes.iter().all(|n| matches!(n.kind, NodeKind::Path { guide: false, .. } | NodeKind::Compound { .. }) && !in_compound(n));
|
||||
Some((value, alignable, nodes.iter().map(|n| n.id.0).collect()))
|
||||
Some((value, alignable))
|
||||
}
|
||||
|
||||
/// [`pixel_aligned_state`], measured once per (document uid, revision)
|
||||
/// ([`crate::caches::CanvasCache::pixel_aligned`]): the panel reads it every frame, and Select All
|
||||
/// can select hundreds of thousands of paths.
|
||||
fn pixel_aligned_shown(app: &mut VectorcraftApp) -> Option<PixelAligned> {
|
||||
let st = app.session.active()?;
|
||||
let key = (st.uid, st.revision);
|
||||
if let Some((k, state)) = app.canvas.pixel_aligned
|
||||
&& k == key
|
||||
{
|
||||
return state;
|
||||
}
|
||||
let state = pixel_aligned_state(app);
|
||||
app.canvas.pixel_aligned = Some((key, state));
|
||||
state
|
||||
}
|
||||
|
||||
/// The Align to Pixel Grid checkbox (`object.setPixelAligned`): a dash when the selected objects
|
||||
/// differ, and unavailable unless every selected object can be aligned. A click turns it on for
|
||||
/// them all, or off when it is on for them all.
|
||||
fn pixel_grid_check(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let (value, alignable, ids) = pixel_aligned_state(app).unwrap_or((Some(false), false, vec![]));
|
||||
if widgets::check3(ui, tl!("Align to Pixel Grid"), value, alignable)
|
||||
&& let Err(e) = app.run("object.setPixelAligned", json!({"ids": ids, "on": value != Some(true)}))
|
||||
{
|
||||
let (value, alignable) = pixel_aligned_shown(app).unwrap_or((Some(false), false));
|
||||
if !widgets::check3(ui, tl!("Align to Pixel Grid"), value, alignable) {
|
||||
return;
|
||||
}
|
||||
let ids = pixel_aligned_ids(app);
|
||||
if let Err(e) = app.run("object.setPixelAligned", json!({"ids": ids, "on": value != Some(true)})) {
|
||||
app.status(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// The ids of the selected objects that are in the document, for `object.setPixelAligned`: read
|
||||
/// when the Align to Pixel Grid checkbox is clicked.
|
||||
fn pixel_aligned_ids(app: &VectorcraftApp) -> Vec<u64> {
|
||||
app.session.active().map(|st| st.selection.objects.iter().filter(|id| st.doc.node(**id).is_some()).map(|id| id.0).collect()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// A live rectangle's, polygon's or ellipse's properties (Transform and Properties panels, and the
|
||||
/// Contextual Task Bar), their widget ids under `id`. `headed` adds the Rectangle and Polygon
|
||||
/// Properties headings; an ellipse's heading always shows. Returns false, drawing nothing, for
|
||||
|
||||
@@ -568,6 +568,187 @@ fn align_to_pixel_grid_shows_and_sets_the_property() {
|
||||
assert_eq!(pixel_aligned_state(&app).map(|s| s.1), Some(false));
|
||||
}
|
||||
|
||||
/// The Align to Pixel Grid state measured from scratch in one pass over the selection, with the ids
|
||||
/// a click sends: what [`pixel_aligned_shown`] and [`pixel_aligned_ids`] are compared with.
|
||||
fn full_pixel_aligned_state(app: &VectorcraftApp) -> Option<(Option<bool>, bool, Vec<u64>)> {
|
||||
let st = app.session.active()?;
|
||||
let nodes: Vec<&Node> = st.selection.objects.iter().filter_map(|id| st.doc.node(*id)).collect();
|
||||
let first = nodes.first()?.extras().pixel_aligned;
|
||||
let value = nodes.iter().all(|n| n.extras().pixel_aligned == first).then_some(first);
|
||||
let in_compound = |n: &Node| st.doc.parent_of(n.id).and_then(|p| st.doc.node(p)).is_some_and(|p| matches!(p.kind, NodeKind::Compound { .. }));
|
||||
let alignable = nodes.iter().all(|n| matches!(n.kind, NodeKind::Path { guide: false, .. } | NodeKind::Compound { .. }) && !in_compound(n));
|
||||
Some((value, alignable, nodes.iter().map(|n| n.id.0).collect()))
|
||||
}
|
||||
|
||||
/// The Align to Pixel Grid state the panel shows, and the ids a click sends, equal a full measure
|
||||
/// of the selection: with no document, nothing selected, mixed values, a guide, a compound path,
|
||||
/// a path inside a compound path and a selection that holds both.
|
||||
#[test]
|
||||
fn align_to_pixel_grid_kept_state_equals_a_full_measure() {
|
||||
fn same(app: &mut VectorcraftApp, why: &str) -> Option<PixelAligned> {
|
||||
let full = full_pixel_aligned_state(app);
|
||||
let shown = pixel_aligned_shown(app);
|
||||
assert_eq!(shown, full.as_ref().map(|f| (f.0, f.1)), "{why}");
|
||||
assert_eq!(pixel_aligned_ids(app), full.map_or(vec![], |f| f.2), "{why}");
|
||||
shown
|
||||
}
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
assert_eq!(same(&mut app, "no document"), None);
|
||||
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
|
||||
assert_eq!(same(&mut app, "nothing selected"), None);
|
||||
let rect = |app: &mut VectorcraftApp, x: f64| {
|
||||
app.run("shape.rectangle", json!({"x": x, "y": 20, "width": 30, "height": 10})).unwrap()["id"].as_u64().unwrap()
|
||||
};
|
||||
let (a, b, g) = (rect(&mut app, 10.0), rect(&mut app, 60.0), rect(&mut app, 110.0));
|
||||
app.run("object.setPixelAligned", json!({"ids": [a], "on": true})).unwrap();
|
||||
app.run("select.set", json!({"ids": [a, b]})).unwrap();
|
||||
assert_eq!(same(&mut app, "mixed"), Some((None, true)));
|
||||
app.run("select.set", json!({"ids": [a]})).unwrap();
|
||||
assert_eq!(same(&mut app, "on"), Some((Some(true), true)));
|
||||
app.run("select.set", json!({"ids": [g]})).unwrap();
|
||||
app.run("view.guides.make", json!({})).unwrap();
|
||||
app.run("select.set", json!({"ids": [g, b]})).unwrap();
|
||||
assert_eq!(same(&mut app, "a guide"), Some((Some(false), false)));
|
||||
app.run("select.set", json!({"ids": [a, b]})).unwrap();
|
||||
let c = app.run("object.compoundPath.make", json!({})).unwrap()["id"].as_u64().unwrap();
|
||||
assert_eq!(same(&mut app, "a compound path").map(|s| s.1), Some(true));
|
||||
let member = app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(c)).unwrap().children().unwrap()[0].id.0;
|
||||
app.run("select.set", json!({"ids": [member]})).unwrap();
|
||||
assert_eq!(same(&mut app, "a path inside a compound path").map(|s| s.1), Some(false));
|
||||
app.run("select.set", json!({"ids": [c, member]})).unwrap();
|
||||
assert_eq!(same(&mut app, "a compound path and its member").map(|s| s.1), Some(false));
|
||||
app.run("select.none", json!({})).unwrap();
|
||||
assert_eq!(same(&mut app, "deselected"), None);
|
||||
}
|
||||
|
||||
/// A frame of the panel measures the Align to Pixel Grid state once and keeps it for the document's
|
||||
/// revision: later frames read it. An edit, Undo, Redo, a new selection, another document and a
|
||||
/// document read back from its file measure it again.
|
||||
#[test]
|
||||
fn align_to_pixel_grid_state_is_measured_once_per_revision() {
|
||||
const PLANTED: Option<PixelAligned> = Some((None, false));
|
||||
fn key(app: &VectorcraftApp) -> (u64, u64) {
|
||||
app.session.active().map(|st| (st.uid, st.revision)).unwrap()
|
||||
}
|
||||
fn measured_again(app: &mut VectorcraftApp, why: &str, change: impl FnOnce(&mut VectorcraftApp)) {
|
||||
app.canvas.pixel_aligned = Some((key(app), PLANTED));
|
||||
change(app);
|
||||
let shown = pixel_aligned_shown(app);
|
||||
assert_ne!(shown, PLANTED, "{why}");
|
||||
assert_eq!(shown, pixel_aligned_state(app), "{why}");
|
||||
}
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
|
||||
let a = app.run("shape.rectangle", json!({"x": 10, "y": 20, "width": 30, "height": 10})).unwrap()["id"].as_u64().unwrap();
|
||||
let b = app.run("shape.rectangle", json!({"x": 60, "y": 20, "width": 30, "height": 10})).unwrap()["id"].as_u64().unwrap();
|
||||
app.run("select.set", json!({"ids": [a, b]})).unwrap();
|
||||
let saved = (*app.session.active().unwrap().doc).clone();
|
||||
texts(&mut app, show);
|
||||
assert_eq!(app.canvas.pixel_aligned, Some((key(&app), Some((Some(false), true)))));
|
||||
// A wrong answer planted for this revision shows: the state is not measured again.
|
||||
app.canvas.pixel_aligned = Some((key(&app), PLANTED));
|
||||
assert_eq!(pixel_aligned_shown(&mut app), PLANTED);
|
||||
texts(&mut app, show);
|
||||
assert_eq!(app.canvas.pixel_aligned, Some((key(&app), PLANTED)));
|
||||
measured_again(&mut app, "an edit", |app| {
|
||||
app.run("object.setPixelAligned", json!({"ids": [a], "on": true})).unwrap();
|
||||
});
|
||||
measured_again(&mut app, "Undo", |app| {
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
});
|
||||
measured_again(&mut app, "Redo", |app| {
|
||||
app.run("edit.redo", json!({})).unwrap();
|
||||
});
|
||||
measured_again(&mut app, "a new selection", |app| {
|
||||
app.run("select.set", json!({"ids": [a]})).unwrap();
|
||||
});
|
||||
measured_again(&mut app, "a new document", |app| {
|
||||
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 10, "y": 20, "width": 30, "height": 10})).unwrap();
|
||||
});
|
||||
measured_again(&mut app, "back to the first document", |app| {
|
||||
app.session.set_active(0);
|
||||
});
|
||||
assert_eq!(pixel_aligned_shown(&mut app), Some((Some(true), true)));
|
||||
measured_again(&mut app, "the document read back", |app| {
|
||||
assert!(app.session.replace_document(0, saved));
|
||||
});
|
||||
}
|
||||
|
||||
/// The thread's CPU time in nanoseconds, where Linux gives it.
|
||||
fn thread_cpu_ns() -> Option<u128> {
|
||||
std::fs::read_to_string("/proc/thread-self/schedstat").ok()?.split_whitespace().next()?.parse().ok()
|
||||
}
|
||||
|
||||
/// Time the Align to Pixel Grid state with Select All in a document of 100,000 paths, 1,000 of
|
||||
/// them inside 500 compound paths: measured from scratch on every frame
|
||||
/// ([`full_pixel_aligned_state`]), by [`pixel_aligned_shown`] on the first frame of a revision, and
|
||||
/// by [`pixel_aligned_shown`] on later frames of the same revision. The sides alternate, and the
|
||||
/// median time per frame of 7 runs is printed.
|
||||
/// Run with `cargo test --release -p vectorcraft-ui-egui --lib pixel_aligned_state_timing -- --ignored --nocapture`.
|
||||
#[test]
|
||||
#[ignore = "manual timing probe; performance depends on machine load"]
|
||||
fn pixel_aligned_state_timing() {
|
||||
const PATHS: usize = 100_000;
|
||||
const COMPOUNDS: usize = 500;
|
||||
const MEASURES: u32 = 20;
|
||||
const KEPT: u32 = 1_000_000;
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 2000, "height": 2000})).unwrap();
|
||||
for i in 0..COMPOUNDS {
|
||||
let (x, y) = ((i % 40 * 40) as f64, (i / 40 * 40) as f64);
|
||||
let a = app.run("shape.rectangle", json!({"x": x, "y": y, "width": 30, "height": 30})).unwrap()["id"].clone();
|
||||
let b = app.run("shape.rectangle", json!({"x": x + 5.0, "y": y + 5.0, "width": 10, "height": 10})).unwrap()["id"].clone();
|
||||
app.run("select.set", json!({"ids": [a, b]})).unwrap();
|
||||
app.run("object.compoundPath.make", json!({})).unwrap();
|
||||
}
|
||||
let rect = app.run("shape.rectangle", json!({"x": 0, "y": 1000, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap();
|
||||
let rect = app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(rect)).cloned().unwrap();
|
||||
app.session
|
||||
.edit("Fill", |d, _| {
|
||||
let layer = d.layers[0].id;
|
||||
for _ in 0..PATHS - 2 * COMPOUNDS - 1 {
|
||||
let mut n = rect.clone();
|
||||
n.id = d.alloc_id();
|
||||
d.insert(Some(layer), usize::MAX, n)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
app.run("select.all", json!({})).unwrap();
|
||||
let selected = app.session.active().unwrap().selection.objects.len();
|
||||
let mut paths = 0;
|
||||
app.session.active().unwrap().doc.walk(|n| paths += usize::from(matches!(n.kind, NodeKind::Path { .. })));
|
||||
let expected = full_pixel_aligned_state(&app).map(|f| (f.0, f.1));
|
||||
assert_eq!(expected, Some((Some(false), true)));
|
||||
let mut time = |frames: u32, f: &mut dyn FnMut(&mut VectorcraftApp) -> Option<PixelAligned>| {
|
||||
let (cpu, wall) = (thread_cpu_ns(), std::time::Instant::now());
|
||||
for _ in 0..frames {
|
||||
assert_eq!(f(&mut app), expected);
|
||||
}
|
||||
let ns = thread_cpu_ns().zip(cpu).map_or_else(|| wall.elapsed().as_nanos(), |(b, a)| b - a);
|
||||
ns as f64 / f64::from(frames) / 1000.0
|
||||
};
|
||||
let (mut full, mut first, mut kept) = (vec![], vec![], vec![]);
|
||||
for _ in 0..7 {
|
||||
full.push(time(MEASURES, &mut |app| full_pixel_aligned_state(app).map(|f| (f.0, f.1))));
|
||||
first.push(time(MEASURES, &mut |app| {
|
||||
app.canvas.pixel_aligned = None;
|
||||
pixel_aligned_shown(app)
|
||||
}));
|
||||
kept.push(time(KEPT, &mut pixel_aligned_shown));
|
||||
}
|
||||
let median = |v: &mut Vec<f64>| {
|
||||
v.sort_by(f64::total_cmp);
|
||||
v[v.len() / 2]
|
||||
};
|
||||
let clock = if thread_cpu_ns().is_some() { "thread CPU time" } else { "wall-clock time" };
|
||||
eprintln!("{paths} paths, {selected} objects selected; {clock} per frame, median of 7 runs");
|
||||
eprintln!("every frame measured ({MEASURES} frames a run): {:>12.3} us {full:.3?}", median(&mut full));
|
||||
eprintln!("first frame of a revision ({MEASURES} a run): {:>12.3} us {first:.3?}", median(&mut first));
|
||||
eprintln!("later frames ({KEPT} frames a run): {:>12.4} us {kept:.4?}", median(&mut kept));
|
||||
}
|
||||
|
||||
/// The panel menu's Align New Objects to Pixel Grid shows and toggles the active document's
|
||||
/// setting, follows a switch to another document, and is unavailable with no document open.
|
||||
#[test]
|
||||
|
||||
@@ -1029,6 +1029,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- The Transform panel menu's Transform Object Only, Transform Pattern Only and Transform Both (`transformPanelPatterns`) choose whether the fields, flips and menu flips of the Transform panel and the Properties panel's Transform section move the object and leave its pattern tiles, move the tiles alone, or both (until a choice they follow General › Transform Pattern Tiles, as before); Use Registration Point for Symbol (`useRegistrationPointForSymbol`) measures and transforms one selected symbol instance from its symbol's registration point, where the instance's flips, rotations and shears put it ([Transform panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/transform-panel-overview.html); `panels::transform::tests::the_menu_chooses_whether_the_object_its_pattern_or_both_transform`, `use_registration_point_for_symbol_measures_an_instance_from_its_registration_point`, `use_registration_point_for_symbol_follows_a_transformed_instance`, `tests_prefs::transform_panel_patterns_defaults_to_following_the_general_preference`).
|
||||
- The Transform panel's Align to Pixel Grid checkbox (`object.setPixelAligned`) gives paths and compound paths a pixel-aligned property, saved in the native file: their horizontal and vertical straight segments sit on whole points (half points under an odd centered stroke) with whole stroke weights, and every move, scale, rotation, reflection, Transform Each, Align move, Transform panel change, move of direct-selected anchors or of one anchor, move of a compound path's path on its own, artboard move, resize or copy that carries the art, Duplicate or paste that moves a copy, stroke edit and appearance edit that adds, removes, hides, repaints or reweighs a stroke snaps them again, while diagonal segments and curves keep their shape; a compound path made from an aligned path or compound path is aligned and snaps its paths with its own stroke; the box shows a dash for a mixed selection and is unavailable for type, images and groups ([Pixel-aligned property](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/pixel-preview-mode-for-web-graphics.html); `tests::pixelalign::turning_it_on_snaps_the_path_in_one_undo_step`, `it_stays_aligned_through_transforms`, `it_stays_aligned_when_its_artboard_moves`, `diagonal_segments_and_curves_keep_their_shape`, `type_and_images_cannot_be_aligned`, `the_property_is_saved_and_read_back`, `stroke_edits_keep_it_aligned`, `a_compound_path_of_aligned_paths_is_aligned`, `a_compound_path_of_an_aligned_compound_path_is_aligned`, `a_stroke_without_paint_snaps_to_whole_points`, `moving_direct_selected_anchors_keeps_it_aligned`, `moving_one_anchor_keeps_it_aligned`, `moving_a_path_of_an_aligned_compound_path_keeps_it_aligned`, `artboard_options_and_artboard_copies_keep_it_aligned`, `appearance_edits_keep_it_aligned`, `placed_gradients_follow_the_snapped_path`, `duplicates_and_pastes_keep_it_aligned`, `paths_added_to_or_moved_in_an_aligned_compound_path_keep_it_aligned`, `the_art_of_a_linked_opacity_mask_keeps_it_aligned`, `a_linked_opacity_mask_follows_a_snap`, `aligning_direct_selected_anchors_keeps_it_aligned`, `global_edit_keeps_its_members_aligned`, `a_path_with_live_corners_snaps_its_inner_edges`, `geometry_edits_keep_it_aligned`, `other_path_edits_keep_it_aligned`, `panels::transform::tests::align_to_pixel_grid_shows_and_sets_the_property`).
|
||||
- Align New Objects to Pixel Grid (`document.setup {alignNewObjectsToPixelGrid}`, a checkbox in New Document's Advanced Options and a checked item in the Transform panel menu) gives every path and compound path drawn in the document, the paths of a new grid or flare included, the pixel-aligned property, snapped in the step that draws it; it is on in the Mobile and Web presets and off in the others, saved presets and Recent keep it, and the document saves it. Type, images and groups do not take it, and art already in the document, pasted, duplicated or placed keeps its own property (VectorCraft's own rules) ([Pixel-aligned property](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/pixel-preview-mode-for-web-graphics.html); `tests::pixelalign::align_new_objects_makes_new_paths_pixel_aligned`, `align_new_objects_reaches_grids_flares_and_add_on_shapes`, `align_new_objects_is_saved_and_read_back`, `tests::newdoc::align_new_objects_to_pixel_grid_follows_the_preset`, `panels::transform::tests::align_new_objects_menu_item_toggles_the_active_document`, `dialogs::new_document::tests::align_new_objects_checkbox_follows_the_preset_and_reaches_the_document`).
|
||||
- The Transform panel works out its Align to Pixel Grid checkbox once for each document revision and reuses it on later frames, and lists the selected objects' ids only when the box is clicked. The box shows the same state. With Select All of 99,500 objects (100,000 paths, 1,000 of them in 500 compound paths), working the state out on every frame took a median 33.5 ms of thread CPU time per frame in a release build on a loaded machine; the first frame after a change now takes 31.5 ms and later frames take about 1 ns (`panels::transform::tests::align_to_pixel_grid_kept_state_equals_a_full_measure`, `align_to_pixel_grid_state_is_measured_once_per_revision`, `pixel_aligned_state_timing`).
|
||||
- Break Link to Symbol and Object › Expand give a symbol instance's art the instance's own bounding box: after Reset Bounding Box the art stands square to the page, an object turned inside the symbol keeps its angle relative to the instance's box, a group added for the instance's opacity takes the instance's box, and the clip groups of 9-slice art take the angle of their cell. Compound shapes and Pathfinder receive an instance's art with the same angles (VectorCraft's own behavior; `bboxrotate::reset_bounding_box_then_expand_symbol_instance`, `reset_bounding_box_then_expand_keeps_the_angles_inside_the_symbol`, `expanding_a_faded_symbol_instance_gives_its_group_the_instance_box`, `expanding_a_reflected_symbol_instance_keeps_its_box`, `symbol_nine_slice::break_link_turns_the_cells_of_a_sliced_instance_with_its_box`, effects `outline_object_turns_an_instances_art_with_its_box`).
|
||||
- Object › Transform › Reset Bounding Box squares the box of every object inside the selected ones as well: the children of groups, compound paths, clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks. Ungroup and the release commands then bring back boxes square to the page (VectorCraft's own behavior; `bboxrotate::reset_bounding_box_squares_the_objects_inside_a_group`, `reset_bounding_box_squares_the_turned_members_of_a_square_group`, `reset_bounding_box_then_release_clipping_mask` and the other `reset_bounding_box_then_*` tests, `reset_bounding_box_leaves_the_art_of_an_unlinked_opacity_mask`).
|
||||
- After a rotation the Free Transform tool shows and drags the same turned bounding box as the Selection tool: its handles, their cursors and its rotate zone sit on the selection's own sides, a handle scales along those sides from the opposite handle ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-objects.html)), Cmd/Ctrl on a side handle shears along that side, and Perspective Distort and Free Distort start from the turned box's corners (`object.distort` takes `angle` with `from`) (`bboxrotate::free_transform_handles_turn_with_the_object_and_scale_along_its_axes`, `free_transform_shears_along_the_turned_side`, `free_transform_distort_starts_from_the_turned_box`, `xform::distort_reads_from_in_a_turned_frame_and_rejects_a_bad_angle`, tools `xform::free::tests::the_box_and_its_handles_turn_with_the_selection`).
|
||||
|
||||
Reference in New Issue
Block a user