mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 08:52:45 +01:00
train: #8354
This commit is contained in:
commit
98182cefe4
5 files changed
+256
-14
No files matched your search
@@ -997,26 +997,26 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect,
|
||||
snapping_menu(app, ui);
|
||||
}
|
||||
let Some(st) = app.session.active() else { return };
|
||||
let sel = st.selection.objects.clone();
|
||||
let count = st.selection.objects.len();
|
||||
let units = app.session.general_unit();
|
||||
let first = sel.first().and_then(|id| st.doc.node(*id));
|
||||
let first = st.selection.objects.first().and_then(|id| st.doc.node(*id));
|
||||
let anchors = anchor_controls(app);
|
||||
let label = match first {
|
||||
_ if app.session.tool_id() == "artboard" => tl!("Artboard"),
|
||||
Some(_) if sel.len() == 1 && anchors != AnchorControls::None => {
|
||||
Some(_) if count == 1 && anchors != AnchorControls::None => {
|
||||
tl!("Anchor Point")
|
||||
}
|
||||
Some(vectorcraft_doc::Node { kind: NodeKind::Image(im), .. }) if sel.len() == 1 => {
|
||||
Some(vectorcraft_doc::Node { kind: NodeKind::Image(im), .. }) if count == 1 => {
|
||||
if im.link.is_some() {
|
||||
tl!("Linked File")
|
||||
} else {
|
||||
tl!("Embedded")
|
||||
}
|
||||
}
|
||||
Some(n) if sel.len() == 1 && crate::panels::image_trace::is_trace(n) => {
|
||||
Some(n) if count == 1 && crate::panels::image_trace::is_trace(n) => {
|
||||
tl!("Image Tracing")
|
||||
}
|
||||
_ => tl!(crate::panels::appearance::object_label(app)),
|
||||
_ => tl!(crate::panels::appearance::summary(app, ui.ctx()).map_or("No Selection", |s| s.label)),
|
||||
};
|
||||
let has_first = first.is_some();
|
||||
let label = egui::RichText::new(label).font(theme::semibold(12.0)).color(t.text);
|
||||
@@ -1043,7 +1043,7 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect,
|
||||
if ui.available_width() >= 6.0 {
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
let reserve = transform_reserve(app, ui, !sel.is_empty());
|
||||
let reserve = transform_reserve(app, ui, count > 0);
|
||||
// An image or an Image Trace object shows its own controls in place of Fill and Stroke,
|
||||
// and leaves Fill and Stroke out while the Image Options group is off too. These groups,
|
||||
// the tool options, the envelope's and the symbol instances' each show a control only while
|
||||
@@ -1064,11 +1064,11 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect,
|
||||
if !image && group_on(app, "fillStroke") {
|
||||
fill_and_stroke(app, ui, reserve);
|
||||
}
|
||||
opacity_and_style(app, ui, t, opacity, !sel.is_empty(), reserve);
|
||||
opacity_and_style(app, ui, t, opacity, count > 0, reserve);
|
||||
// The Character group shows whole, with the Transform link's room left after it, or not at
|
||||
// all; left out, it leaves out the groups between it and the link too.
|
||||
let room = !group_on(app, "character") || crate::panels::character::control_bar(app, ui, reserve);
|
||||
if !groups_before_transform(app, ui, sel.len(), room) {
|
||||
if !groups_before_transform(app, ui, count, room) {
|
||||
// With the Transform group off, its link and X/Y/W/H fields take no room.
|
||||
trailing_select_similar(app, ui);
|
||||
erase_trailing(ui);
|
||||
|
||||
@@ -3592,6 +3592,30 @@ fn the_control_bar_keeps_its_label_and_menu_with_every_group_off() {
|
||||
assert!(!has(&bar, "Document Setup") && !has(&bar, "Preferences"), "{bar:?}");
|
||||
}
|
||||
|
||||
/// The Control bar's selection label follows a selection whose middle object changes while its
|
||||
/// length, first and last object stay the same, and a target circle with the selection unchanged.
|
||||
#[test]
|
||||
fn the_control_bar_label_follows_every_selected_object() {
|
||||
use crate::tests_removeanchors::{control_frame, has};
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let mut app = crate::VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 400, "height": 200})).unwrap();
|
||||
let id = |v: serde_json::Value| vectorcraft_doc::NodeId(v["id"].as_u64().unwrap());
|
||||
let r: Vec<_> = (0..3).map(|i| id(app.run("shape.rectangle", json!({"x": i * 30, "y": 10, "width": 20, "height": 20})).unwrap())).collect();
|
||||
let t = id(app.run("text.create", json!({"x": 10, "y": 100, "text": "Hi"})).unwrap());
|
||||
app.run("select.set", json!({ "ids": r })).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
let alike = crate::panels::appearance::object_label(&app);
|
||||
assert!(has(&control_frame(&mut app, &ctx, vec![]), alike), "{alike}");
|
||||
app.session.active_mut().unwrap().selection.objects[1] = t;
|
||||
let bar = control_frame(&mut app, &ctx, vec![]);
|
||||
assert!(has(&bar, "Mixed Objects"), "{bar:?}");
|
||||
let layer = app.session.active().unwrap().doc.default_layer().unwrap();
|
||||
app.session.active_mut().unwrap().selection.target = Some(layer);
|
||||
assert!(has(&control_frame(&mut app, &ctx, vec![]), "Layer"), "the targeted layer");
|
||||
}
|
||||
|
||||
/// `window.control.options {group, visible?}` turns a group of the Control bar's options on or
|
||||
/// off, or toggles it, and the panel menu's item shows it; an unknown or missing group, or a
|
||||
/// `visible` that is not true or false, is an error and changes nothing.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
//! fills/strokes for Duplicate and Delete. Delete on a selected Opacity row sets it back to
|
||||
//! Default (100%, Normal).
|
||||
|
||||
use std::sync::OnceLock;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
|
||||
use egui::{Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
@@ -476,9 +476,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
select_row(app, ui.ctx(), Sel::None);
|
||||
}
|
||||
ui.painter().line_segment([r.left_bottom(), r.right_bottom()], Stroke::new(1.0, t.input_border));
|
||||
let mix = mixed(app);
|
||||
let summary = summary(app, ui.ctx());
|
||||
let mix = summary.as_ref().and_then(|s| s.mixed(app));
|
||||
let mixed = mix.is_some();
|
||||
let label = tl!(object_label(app));
|
||||
let label = tl!(summary.as_ref().map_or("No Selection", |s| s.label));
|
||||
// A linked object names its graphic style ("Rectangle: Sunshine"), and so does new art
|
||||
// with nothing selected.
|
||||
let style = match app.session.selection_graphic_style() {
|
||||
@@ -497,7 +498,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
Some(n) => n.appearance.fill_paint(),
|
||||
None => app.session.paint.fill.clone(),
|
||||
};
|
||||
chip(ui, th, &fill, mix.as_ref().is_some_and(|m| m.fills_differ));
|
||||
chip(ui, th, &fill, mix.is_some_and(|m| m.fills_differ));
|
||||
if let Some(n) = node.as_ref().filter(|_| !mixed) {
|
||||
thumbnail_drag(ui, th, n.id);
|
||||
}
|
||||
@@ -505,7 +506,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
text(ui, r.left_center() + vec2(if hide_thumb { 8.0 } else { 46.0 }, 0.0), &label, true);
|
||||
match &node {
|
||||
// Objects that differ list what they share, under a note that they differ.
|
||||
Some(n) if let Some(m) = &mix => {
|
||||
Some(n) if let Some(m) = mix => {
|
||||
let (mr, _) = ui.allocate_exact_size(vec2(ui.available_width(), ROW), Sense::hover());
|
||||
let mut job = egui::text::LayoutJob::default();
|
||||
let format = egui::TextFormat { font_id: egui::FontId::proportional(12.0), color: t.text_dim, italics: true, ..Default::default() };
|
||||
@@ -606,6 +607,44 @@ struct Mixed {
|
||||
fills_differ: bool,
|
||||
}
|
||||
|
||||
/// The selection's [`object_label`] and [`mixed`] summary for the active document as of one
|
||||
/// revision and one list of appearance subjects ([`vectorcraft_doc::Selection::subjects`]), shared by
|
||||
/// the Control bar and the Appearance panel ([`summary`]).
|
||||
pub(crate) struct Summary {
|
||||
uid: u64,
|
||||
revision: u64,
|
||||
subjects: Vec<NodeId>,
|
||||
/// [`object_label`] of these subjects.
|
||||
pub(crate) label: &'static str,
|
||||
/// [`mixed`] of these subjects, worked out the first time the Appearance panel asks for it.
|
||||
mixed: OnceLock<Option<Mixed>>,
|
||||
}
|
||||
|
||||
impl Summary {
|
||||
/// [`mixed`] of the subjects this summary was made for.
|
||||
fn mixed<'a>(&'a self, app: &VectorcraftApp) -> Option<&'a Mixed> {
|
||||
self.mixed.get_or_init(|| mixed(app)).as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
/// The active document's [`Summary`], made again only when the document changes (its id or its
|
||||
/// revision) or the appearance subjects do, compared id by id. `None` with no document open.
|
||||
pub(crate) fn summary(app: &VectorcraftApp, ctx: &egui::Context) -> Option<Arc<Summary>> {
|
||||
let st = app.session.active()?;
|
||||
let subjects = st.selection.subjects();
|
||||
let id = egui::Id::unique("ap-summary");
|
||||
if let Some(s) = ctx.data(|d| d.get_temp::<Arc<Summary>>(id))
|
||||
&& s.uid == st.uid
|
||||
&& s.revision == st.revision
|
||||
&& s.subjects == subjects
|
||||
{
|
||||
return Some(s);
|
||||
}
|
||||
let s = Arc::new(Summary { uid: st.uid, revision: st.revision, subjects: subjects.to_vec(), label: object_label(app), mixed: OnceLock::new() });
|
||||
ctx.data_mut(|d| d.insert_temp(id, s.clone()));
|
||||
Some(s)
|
||||
}
|
||||
|
||||
/// `params` of an item or effect command the panel runs, with `aligned` when the selected objects'
|
||||
/// stacks differ: its indices are then rows of the first object's stack, which each other object
|
||||
/// edits where it has them (the panel lists only the rows they share).
|
||||
|
||||
@@ -1017,6 +1017,184 @@ fn a_mixed_selection_lists_what_its_objects_share() {
|
||||
assert_eq!(frame(&mut app).iter().find(|t| *t != "?").map(String::as_str), Some("Mixed Objects"));
|
||||
}
|
||||
|
||||
/// The [`summary`] `ctx` holds for the active document, checked field by field against what
|
||||
/// [`object_label`] and [`mixed`] work out from scratch.
|
||||
fn fresh_summary(app: &VectorcraftApp, ctx: &egui::Context) -> Arc<Summary> {
|
||||
let s = summary(app, ctx).unwrap();
|
||||
assert_eq!(s.label, object_label(app), "the kind label");
|
||||
let parts = |m: &Mixed| (m.shared.clone(), m.transparency, m.fills_differ);
|
||||
assert_eq!(s.mixed(app).map(parts), mixed(app).as_ref().map(parts), "the mixed summary");
|
||||
s
|
||||
}
|
||||
|
||||
/// The object row's kind and the Mixed Appearances summary are worked out once per document
|
||||
/// revision and list of subjects: a repaint with nothing changed reuses them, and they follow an
|
||||
/// edit, Undo and Redo, a selection that changes only in the middle, a target circle and another
|
||||
/// document at the same revision.
|
||||
#[test]
|
||||
fn the_selection_summary_is_reused_until_the_document_or_its_subjects_change() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
let ctx = egui::Context::default();
|
||||
let id = |v: Value| NodeId(v["id"].as_u64().unwrap());
|
||||
let art = |app: &mut VectorcraftApp| -> (Vec<NodeId>, NodeId) {
|
||||
app.run("file.new", json!({"width": 300, "height": 200})).unwrap();
|
||||
let r = (0..3).map(|i| id(app.run("shape.rectangle", json!({"x": i * 30, "y": 0, "width": 20, "height": 20})).unwrap())).collect();
|
||||
(r, id(app.run("text.create", json!({"x": 0, "y": 100, "text": "Hi"})).unwrap()))
|
||||
};
|
||||
let (r, t) = art(&mut app);
|
||||
app.run("select.set", json!({"ids": r})).unwrap();
|
||||
let s = fresh_summary(&app, &ctx);
|
||||
assert!(s.mixed(&app).is_none(), "alike rectangles");
|
||||
assert!(Arc::ptr_eq(&s, &fresh_summary(&app, &ctx)), "a repaint with nothing changed reuses the summary");
|
||||
// An edit of the middle object, then Undo and Redo.
|
||||
app.run("transparency.set", json!({"ids": [r[1]], "opacity": 50})).unwrap();
|
||||
assert!(fresh_summary(&app, &ctx).mixed(&app).is_some_and(|m| m.transparency), "the middle one's opacity differs");
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert!(fresh_summary(&app, &ctx).mixed(&app).is_none(), "undone");
|
||||
app.run("edit.redo", json!({})).unwrap();
|
||||
assert!(fresh_summary(&app, &ctx).mixed(&app).is_some(), "redone");
|
||||
// The middle id changes at the same revision, length, first and last id.
|
||||
app.session.active_mut().unwrap().selection.objects[1] = t;
|
||||
assert_eq!(fresh_summary(&app, &ctx).label, "Mixed Objects");
|
||||
// A target circle with the selected objects unchanged, and back.
|
||||
let layer = app.session.active().unwrap().doc.default_layer().unwrap();
|
||||
app.session.active_mut().unwrap().selection.target = Some(layer);
|
||||
assert_eq!(fresh_summary(&app, &ctx).label, "Layer");
|
||||
app.session.active_mut().unwrap().selection.target = None;
|
||||
assert_eq!(fresh_summary(&app, &ctx).label, "Mixed Objects");
|
||||
// Another document with the same ids selected at the same revision, where the first object's
|
||||
// opacity differs instead.
|
||||
let revision = app.session.active().unwrap().revision;
|
||||
assert!(fresh_summary(&app, &ctx).mixed(&app).is_some_and(|m| !m.transparency));
|
||||
let (r2, t2) = art(&mut app);
|
||||
assert_eq!((&r2, t2), (&r, t), "the second document numbers its objects alike");
|
||||
app.run("transparency.set", json!({"ids": [r[0]], "opacity": 50})).unwrap();
|
||||
let st = app.session.active_mut().unwrap();
|
||||
st.selection.objects = vec![r[0], t, r[2]];
|
||||
st.selection.target = None;
|
||||
st.revision = revision;
|
||||
assert!(fresh_summary(&app, &ctx).mixed(&app).is_some_and(|m| m.transparency), "the second document's own summary");
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
assert!(fresh_summary(&app, &ctx).mixed(&app).is_some_and(|m| !m.transparency), "the first document's again");
|
||||
}
|
||||
|
||||
/// The CPU time this thread has used, from Linux's scheduler statistics; `None` elsewhere.
|
||||
fn thread_cpu() -> Option<std::time::Duration> {
|
||||
let stat = std::fs::read_to_string("/proc/thread-self/schedstat").ok()?;
|
||||
stat.split_whitespace().next()?.parse().ok().map(std::time::Duration::from_nanos)
|
||||
}
|
||||
|
||||
/// The milliseconds `f` takes: this thread's CPU time where Linux reports it, otherwise the wall clock.
|
||||
fn time_ms(f: impl FnOnce()) -> f64 {
|
||||
let d = match thread_cpu() {
|
||||
Some(before) => {
|
||||
f();
|
||||
thread_cpu().map_or(std::time::Duration::ZERO, |after| after.saturating_sub(before))
|
||||
}
|
||||
None => {
|
||||
let start = std::time::Instant::now();
|
||||
f();
|
||||
start.elapsed()
|
||||
}
|
||||
};
|
||||
d.as_secs_f64() * 1000.0
|
||||
}
|
||||
|
||||
/// A document of `n` small rectangles, all selected; with `mixed`, every second one at 50% opacity.
|
||||
fn many_rectangles(n: usize, mixed: bool) -> VectorcraftApp {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 800, "height": 600})).unwrap();
|
||||
let r = app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 4, "height": 4})).unwrap()["id"].as_u64().unwrap();
|
||||
let mut d = vectorcraft_doc::Document::clone(&app.session.active().unwrap().doc);
|
||||
let template = d.node(NodeId(r)).unwrap().clone();
|
||||
let layer = d.layers[0].id;
|
||||
d.children_mut(Some(layer)).unwrap().clear();
|
||||
let mut ids = Vec::with_capacity(n);
|
||||
for i in 0..n {
|
||||
let mut node = template.clone();
|
||||
node.id = d.alloc_id();
|
||||
if mixed && i % 2 == 1 {
|
||||
node.opacity = 0.5;
|
||||
}
|
||||
ids.push(d.insert(Some(layer), usize::MAX, node).unwrap());
|
||||
}
|
||||
app.session.add_document(d, None);
|
||||
app.session.active_mut().unwrap().selection.objects = ids;
|
||||
app
|
||||
}
|
||||
|
||||
/// Timings of the selection summary the Control bar and the Appearance panel show on each repaint,
|
||||
/// on 5,000, 20,000 and 200,000 selected rectangles, alike and with every second one's opacity
|
||||
/// different, in milliseconds per repaint: worked out from scratch (`object_label` for the Control
|
||||
/// bar, then `mixed` and `object_label` for the panel); through [`summary`], whose first repaint
|
||||
/// works it out and the rest reuse it; and through [`summary`] with its stored entry removed before
|
||||
/// every repaint, as when the document or the selection changes each time. They run in turn on the same document,
|
||||
/// 7 runs each, and the results are checked equal. Ignored by default; it prints the median, fastest and slowest run
|
||||
/// and sets no bound on them:
|
||||
/// `cargo test --release -p vectorcraft-ui-egui --lib selection_summary_perf -- --ignored --nocapture`.
|
||||
#[test]
|
||||
#[ignore = "a benchmark: run with --ignored --nocapture"]
|
||||
fn selection_summary_perf() {
|
||||
const RUNS: usize = 7;
|
||||
const REPAINTS: usize = 20;
|
||||
let stats = |mut v: Vec<f64>| {
|
||||
v.sort_by(f64::total_cmp);
|
||||
format!("{:.3} ({:.3}-{:.3})", v[v.len() / 2], v[0], v[v.len() - 1])
|
||||
};
|
||||
eprintln!("selection_summary_perf: {}", if thread_cpu().is_some() { "thread CPU time" } else { "wall clock" });
|
||||
eprintln!(
|
||||
"selection_summary_perf: {:>8} {:<6} {:>28} {:>28} {:>28}",
|
||||
"selected", "kind", "from scratch ms (min-max)", "summary ms (min-max)", "summary, changed ms (min-max)"
|
||||
);
|
||||
for n in [5_000, 20_000, 200_000] {
|
||||
for mixed_case in [false, true] {
|
||||
let app = many_rectangles(n, mixed_case);
|
||||
let (mut old, mut new, mut changed) = (vec![], vec![], vec![]);
|
||||
for _ in 0..RUNS {
|
||||
let mut seen = None;
|
||||
old.push(
|
||||
time_ms(|| {
|
||||
for _ in 0..REPAINTS {
|
||||
let bar = object_label(&app);
|
||||
let mix = mixed(&app);
|
||||
let row = object_label(&app);
|
||||
seen = Some((bar, row, mix.map(|m| (m.shared, m.transparency, m.fills_differ))));
|
||||
}
|
||||
}) / REPAINTS as f64,
|
||||
);
|
||||
let ctx = egui::Context::default();
|
||||
let mut cached = None;
|
||||
new.push(
|
||||
time_ms(|| {
|
||||
for _ in 0..REPAINTS {
|
||||
let bar = summary(&app, &ctx).map_or("No Selection", |s| s.label);
|
||||
let s = summary(&app, &ctx).unwrap();
|
||||
let mix = s.mixed(&app).map(|m| (m.shared.clone(), m.transparency, m.fills_differ));
|
||||
cached = Some((bar, s.label, mix));
|
||||
}
|
||||
}) / REPAINTS as f64,
|
||||
);
|
||||
assert_eq!(cached, seen, "{n} {mixed_case}");
|
||||
let mut fresh = None;
|
||||
changed.push(
|
||||
time_ms(|| {
|
||||
for _ in 0..REPAINTS {
|
||||
ctx.data_mut(|d| d.remove::<Arc<Summary>>(egui::Id::unique("ap-summary")));
|
||||
let bar = summary(&app, &ctx).map_or("No Selection", |s| s.label);
|
||||
let s = summary(&app, &ctx).unwrap();
|
||||
let mix = s.mixed(&app).map(|m| (m.shared.clone(), m.transparency, m.fills_differ));
|
||||
fresh = Some((bar, s.label, mix));
|
||||
}
|
||||
}) / REPAINTS as f64,
|
||||
);
|
||||
assert_eq!(fresh, seen, "{n} {mixed_case}");
|
||||
}
|
||||
let kind = if mixed_case { "mixed" } else { "alike" };
|
||||
eprintln!("selection_summary_perf: {:>8} {:<6} {:>28} {:>28} {:>28}", n, kind, stats(old), stats(new), stats(changed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The panel's subject is the `Arc` the document holds for the selected object, a targeted group
|
||||
/// or a targeted layer, not a copy of it; nothing with nothing selected.
|
||||
#[test]
|
||||
|
||||
@@ -2368,6 +2368,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Live objects in documents with many symbols:** a live object, or an object with effects, that shows symbols or patterns is not walked again in a later frame to find them while the document's symbols and patterns stay the same. One that shows a placed file is walked in every frame. At 1000 × 1000 pixels, a page of 2,000 envelopes around instances of the last 2,000 of 10,000 symbols takes 30 ms a frame, and 83 ms when every frame walks them again, with the same pixels.
|
||||
|
||||
- **Control bar and task bar on large paths:** the Control bar and the contextual task bar read the first selected object in place each frame instead of copying it; the task bar copies the object only when it is a basic shape, for its Shape Properties. With one selected open path of 200,000 anchors, an idle frame with both bars shown takes 3.8 ms in a release build instead of 8.0 ms (medians of five interleaved runs). Tests: `the_control_bar_label_follows_edits_undo_documents_and_selection`, `the_task_bar_follows_the_active_document`, `the_task_bar_follows_edits_and_undo`.
|
||||
- **Control bar label and Mixed Appearances on large selections:** the Control bar's selection label and the Appearance panel's object row, Mixed Appearances note and shared rows are worked out once for each document revision and list of selected or targeted objects, and repaints with neither changed reuse them. The Control bar no longer copies the selection's ids on each repaint. With 200,000 selected rectangles, the label and summary take 2.1 ms of CPU time per repaint in a release build instead of 58.4 ms when the rectangles are alike, and 3.0 ms instead of 80.7 ms when every second one has another opacity (medians of seven interleaved runs of 20 repaints each). Tests: `the_selection_summary_is_reused_until_the_document_or_its_subjects_change` in `crates/ui-egui/src/panels/appearance/tests.rs`, `the_control_bar_label_follows_every_selected_object` in `crates/ui-egui/src/chrome/tests.rs`.
|
||||
- **Panels on large selections:** the Properties, Transform, Brushes, Appearance, Transparency and Image Trace panels read the selected object where the document holds it each frame instead of copying it, and the Transparency panel removes the mask from a copy of the object only when it draws the object's thumbnail again. With one selected open path of 200,000 anchors, an idle repaint uses 72.9 µs of CPU time in a release build instead of 88.4 µs for the Properties panel, 27.5 µs instead of 37.2 µs for the Appearance panel and 19.6 µs instead of 29.8 µs for the Transparency panel with its thumbnails shown (medians of seven interleaved runs). Tests: `first_selected_is_the_node_the_document_holds`, `first_subject_is_the_node_the_document_holds`, `panels_show_the_selected_object_after_an_edit_and_after_undo`, `state_holds_the_documents_node_and_the_object_thumbnail_leaves_out_the_mask`.
|
||||
- **Paste of many objects:** Paste leaves pasted copies as they are when no resource has another name or color in the document and the objects link no graphic style. It looks up the pasted type in one walk of the tree. A paste and undo of 20,000 rectangles in 200 groups uses 49.2 ms of CPU time in a release build instead of 59.4 ms, and of 5,000 point type objects 25.3 ms instead of 29.4 ms (medians of seven interleaved rounds, each round the CPU time of a 61-paste run minus a 1-paste run, divided by 60). Tests: `crates/engine/tests/it/paste_many.rs`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user