From 77a8a0137561eb5c00e493632fdbcfbcccc2895c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 13:04:02 -0800 Subject: [PATCH 01/24] Effects: a raster effect that looks across the whole object keeps its raster across pans An effect that reads anywhere in its object (Torn Edges, Cutout, Radial Blur, SVG filters) is filtered over the whole object at a lower resolution once the object passes the pixel budget. That raster was stored cropped to the view, so every pan missed it and filtered the object again: about one second a frame at 6400% in a 1280 x 800 view. - The raster of the whole object is kept and drawn again after pans by whole device pixels, while its origin, scale and size match what a fresh render makes and the output grid also moves by whole pixels. - Each frame draws it through a copy resampled to the view's pixels, kept for frames through the same view. - When the effect cache is over budget, whole rasters give way to their view copies before any entry is evicted, and a copy that alone exceeds the budget is not made. - The objects a render hides are part of a cached raster's inputs, so hiding a member of an object with a cached effect filters it again. --- crates/render/src/frame.rs | 13 +++ crates/render/src/fx/pixels.rs | 158 +++++++++++++++++++++++++------ crates/render/src/fx/raster.rs | 30 ++++-- crates/render/src/fx/renderer.rs | 1 + crates/render/src/fx/tests.rs | 109 +++++++++++++++++++++ crates/render/src/pattern.rs | 2 + crates/render/src/renderer.rs | 20 +++- 7 files changed, 297 insertions(+), 36 deletions(-) diff --git a/crates/render/src/frame.rs b/crates/render/src/frame.rs index 49e252d206..0c58cdf1b4 100644 --- a/crates/render/src/frame.rs +++ b/crates/render/src/frame.rs @@ -1,3 +1,5 @@ +use std::hash::{DefaultHasher, Hash, Hasher}; + use super::options::{AntiAlias, RenderOptions}; use super::threads::single_threaded_context; use super::{ @@ -224,6 +226,8 @@ pub(crate) struct Frame<'a> { /// Size of one of this frame's pixels in document units. pub(crate) px: f64, pub(crate) opts: &'a RenderOptions, + /// The order-independent fingerprint of `opts.hidden`, shared by this frame's raster lookups. + pub(crate) hidden_inputs: u64, /// What colours paint as: screen colours, or one ink plane of a CMYK document (see [`ink`]). pub(crate) ink: Ink, /// Document → pixels of the output being drawn: `view` itself, except while an export draws @@ -236,6 +240,15 @@ pub(crate) struct Frame<'a> { } impl Frame<'_> { + /// Hash the hidden objects once for the options a frame draws with. + pub(crate) fn hidden_inputs(opts: &RenderOptions) -> u64 { + let mut hidden: Vec<_> = opts.hidden.iter().collect(); + hidden.sort_unstable(); + let mut h = DefaultHasher::new(); + hidden.hash(&mut h); + h.finish() + } + pub(crate) fn reject_patch(&self) -> bool { self.patch.is_some_and(|hit| { hit.set(true); diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index da169f4d68..7eb8f220e3 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -1,10 +1,10 @@ use super::bounds::{apply_carrying, item_effects, item_raster}; -use super::entries::{Content, DocInputs, Drawn, FX_RASTER_BUDGET, Inputs, ItemGeom, KeptImage, Made, Reads, feather_outline}; +use super::entries::{Content, DocInputs, Drawn, FX_RASTER_BUDGET, Inputs, ItemGeom, KeptImage, Made, Reads, feather_outline, raster_bytes}; #[cfg(test)] use super::raster::RASTERIZED; use super::raster::{ DRAG_PIXEL_BUDGET, PIXEL_BUDGET, PixelEntry, ViewCrop, content_changing, doc_raster_ppi, drag_scale, draw_placed, draw_scaled, filter_region, - filter_region_within, hard_edged, image_size, linear_key, looks_around, pan_margin, + filter_region_within, hard_edged, image_size, linear_key, looks_around, pan_margin, panned_whole, }; use super::{ Affine, AppearanceItem, Arc, BezPath, Channels, DefaultHasher, Document, FillRule, Frame, GeomContext, Hash, Hasher, Ink, Node, PixelFx, @@ -69,14 +69,18 @@ impl Renderer { /// raster holds at most [`PIXEL_BUDGET`] pixels and [`crate::MAX_RASTER_SIDE`] a side: content /// over the budget is cropped to the view (content with a [`Kept`] image to its window) when /// every effect only looks nearby, and content still over either limit is rendered at a lower - /// resolution. A whole raster at full resolution is cached while the object, the - /// zoom and what the content reads ([`Inputs`]) stay the same (panning only moves it), and - /// while interacting after the content only moved ([`Self::move_pixel_content`]). A cropped or - /// lower-resolution raster is cached while the object, the zoom and what the content reads stay - /// the same and a pan keeps the view inside the rect it was made for ([`PixelEntry::view`]): the - /// view, and for a raster cropped to it that is made again at the same zoom and rotation, outside - /// a drag and for content without a [`Kept`] image, the view with [`pan_margin`] around it. A - /// lower-resolution one is kept resampled to the view's pixels ([`Self::resampled`]). + /// resolution. A raster of the whole content is cached while the object, the zoom and what the + /// content reads ([`Inputs`]) stay the same (panning only moves it, and at a lower resolution + /// only by whole view and output pixels with the same output linear coefficients and the same + /// raster origin, scale and size as a fresh render, [`PixelEntry::pan`]), and at full resolution + /// while interacting after the content only moved ([`Self::move_pixel_content`]). One at a + /// lower resolution draws through its copy resampled + /// to the view's pixels ([`Self::draw_kept`]). A cropped raster is cached while the object, the + /// zoom and what the content reads stay the same and a pan keeps the view inside the rect it + /// was made for ([`PixelEntry::view`]): the view, and for a raster cropped to it that is made + /// again at the same zoom and rotation, outside a drag and for content without a [`Kept`] image, + /// the view with [`pan_margin`] around it. A cropped one at a lower resolution is kept + /// resampled to the view's pixels ([`Self::resampled`]). /// While dragging, content without such a raster to draw renders within [`DRAG_PIXEL_BUDGET`] /// pixels and is not cached, except content cropped to the view whose raster can move: its /// raster covers the view with [`pan_margin`] around it, and the drag's later frames move it with @@ -173,11 +177,13 @@ impl Renderer { let (aw, ah) = (around.width().ceil() + 1.0, around.height().ceil() + 1.0); (DRAG_PIXEL_BUDGET / (aw * ah)).sqrt().min(side / aw).min(side / ah).min(1.0) }); - // The cached raster: of the whole content at full size at this zoom, else of this view (and - // the margin around it). + // The cached raster: of the whole content at this zoom (at full size, or at a lower + // resolution when an effect looks anywhere in the object), else of this view (and the margin + // around it). + let entire = fits || margin.is_none(); let whole = fits && k >= 1.0; self.stats.view_sized += usize::from(!whole); - let in_view = (!whole).then(|| ViewCrop::of(f.view, room)); + let in_view = (!entire).then(|| ViewCrop::of(f.view, room)); let stamp = self.stamp; let channels = match f.ink.base() { Ink::Cmy => effects::pixel::Channels::CmyPlane, @@ -197,7 +203,18 @@ impl Renderer { }); let interacting = f.opts.interacting; let in_place = |e: &PixelEntry| match e.view { - None => whole, + None => e.pan.map_or(whole, |(pan, output_pan, output_linear)| { + let p = f.view * e.anchor; + entire + && panned_whole(pan, f.view) + && output_linear == linear_key(f.output) + && panned_whole(output_pan, f.output) + && e.k.to_bits() == k.to_bits() + && f64::from(e.image.width()) == w + && f64::from(e.image.height()) == h + && (p.x + e.rel.0).round() == x0 + && (p.y + e.rel.1).round() == y0 + }), Some(v) => !whole && (e.valid.is_some() || v.serves(f.view, screen)), }; // A raster a drag kept draws during a drag, while what the frame shows of the content lies @@ -229,7 +246,7 @@ impl Renderer { if e.image_left_out { self.image_left_out = self.image_left_out.map(|_| true); } - draw_scaled(ctx, image, at, k); + self.draw_kept(ctx, f, key, screen, (image, at, k)); return; } // During a drag, content without a raster to draw renders within the drag's budget (#2558). @@ -368,6 +385,10 @@ impl Renderer { Some((image, x, y)) => (image, x, y, 1.0), None => (image, x0, y0, k), }; + // A raster of the whole content at a lower resolution is kept whole for pans, and drawn + // through its copy resampled to the view's pixels ([`Self::draw_kept`]). + let low = key.is_some() && in_view.is_none() && k < 1.0 && content.kept.is_none_or(|k| k.shared) && !drag_keep; + let mut kept_low = None; // A cancelled export drew part of the content: that raster isn't kept for later frames. if !vectorcraft_doc::cancel::is_cancelled() && let Some(((key, made), inputs)) = key.zip(made).zip(inputs) @@ -386,8 +407,10 @@ impl Renderer { rel, k, image: image.clone(), - view: in_view, + view: (!whole && !low).then(|| ViewCrop::of(f.view, room)), valid, + pan: low.then(|| (f.view.translation(), f.output.translation(), linear_key(f.output))), + shown: None, made, inputs, moved, @@ -395,8 +418,8 @@ impl Renderer { image_left_out, stamp, }; - self.pixel_fx.insert(key, entry); - self.trim_fx_rasters(FX_RASTER_BUDGET); + self.keep_pixel_content(key, entry); + kept_low = low.then_some(key); } // An image over the limits was drawn at a frame's resolution: its raster is kept. The // placements of a copied image each draw their own (`Kept::shared`). @@ -406,7 +429,65 @@ impl Renderer { *kept.image.borrow_mut() = Some(KeptImage::Raster(image.clone(), place, failed, image_left_out)); if f.view == call { draw_scaled(ctx, image, (x0, y0), k) } else { draw_placed(ctx, image, call * place) } } - None => draw_scaled(ctx, image, (x0, y0), k), + None => self.draw_kept(ctx, f, kept_low, screen, (image, (x0, y0), k)), + } + } + + /// Keep `entry` for `key` and trim the cache, deferring trimming for a whole raster at a lower + /// resolution until [`Self::draw_kept`] draws it. + fn keep_pixel_content(&mut self, key: (usize, usize, Ink), entry: PixelEntry) { + let low = entry.pan.is_some(); + self.pixel_fx.insert(key, entry); + if !low { + self.trim_fx_rasters(FX_RASTER_BUDGET); + } + } + + /// Draw `(image, at, k)` as [`draw_scaled`] draws `image` at `at`, `1 / k` device pixels a + /// pixel. When it is the raster kept for `key` of the whole content at a lower resolution + /// ([`PixelEntry::pan`]), in the frame `f` onto `screen`, its copy resampled to the device + /// pixels of a frame through the same view ([`PixelEntry::shown`]) is drawn instead, made again + /// for a frame it does not serve. A copy that alone exceeds [`FX_RASTER_BUDGET`] is not made; + /// the raster draws scaled. When the cache exceeds its budget, [`Self::trim_fx_rasters`] + /// replaces whole rasters with their view copies before evicting entries. A raster that covers + /// none of `screen`'s pixels draws scaled. + fn draw_kept( + &mut self, + ctx: &mut RenderContext, + f: &Frame, + key: Option<(usize, usize, Ink)>, + screen: Rect, + (image, at, k): (std::sync::Arc, (f64, f64), f64), + ) { + let Some((key, e)) = key.and_then(|key| self.pixel_fx.get(&key).filter(|e| e.pan.is_some()).map(|e| (key, e))) else { + return draw_scaled(ctx, image, at, k); + }; + let p = f.view * e.anchor; + if let Some((_, copy, rel)) = e.shown.as_ref().filter(|(v, ..)| v.serves(f.view, screen)) { + draw_scaled(ctx, copy.clone(), ((p.x + rel.0).round(), (p.y + rel.1).round()), 1.0); + return; + } + let covered = Rect::new(at.0, at.1, at.0 + f64::from(image.width()) / k, at.1 + f64::from(image.height()) / k).intersect(screen); + let (w, h) = (covered.x1.ceil() - covered.x0.floor(), covered.y1.ceil() - covered.y0.floor()); + if w * h * 4.0 > FX_RASTER_BUDGET as f64 { + if let Some(e) = self.pixel_fx.get_mut(&key) { + e.shown = None; + } + self.trim_fx_rasters(FX_RASTER_BUDGET); + return draw_scaled(ctx, image, at, k); + } + match self.resampled(f, image.clone(), at, k, screen) { + Some((copy, x, y)) => { + if let Some(e) = self.pixel_fx.get_mut(&key) { + e.shown = Some((ViewCrop::of(f.view, screen), copy.clone(), (x - p.x, y - p.y))); + } + self.trim_fx_rasters(FX_RASTER_BUDGET); + draw_scaled(ctx, copy, (x, y), 1.0); + } + None => { + self.trim_fx_rasters(FX_RASTER_BUDGET); + draw_scaled(ctx, image, at, k); + } } } @@ -512,9 +593,10 @@ impl Renderer { } /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the - /// color settings, the edge smoothing, whether dashed strokes draw as solid lines, the document's raster effects resolution (which a - /// Rasterize or De-Interlace anywhere in the content follows), the knockout `n` inherits and, - /// while `n` holds the isolated group, isolation mode; the pattern definitions, symbols and + /// color settings, the edge smoothing, the hidden objects, whether dashed strokes draw as solid + /// lines, the document's raster effects resolution (which a Rasterize or De-Interlace anywhere + /// in the content follows), the knockout `n` inherits and, while `n` holds the isolated group, + /// isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the /// layer's Dim Images and the options they are drawn with (with /// [`crate::RenderOptions::kept_images_only`], also which pixels and undecodable notes the @@ -532,6 +614,7 @@ impl Renderer { f.opts.hide_guides.hash(&mut h); // Cached effects can include dashed strokes drawn as solid lines. f.opts.solid_dashes.hash(&mut h); + f.hidden_inputs.hash(&mut h); if let Some((isolated, path)) = self.isolation_path(f) && n.id != isolated && path.contains(&n.id) @@ -620,16 +703,35 @@ impl Renderer { d } - /// Drop the least recently drawn shadow and filtered-content rasters beyond `budget` bytes - /// ([`FX_RASTER_BUDGET`]). + /// Replace whole rasters that have view copies with those copies, least recently drawn first, + /// then evict the least recently drawn shadow and filtered-content entries until they fit + /// `budget` bytes ([`FX_RASTER_BUDGET`]). pub(super) fn trim_fx_rasters(&mut self, budget: usize) { - let shadows = self.shadows.iter().map(|(k, e)| (e.stamp, false, *k, e.bytes())); - let pixels = self.pixel_fx.iter().map(|(k, e)| (e.stamp, true, *k, e.bytes())); - let mut all: Vec<_> = shadows.chain(pixels).collect(); - let mut total: usize = all.iter().map(|e| e.3).sum(); + let mut total: usize = self.shadows.values().map(|e| e.bytes()).sum::() + self.pixel_fx.values().map(|e| e.bytes()).sum::(); if total <= budget { return; } + let mut copies: Vec<_> = self.pixel_fx.values_mut().filter(|e| e.pan.is_some() && e.shown.is_some()).collect(); + copies.sort_unstable_by_key(|e| e.stamp); + for e in copies { + if total <= budget { + break; + } + if let Some((view, copy, rel)) = e.shown.take() { + total -= raster_bytes(&e.image); + e.image = copy; + e.k = 1.0; + e.rel = rel; + e.view = Some(view); + e.pan = None; + } + } + if total <= budget { + return; + } + let shadows = self.shadows.iter().map(|(k, e)| (e.stamp, false, *k, e.bytes())); + let pixels = self.pixel_fx.iter().map(|(k, e)| (e.stamp, true, *k, e.bytes())); + let mut all: Vec<_> = shadows.chain(pixels).collect(); all.sort_unstable_by_key(|e| e.0); for (_, pixel, key, bytes) in all { if total <= budget { diff --git a/crates/render/src/fx/raster.rs b/crates/render/src/fx/raster.rs index 02bf918089..5b9d8ca120 100644 --- a/crates/render/src/fx/raster.rs +++ b/crates/render/src/fx/raster.rs @@ -90,16 +90,28 @@ pub(crate) struct PixelEntry { pub(super) rel: (f64, f64), pub(super) k: f64, pub(crate) image: std::sync::Arc, - /// For a raster of the content's whole reach at full size, `None`: it draws after a pan too. - /// For one cropped to the view, or made at a lower resolution, the view and the rect it was - /// made for: it draws only there, so dragging other art over the object keeps it (a wide blur, - /// or any blur zoomed in, reaches past the pixel budget). + /// For a raster of the content's whole reach, `None`: it draws after a pan too. For one + /// cropped to the view, the view and the rect it was made for: it draws only there, so + /// dragging other art over the object keeps it (a wide blur, or any blur zoomed in, reaches + /// past the pixel budget). pub(super) view: Option, /// For a raster a drag's frame kept of content cropped to the view, the device pixels (against /// the anchor's view position) whose pixels the effects decided with all they look at: the /// drag's later frames move the raster with its object while what they show of it lies within /// ([`Renderer::move_pixel_content`]). `None` for other rasters. pub(super) valid: Option, + /// For a raster of the content's whole reach made at a lower resolution than the view's, the + /// pans of the view and output it was made through, and the output's linear coefficients: it + /// draws when both grids pan by whole pixels ([`panned_whole`]), the output's linear + /// coefficients stay the same, its rounded origin matches a fresh render's floored origin, + /// and its scale and size match a fresh render's. `None` for other rasters. + pub(super) pan: Option<(Vec2, Vec2, [u64; 4])>, + /// For such a raster, its pixels resampled to the device pixels of the last frame that drew it, + /// the view and rect they were made for, and their top-left against the anchor's view position: + /// a frame they serve copies them ([`Renderer::draw_kept`]). Copies that alone exceed the cache + /// budget are not made. When the cache exceeds its budget, [`Renderer::trim_fx_rasters`] + /// replaces whole rasters with their view copies before evicting entries. + pub(super) shown: Option<(ViewCrop, std::sync::Arc, (f64, f64))>, pub(super) made: Made, /// What the content read when the raster was made, with the channels the effects ran on and, /// under De-Interlace, the raster resolution. @@ -121,10 +133,16 @@ pub(crate) struct PixelEntry { impl PixelEntry { /// The bytes it holds, for [`FX_RASTER_BUDGET`]. pub(crate) fn bytes(&self) -> usize { - raster_bytes(&self.image) + self.made.bytes() + raster_bytes(&self.image) + self.shown.as_ref().map_or(0, |(_, copy, _)| raster_bytes(copy)) + self.made.bytes() } } +/// Is `view` panned by whole device pixels from a view whose pan was `pan`? +pub(super) fn panned_whole(pan: Vec2, view: Affine) -> bool { + let d = view.translation() - pan; + (d - Vec2::new(d.x.round(), d.y.round())).hypot() < 1e-6 +} + /// The four linear coefficients of `view` (zoom and rotation, not the pan), as cache keys. pub(crate) fn linear_key(view: Affine) -> [u64; 4] { let c = view.as_coeffs(); @@ -153,7 +171,7 @@ impl ViewCrop { let d = view.translation() - self.pan; let whole = Vec2::new(d.x.round(), d.y.round()); let s = screen - whole; - (d - whole).hypot() < 1e-6 && s.x0 >= self.screen.x0 && s.y0 >= self.screen.y0 && s.x1 <= self.screen.x1 && s.y1 <= self.screen.y1 + panned_whole(self.pan, view) && s.x0 >= self.screen.x0 && s.y0 >= self.screen.y0 && s.x1 <= self.screen.x1 && s.y1 <= self.screen.y1 } /// The rect the raster was made for, in the device pixels of a frame through `view` that it diff --git a/crates/render/src/fx/renderer.rs b/crates/render/src/fx/renderer.rs index c119ef8b64..ebc82abeb1 100644 --- a/crates/render/src/fx/renderer.rs +++ b/crates/render/src/fx/renderer.rs @@ -1142,6 +1142,7 @@ mod tests { visible: Rect::new(0.0, 0.0, 100.0, 100.0), px: 1.0, opts: &opts, + hidden_inputs: Frame::hidden_inputs(&opts), ink: Ink::Display, output: Affine::IDENTITY, plates: None, diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index be44374572..727a09996f 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -1889,6 +1889,115 @@ fn a_zoomed_drag_keeps_the_sampling_footprint_inside_the_valid_crop() { assert_eq!(r.stats.previewed, 1, "the sampling footprint outside the valid crop filters the content again"); } +/// At 6400% a 200 × 150 pt rectangle with Torn Edges, which looks anywhere in the object, covers +/// 12800 × 9600 px, past the pixel budget, so its raster holds the whole object at a lower +/// resolution. The view shows its torn right edge. Pans by whole pixels with the same sampling +/// grid draw that raster again, and a frame through the same view copies its pixels resampled to +/// the view; a new fill, color mode or zoom, or a pan by part of a pixel, filters the content +/// again. +#[test] +fn pans_draw_the_lower_resolution_raster_of_the_whole_object_again() { + let mut d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let id = d.layers[0].children().unwrap()[0].id; + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |zoom: f64, dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(zoom) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let first = r.render(&d, 1280, 800, view(64.0, 0.0), &opts); + assert!(first.pixels.as_chunks::<4>().0.iter().any(|pixel| *pixel != first.pixel(0, 0)), "the view shows the torn edge"); + assert_eq!(r.pixel_fx.len(), 1); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + let image = kept.image.clone(); + let drawn = |r: &Renderer, image: &Arc| r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, image)); + for dx in [40.0, 80.0, -40.0] { + let pixels = r.render(&d, 1280, 800, view(64.0, dx), &opts).pixels; + assert!(drawn(&r, &image), "a pan of {dx} px draws the kept raster"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(64.0, dx), &opts).pixels, "a pan of {dx} px as a new renderer draws it"); + } + let copy = |r: &Renderer| r.pixel_fx.values().next().and_then(|e| e.shown.as_ref()).map(|(_, copy, _)| copy.clone()).unwrap(); + let before = copy(&r); + let _ = r.render(&d, 1280, 800, view(64.0, -40.0), &opts); + assert!(Arc::ptr_eq(&before, ©(&r)), "a frame through the same view copies the resampled pixels"); + for pan in [(39.9999999, 0.0), (0.0, 39.9999999), (40.0000001, 0.0), (0.0, 40.0000001)] { + let _ = r.render(&d, 1280, 800, view(64.0, 0.0), &opts); + let image = r.pixel_fx.values().next().unwrap().image.clone(); + let shifted = Affine::translate(pan) * view(64.0, 0.0); + let pixels = r.render(&d, 1280, 800, shifted, &opts).pixels; + assert!(!drawn(&r, &image), "a nearly whole-pixel pan with a different raster origin or sampling grid filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, shifted, &opts).pixels, "after a nearly whole-pixel pan"); + } + let _ = r.render(&d, 1280, 800, view(64.0, 40.0), &opts); + let image = r.pixel_fx.values().next().unwrap().image.clone(); + let n = d.node_mut(id).unwrap(); + let effects = std::mem::take(&mut n.appearance.effects); + n.appearance = Appearance::basic(Paint::solid(Color::rgb(0.1, 0.4, 0.9)), Paint::None, 0.0).into(); + n.appearance.effects = effects; + let pixels = r.render(&d, 1280, 800, view(64.0, 40.0), &opts).pixels; + assert!(!drawn(&r, &image), "a new fill filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(64.0, 40.0), &opts).pixels, "with the new fill"); + let image = r.pixel_fx.values().next().unwrap().image.clone(); + d.color_mode = vectorcraft_doc::ColorMode::Cmyk; + let pixels = r.render(&d, 1280, 800, view(64.0, 40.0), &opts).pixels; + assert!(!drawn(&r, &image), "a new color mode filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(64.0, 40.0), &opts).pixels, "in the new color mode"); + let image = r.pixel_fx.values().next().unwrap().image.clone(); + let pixels = r.render(&d, 1280, 800, view(48.0, 40.0), &opts).pixels; + assert!(!drawn(&r, &image), "a new zoom filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(48.0, 40.0), &opts).pixels, "at the new zoom"); + let image = r.pixel_fx.values().next().unwrap().image.clone(); + let pixels = r.render(&d, 1280, 800, view(48.0, 40.5), &opts).pixels; + assert!(!drawn(&r, &image), "a pan by part of a pixel filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(48.0, 40.5), &opts).pixels, "after a pan by part of a pixel"); +} + +/// Hiding a member of a group filters its whole-object raster again after a pan by whole pixels. +#[test] +fn hiding_a_member_filters_the_whole_object_raster_again_after_a_pan() { + let mut d = Document::new(100.0, 100.0); + let mut square = + |r: Rect, c: Color| Arc::new(Node::path(d.alloc_id(), shapes::rectangle(r), Appearance::basic(Paint::solid(c), Paint::None, 0.0))); + let members = vec![square(Rect::new(100.0, 100.0, 300.0, 250.0), Color::WHITE), square(Rect::new(200.0, 100.0, 300.0, 250.0), Color::BLACK)]; + let id = members[1].id; + let mut g = Node::group(d.alloc_id(), members); + g.appearance.effects = vec![Effect { id: "sketch.tornEdges".into(), params: json!({}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, g).unwrap(); + let mut opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + opts.hidden.insert(id); + let pixels = r.render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "hiding a member filters the content again"); +} + +/// A whole-object raster gives way to its view copy when the cache budget cannot hold both. +/// The same view draws the copy again without filtering the content. +#[test] +fn a_lower_resolution_whole_raster_keeps_its_view_copy_under_the_cache_budget() { + let d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = Affine::translate((640.0, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view, &opts); + let _ = r.render(&d, 1280, 800, view, &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.pan.is_some() && kept.k < 1.0, "the whole-object raster is kept at a lower resolution"); + let copy = kept.shown.as_ref().unwrap().1.clone(); + let budget = kept.bytes() - super::entries::raster_bytes(&kept.image); + r.trim_fx_rasters(budget); + assert_eq!(r.pixel_fx.len(), 1); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.view.is_some() && kept.pan.is_none() && kept.shown.is_none(), "the entry holds only its view copy"); + assert_eq!(kept.k, 1.0); + assert!(Arc::ptr_eq(&kept.image, ©), "the copy replaces the whole-object raster"); + let pixels = r.render(&d, 1280, 800, view, &opts).pixels; + assert!(Arc::ptr_eq(&r.pixel_fx.values().next().unwrap().image, ©), "the same view draws the copy without filtering again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view, &opts).pixels, "the copy draws the same pixels as a new renderer"); +} + #[test] fn a_drag_glow_fallback_cannot_be_spliced_into_a_still_frame() { let doc = doc_with( diff --git a/crates/render/src/pattern.rs b/crates/render/src/pattern.rs index 9e44f5c655..2fa90d50da 100644 --- a/crates/render/src/pattern.rs +++ b/crates/render/src/pattern.rs @@ -194,6 +194,7 @@ fn rasterize( // A tile drawn for a proof that preserves the colors' numbers shows its images through that // proof too. let plates = crate::proof::ink_plate_lut(ink, doc); + let hidden_inputs = Frame::hidden_inputs(&opts); for o in def.offsets_covering(region) { let v = view * def.instance_xf(o); let frame = Frame { @@ -205,6 +206,7 @@ fn rasterize( visible: v.inverse().transform_rect_bbox(px_rect), px: 1.0 / v.determinant().abs().sqrt().max(1e-12), opts: &opts, + hidden_inputs, ink, output: v, plates: plates.as_deref(), diff --git a/crates/render/src/renderer.rs b/crates/render/src/renderer.rs index 9eb6082e37..bbe2485647 100644 --- a/crates/render/src/renderer.rs +++ b/crates/render/src/renderer.rs @@ -198,7 +198,21 @@ impl Renderer { let symbols = doc.symbol_boxes().quick(); let output = Affine::scale(1.0 / f64::from(cell.max(1))) * view; let plates = proof::plate_lut(opts, doc); - let frame = Frame { mt: threads > 0, patch, doc, symbols: &symbols, view, visible, px, opts, ink: screen, output, plates: plates.as_deref() }; + let hidden_inputs = Frame::hidden_inputs(opts); + let frame = Frame { + mt: threads > 0, + patch, + doc, + symbols: &symbols, + view, + visible, + px, + opts, + hidden_inputs, + ink: screen, + output, + plates: plates.as_deref(), + }; let _crossed = self.cross_placed(&frame); self.begin_frame(); // View Opacity Mask: the mask's coverage in greyscale instead of the artwork. @@ -490,7 +504,9 @@ impl Renderer { ctx.set_aliasing_threshold(opts.anti_alias.threshold()); let symbols = doc.symbol_boxes().quick(); let output = Affine::scale(1.0 / f64::from(cell.max(1))) * view; - let frame = Frame { mt: false, patch: None, doc, symbols: &symbols, view, visible, px, opts, ink: Ink::Display, output, plates: None }; + let hidden_inputs = Frame::hidden_inputs(opts); + let frame = + Frame { mt: false, patch: None, doc, symbols: &symbols, view, visible, px, opts, hidden_inputs, ink: Ink::Display, output, plates: None }; let raster = std::mem::replace(&mut self.raster, raster_settings(opts)); let _crossed = self.cross_placed(&frame); self.begin_frame(); From ce0055d8ba079e90ccd039b87bbc314c623fdf7c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 18:48:48 -0800 Subject: [PATCH 02/24] Tests: the bitmap glyph raster inputs test builds its frame with the hidden-objects fingerprint --- crates/render/src/tests/bitmapglyphs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/render/src/tests/bitmapglyphs.rs b/crates/render/src/tests/bitmapglyphs.rs index d1a96458ae..ebe7756623 100644 --- a/crates/render/src/tests/bitmapglyphs.rs +++ b/crates/render/src/tests/bitmapglyphs.rs @@ -98,6 +98,7 @@ fn rasters_of_type_follow_image_smoothing() { visible: vectorcraft_geom::Rect::new(0.0, 0.0, 160.0, 160.0), px: 1.0, opts: &opts, + hidden_inputs: Frame::hidden_inputs(&opts), ink: crate::ink::Ink::Display, output: Affine::IDENTITY, plates: None, From e51721747a11feb58056a3aba9d2dd8968f82feb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 19:30:42 -0800 Subject: [PATCH 03/24] Effects: hiding or skipping template layers draws a cached effect raster again A raster of a layer's effects can hold a template sublayer. Its inputs now include whether template layers are hidden or skipped, as they already include whether guides are hidden, so a whole-object raster kept across pans is not drawn again with the template's art in it. --- crates/render/src/fx/pixels.rs | 8 ++++---- crates/render/src/fx/tests.rs | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 6b84b66ee4..e67df81622 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -593,8 +593,8 @@ impl Renderer { } /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the - /// color settings, the edge smoothing, the hidden objects, whether dashed strokes draw as solid - /// lines, the document's raster effects resolution (which a Rasterize or De-Interlace anywhere + /// color settings, the edge smoothing, the hidden objects, whether guides and template layers + /// are left out, whether dashed strokes draw as solid lines, the document's raster effects resolution (which a Rasterize or De-Interlace anywhere /// in the content follows), the knockout `n` inherits and, while `n` holds the isolated group, /// isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the @@ -610,8 +610,8 @@ impl Renderer { let doc = self.doc_inputs(f.doc); let mut h = DefaultHasher::new(); (doc.cms, f.opts.anti_alias.threshold(), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); - // Cached effects on containers can include paths made into guides. - f.opts.hide_guides.hash(&mut h); + // Cached effects on containers can include paths made into guides and template layers. + (f.opts.hide_guides, f.opts.hide_templates, f.opts.skip_templates).hash(&mut h); // Cached effects can include dashed strokes drawn as solid lines. f.opts.solid_dashes.hash(&mut h); f.hidden_inputs.hash(&mut h); diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 727a09996f..7d85347e7c 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -1973,6 +1973,40 @@ fn hiding_a_member_filters_the_whole_object_raster_again_after_a_pan() { assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "hiding a member filters the content again"); } +/// Hiding or skipping template layers filters the whole-object raster of a layer with effects +/// that holds a template sublayer again after a pan by whole pixels. +#[test] +fn hiding_templates_filters_the_whole_object_raster_again_after_a_pan() { + let mut d = Document::new(100.0, 100.0); + let l = d.layers[0].id; + let mut square = + |r: Rect, c: Color| Arc::new(Node::path(d.alloc_id(), shapes::rectangle(r), Appearance::basic(Paint::solid(c), Paint::None, 0.0))); + let white = square(Rect::new(100.0, 100.0, 300.0, 250.0), Color::WHITE); + let black = square(Rect::new(200.0, 100.0, 300.0, 250.0), Color::BLACK); + let mut template = Node::layer(d.alloc_id(), "Template", vectorcraft_doc::LayerColor::Preset(0)); + if let vectorcraft_doc::NodeKind::Layer { template: flag, children, .. } = &mut template.kind { + *flag = true; + children.push(black); + } + d.insert(Some(l), 0, Arc::unwrap_or_clone(white)).unwrap(); + d.insert(Some(l), 1, template).unwrap(); + d.node_mut(l).unwrap().appearance.effects = vec![Effect { id: "sketch.tornEdges".into(), params: json!({}), visible: true }]; + let opts = RenderOptions { background: Some([255, 255, 255, 255]), dim_templates: false, ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + for (left_out, what) in + [(RenderOptions { hide_templates: true, ..opts.clone() }, "hiding"), (RenderOptions { skip_templates: true, ..opts.clone() }, "skipping")] + { + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + let fresh = Renderer::new().render(&d, 1280, 800, view(40.0), &left_out).pixels; + assert!(fresh != Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "the template shows through the effect"); + let pixels = r.render(&d, 1280, 800, view(40.0), &left_out).pixels; + assert!(pixels == fresh, "{what} templates filters the content again"); + } +} + /// A whole-object raster gives way to its view copy when the cache budget cannot hold both. /// The same view draws the copy again without filtering the content. #[test] From 4faf2fe671a85c17171116c12674edcdd7f4ecf6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 20:57:50 -0800 Subject: [PATCH 04/24] Effects: a new guide style or Layer Options setting draws a cached effect raster again A raster of a layer's or group's effects can hold paths made into guides, drawn in the guide color and style, and sublayers drawn as their Layer Options show them on screen. Its inputs now include the guide color and style and whether Layer Options show, so a whole-object raster kept across pans is not drawn again with the old look. --- crates/render/src/fx/pixels.rs | 9 ++++--- crates/render/src/fx/tests.rs | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index e67df81622..56f10e763d 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -594,7 +594,8 @@ impl Renderer { /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the /// color settings, the edge smoothing, the hidden objects, whether guides and template layers - /// are left out, whether dashed strokes draw as solid lines, the document's raster effects resolution (which a Rasterize or De-Interlace anywhere + /// are left out, the guide color and style, whether Layer Options show on screen, whether + /// dashed strokes draw as solid lines, the document's raster effects resolution (which a Rasterize or De-Interlace anywhere /// in the content follows), the knockout `n` inherits and, while `n` holds the isolated group, /// isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the @@ -610,8 +611,10 @@ impl Renderer { let doc = self.doc_inputs(f.doc); let mut h = DefaultHasher::new(); (doc.cms, f.opts.anti_alias.threshold(), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); - // Cached effects on containers can include paths made into guides and template layers. - (f.opts.hide_guides, f.opts.hide_templates, f.opts.skip_templates).hash(&mut h); + // Cached effects on containers can include paths made into guides, drawn in the guide + // color and style, template layers, and sublayers drawn as their Layer Options show them. + let o = f.opts; + (o.hide_guides, o.guide, o.hide_templates, o.skip_templates, o.dim_templates).hash(&mut h); // Cached effects can include dashed strokes drawn as solid lines. f.opts.solid_dashes.hash(&mut h); f.hidden_inputs.hash(&mut h); diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 7d85347e7c..970bbcc514 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2007,6 +2007,51 @@ fn hiding_templates_filters_the_whole_object_raster_again_after_a_pan() { } } +/// A new guide color or style, or turning the Layer Options' screen look on or off, filters the +/// whole-object raster of a layer with effects that holds a guide and a sublayer with Preview +/// off again after a pan by whole pixels. +#[test] +fn guide_style_and_layer_options_filter_the_whole_object_raster_again_after_a_pan() { + let mut d = Document::new(100.0, 100.0); + let l = d.layers[0].id; + let mut square = + |r: Rect, c: Color| Arc::new(Node::path(d.alloc_id(), shapes::rectangle(r), Appearance::basic(Paint::solid(c), Paint::None, 0.0))); + let white = square(Rect::new(100.0, 100.0, 300.0, 250.0), Color::WHITE); + let black = square(Rect::new(200.0, 100.0, 300.0, 250.0), Color::BLACK); + let mut guide = Arc::unwrap_or_clone(square(Rect::new(150.0, 120.0, 290.0, 230.0), Color::BLACK)); + if let vectorcraft_doc::NodeKind::Path { guide: flag, .. } = &mut guide.kind { + *flag = true; + } + let mut outlined = Node::layer(d.alloc_id(), "Outlined", vectorcraft_doc::LayerColor::Preset(0)); + if let vectorcraft_doc::NodeKind::Layer { preview, children, .. } = &mut outlined.kind { + *preview = false; + children.push(black); + } + d.insert(Some(l), 0, Arc::unwrap_or_clone(white)).unwrap(); + d.insert(Some(l), 1, outlined).unwrap(); + d.insert(Some(l), 2, guide).unwrap(); + d.node_mut(l).unwrap().appearance.effects = + vec![Effect { id: "blur.radial".into(), params: json!({"amount": 1, "quality": "draft"}), visible: true }]; + let opts = RenderOptions { background: Some([255, 255, 255, 255]), guide: ([0, 200, 255], false), ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let changes = [ + (RenderOptions { guide: ([255, 0, 0], false), ..opts.clone() }, "a new guide color"), + (RenderOptions { guide: ([0, 200, 255], true), ..opts.clone() }, "dotted guides"), + (RenderOptions { dim_templates: false, ..opts.clone() }, "Layer Options turned off"), + ]; + let unchanged = Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels; + for (changed, what) in changes { + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + let fresh = Renderer::new().render(&d, 1280, 800, view(40.0), &changed).pixels; + assert!(fresh != unchanged, "{what} changes the effect's pixels"); + let pixels = r.render(&d, 1280, 800, view(40.0), &changed).pixels; + assert!(pixels == fresh, "{what} filters the content again"); + } +} + /// A whole-object raster gives way to its view copy when the cache budget cannot hold both. /// The same view draws the copy again without filtering the content. #[test] From 412536135094735deadaf2f686723feebf2be864 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 13:59:35 -0800 Subject: [PATCH 05/24] Stroke: drop an unfinished value when the stroke it edits changes A value typed into the Stroke panel's Weight, Miter limit, dash, gap, Dash offset or arrowhead Scale field without Enter stayed in the field after another object with the same value was selected, and Enter then applied it to the new selection: "3+" typed for one line and finished as "1" on another set that line to 4 pt. The Appearance panel's weight fields and the Control bar and Properties weight fields did the same. The fields now take an edit target: the document, its File > Revert count, the revision of the document the next edit builds on, the new-art paint, the selection and its subjects, the active Appearance row, the symbol part, the Live Paint Bucket, the Type tool's characters or story, and the Global Edit members. When it changes, the field drops the unfinished value and keeps its focus. While the stroke editor's or the arrowhead Scale fields' own scrub or step runs, they keep the target they started with, and an outside change to the document ends the gesture. A command that replaces a tool drag's starting document, or changes the perspective grid during a drag, now advances the drag's baseline revision, so the target changes with it. craft-libs is pinned to the commit that adds StrokeEditor::edit_target and LinkedFields::edit_target. --- Cargo.lock | 184 +-- Cargo.toml | 84 +- apps/vectorcraft-web/Cargo.toml | 2 +- .../engine/src/cmd/distortcmds/perspective.rs | 2 + crates/engine/src/inspect.rs | 5 + crates/engine/src/interaction.rs | 4 +- crates/engine/src/session/edit.rs | 2 + .../engine/src/tests/interaction_commands.rs | 32 + crates/ui-egui/src/panels/appearance.rs | 13 +- crates/ui-egui/src/panels/stroke.rs | 248 +++- crates/ui-egui/src/panels/tests_stroke.rs | 1140 ++++++++++++++++- xtask/src/pdf_deps.rs | 2 +- 12 files changed, 1561 insertions(+), 157 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65c0466fa9..9b875b2ea3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1255,7 +1255,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-automation", "craft-behavior", @@ -1297,7 +1297,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "crc32fast", "flate2", @@ -1318,7 +1318,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1330,7 +1330,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "rustix 1.1.6", ] @@ -1338,7 +1338,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1363,7 +1363,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-docpath", @@ -1399,7 +1399,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "crc32fast", "flate2", @@ -1408,7 +1408,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "egui", ] @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "md-5", "rayon", @@ -1425,12 +1425,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-cms", @@ -1450,7 +1450,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1466,7 +1466,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1476,7 +1476,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "rayon", ] @@ -1484,7 +1484,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "blake3", "craft-ecproj-format", @@ -1526,7 +1526,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", ] @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1553,7 +1553,7 @@ dependencies = [ [[package]] name = "craft-dwg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "acadrust", "log", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-codepage", "encoding_rs", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", "serde_json", @@ -1584,12 +1584,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-atomic", "dirs", @@ -1599,7 +1599,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1633,7 +1633,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1642,7 +1642,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "cap-primitives", "craft-atomic", @@ -1665,12 +1665,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "gif", ] @@ -1678,7 +1678,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", ] @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1699,7 +1699,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1729,7 +1729,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-dds", "craft-jpeg", @@ -1756,7 +1756,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "thiserror 2.0.21", ] @@ -1782,7 +1782,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-host", "craft-i18n", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-i18n", @@ -1822,7 +1822,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -1840,7 +1840,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1852,7 +1852,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "encoding_rs", "image", @@ -1863,7 +1863,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "chrono", "craft-codepage", @@ -1873,7 +1873,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "uds_windows", "winsafe", @@ -1882,7 +1882,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-keymap", @@ -1898,7 +1898,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1907,7 +1907,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", "serde", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1930,7 +1930,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "async-channel", "async-io", @@ -1963,7 +1963,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1972,7 +1972,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2007,7 +2007,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-eps", "flate2", @@ -2021,7 +2021,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "encoding_rs", "flate2", @@ -2032,7 +2032,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "dispatch2", "egui", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-raster3d" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "rayon", "thiserror 2.0.21", @@ -2054,7 +2054,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2073,7 +2073,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-atomic", "craft-host", @@ -2090,7 +2090,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "fax", "hayro-ccitt", @@ -2101,7 +2101,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-keymap", @@ -2134,7 +2134,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2159,7 +2159,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "thiserror 2.0.21", ] @@ -2167,7 +2167,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-atomic", "craft-behavior", @@ -2197,7 +2197,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", "thiserror 2.0.21", @@ -2207,7 +2207,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", "thiserror 2.0.21", @@ -2216,7 +2216,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-keymap", @@ -2231,12 +2231,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2250,7 +2250,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2267,7 +2267,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "accesskit", "craft-behavior", @@ -2305,7 +2305,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2334,7 +2334,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2355,7 +2355,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2376,7 +2376,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2395,7 +2395,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.22.1", "chrono", @@ -2427,7 +2427,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", "serde", @@ -2438,7 +2438,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2448,7 +2448,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "js-sys", "serde_json", @@ -2459,7 +2459,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "winsafe", ] @@ -2467,7 +2467,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-appkit", "craft-atomic", @@ -2499,7 +2499,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3859,7 +3859,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3868,7 +3868,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3886,7 +3886,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3904,12 +3904,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", "hayro-ccitt", @@ -4892,7 +4892,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.22.1", "bumpalo", @@ -5049,7 +5049,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "arrayvec", "kurbo 0.13.1", @@ -7615,7 +7615,7 @@ dependencies = [ [[package]] name = "skrifa" version = "0.44.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bytemuck", "read-fonts 0.41.0", diff --git a/Cargo.toml b/Cargo.toml index 03de727454..dbd24cdf1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,57 +10,57 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified). -craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # The metallic-roughness BRDF and environment light the 3D effects' Roughness and Metallic shade with. -craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps. -craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -200,15 +200,15 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa). -skrifa = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +skrifa = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 0d227adb15..4c31295602 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/engine/src/cmd/distortcmds/perspective.rs b/crates/engine/src/cmd/distortcmds/perspective.rs index 3f100acc5a..8c74451a02 100644 --- a/crates/engine/src/cmd/distortcmds/perspective.rs +++ b/crates/engine/src/cmd/distortcmds/perspective.rs @@ -32,6 +32,7 @@ pub(crate) fn silent(s: &mut Session, f: impl FnOnce(&mut PerspectiveGrid)) -> R store_grid(Arc::make_mut(&mut st.doc), &g); if let Some(it) = &mut st.interaction { store_grid(Arc::make_mut(&mut it.doc), &g); + it.revision = st.revision + 1; } st.revision += 1; Ok(g) @@ -714,6 +715,7 @@ pub(crate) fn finish_edit_text(st: &mut crate::DocState, id: NodeId) { } if let Some(it) = &mut st.interaction { clear(&mut it.doc); + it.revision = st.revision + 1; } st.revision += 1; } diff --git a/crates/engine/src/inspect.rs b/crates/engine/src/inspect.rs index 323d5d0918..ea28d8675e 100644 --- a/crates/engine/src/inspect.rs +++ b/crates/engine/src/inspect.rs @@ -7,6 +7,11 @@ use vectorcraft_geom::Rect; use crate::Session; +/// The new-art paint state before the running preview, or its current value without a preview. +pub fn new_art_paint_before_preview(s: &Session) -> &vectorcraft_tools::PaintDefaults { + s.active().and_then(|st| st.interaction.as_ref()).map_or(&s.paint, |it| &it.paint) +} + pub(crate) fn rect_json(r: Option) -> Value { match r { Some(r) => json!({ "x": r.x0, "y": r.y0, "width": r.width(), "height": r.height() }), diff --git a/crates/engine/src/interaction.rs b/crates/engine/src/interaction.rs index 1ede3c2509..35a384dc05 100644 --- a/crates/engine/src/interaction.rs +++ b/crates/engine/src/interaction.rs @@ -11,8 +11,8 @@ pub struct Interaction { /// The selection the previews start from (shared, so a preview frame copies nothing). pub selection: Arc, pub(crate) active_appearance_item: Option, - /// The document's [`crate::DocState::revision`] when the interaction began. The previews change the document's - /// revision, and this value stays the same until the interaction ends. + /// The baseline document's [`crate::DocState::revision`]. Previews keep this value; replacing or changing the + /// baseline advances it to the document's next revision. pub revision: u64, pub preview: Option<(String, Value)>, /// The active tool began it (a drag): a command from outside the tool runs as a step of its diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index 604ca822df..5143ee3287 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -471,6 +471,8 @@ impl Session { return; } let began = std::mem::replace(&mut it.doc, st.doc.clone()); + st.revision += 1; + it.revision = st.revision; // The drag acts on the objects it began with: a selection the command made (a paste, a // duplicate, Select All) does not change what the drag moves. it.selection = Arc::new(drag_selection(&it.selection, &st.doc)); diff --git a/crates/engine/src/tests/interaction_commands.rs b/crates/engine/src/tests/interaction_commands.rs index 00588ecf0c..20ab3876ee 100644 --- a/crates/engine/src/tests/interaction_commands.rs +++ b/crates/engine/src/tests/interaction_commands.rs @@ -846,3 +846,35 @@ fn a_command_during_a_quick_pen_press_runs_inside_it() { assert_eq!(s.doc().unwrap().history.undo.len(), steps, "{at}: no step of its own during the press"); } } + +#[test] +fn a_rebased_drag_advances_its_baseline_revision() { + for real_time in [true, false] { + let (mut s, _, other) = two_squares(real_time); + s.select_tool("selection", view()).unwrap(); + pointer(&mut s, PointerKind::Down, 120.0, 120.0); + pointer(&mut s, PointerKind::Drag, 140.0, 130.0); + let revision = s.doc().unwrap().interaction.as_ref().unwrap().revision; + pointer(&mut s, PointerKind::Drag, 150.0, 140.0); + assert_eq!(s.doc().unwrap().interaction.as_ref().unwrap().revision, revision, "previews keep the baseline revision"); + s.execute("appearance.setItem", &json!({"ids": [other.0], "index": 1, "weight": 3})).unwrap(); + let rebased = s.doc().unwrap().interaction.as_ref().unwrap().revision; + assert!(rebased > revision, "an outside document edit advances the baseline revision"); + pointer(&mut s, PointerKind::Drag, 160.0, 150.0); + assert_eq!(s.doc().unwrap().interaction.as_ref().unwrap().revision, rebased, "later previews keep the rebased revision"); + s.cancel_interaction().unwrap(); + assert_eq!(s.doc().unwrap().doc.node(other).unwrap().appearance.stroke().unwrap().width, 3.0); + } +} + +#[test] +fn a_grid_change_during_an_interaction_advances_its_baseline_revision() { + let (mut s, _) = session(true); + s.begin_interaction("Grid").unwrap(); + let revision = s.doc().unwrap().interaction.as_ref().unwrap().revision; + crate::cmd::distortcmds::silent(&mut s, |grid| grid.visible = !grid.visible).unwrap(); + let st = s.doc().unwrap(); + let it = st.interaction.as_ref().unwrap(); + assert!(it.revision > revision, "a direct baseline change advances its revision"); + assert_eq!(crate::cmd::distortcmds::grid_of(&it.doc).visible, crate::cmd::distortcmds::grid_of(&st.doc).visible); +} diff --git a/crates/ui-egui/src/panels/appearance.rs b/crates/ui-egui/src/panels/appearance.rs index c6c791b645..c98048a526 100644 --- a/crates/ui-egui/src/panels/appearance.rs +++ b/crates/ui-egui/src/panels/appearance.rs @@ -452,9 +452,11 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let copy = craft::ui::runtime::pointer::frame(ui.ctx()).mods.alt; let pass = RefCell::new(Pass::default()); let footer = RefCell::new(None); + let shown_target = stroke::target_key(&stroke::edit_target(app, ui.ctx())); let shared: &VectorcraftApp = app; let cx = RowCx { app: shared, + shown_target, node: node.as_deref(), new_art: &new_art, mix, @@ -751,6 +753,7 @@ struct Pass { /// What a row reads to build itself. struct RowCx<'a> { app: &'a VectorcraftApp, + shown_target: u64, node: Option<&'a Node>, new_art: &'a Appearance, mix: Option<&'a Mixed>, @@ -860,10 +863,12 @@ fn item_row<'r>(cx: &'r RowCx<'_>, key: RowKey, i: usize) -> ListRow<'r> { } if let Some(st) = stroke_layer { let target = if new_art { WeightTarget::Shown } else { WeightTarget::Item(i) }; + let field = + if new_art { row_weight(cx.app, Some(st.width), &cx.shown_target) } else { row_weight(cx.app, Some(st.width), &(cx.shown_target, i)) }; let pass = cx.pass; - row = row.trailing_field(row_weight(cx.app, Some(st.width)), move |out| pass.borrow_mut().acts.push(Act::Weight(target, Box::new(out)))); + row = row.trailing_field(field, move |out| pass.borrow_mut().acts.push(Act::Weight(target, Box::new(out)))); } else { - row = row.trailing_space(row_weight(cx.app, None)); + row = row.trailing_space(row_weight(cx.app, None, &())); } let painted = if new_art { Painted::NewArt { fill } } else { Painted::Item(i) }; let pass = cx.pass; @@ -894,8 +899,8 @@ fn paint_swatch(fill: bool, paint: &Paint) -> Swatch { /// The weight field of a stroke row, or the room it takes in a fill row: the Stroke panel's field as a small control, /// as the row's swatch is, without the presets list (a step still stops at each preset), so the row's label shows /// whole in the narrowest group. -fn row_weight(app: &VectorcraftApp, weight: Option) -> NumberField<'static> { - stroke::steps_weight(app, weight).size(ControlSize::Sm) +fn row_weight(app: &VectorcraftApp, weight: Option, target: &impl egui::AsIdSalt) -> NumberField<'static> { + stroke::steps_weight(app, weight, target).size(ControlSize::Sm) } /// A stroke row's notes after the weight: its brush and "Dashed". diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index 8ea894b54a..ab8ca628d2 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -3,6 +3,7 @@ // PLAN: import paths of craft_ui / craft_draw items are assumed from the crates' own module layout (craft_draw is // not yet a dependency of ui-egui; its owner adds it to Cargo.toml). +use std::hash::{DefaultHasher, Hash, Hasher}; use std::sync::LazyLock; use craft::behavior::{ColumnWidth, EditEvent, GestureId, IconId, Mixed}; @@ -27,7 +28,9 @@ use craft::ui::text::{NumberField, NumberOutput, NumberPick, StepArrows}; use egui::{Rect, Ui, pos2}; use serde_json::{Value, json}; use vectorcraft_color::{Color, Paint}; -use vectorcraft_doc::{Appearance, ArrowAlign, Arrowhead, Dash, Document, LineCap, LineJoin, Node, StrokeAlign, StrokeLayer, Unit, WidthProfile}; +use vectorcraft_doc::{ + Appearance, ArrowAlign, Arrowhead, Dash, Document, LineCap, LineJoin, Node, NodeId, StrokeAlign, StrokeLayer, Unit, WidthProfile, +}; use vectorcraft_engine::inspect::StrokeMixed; use vectorcraft_tools::PaintDefaults; @@ -45,6 +48,15 @@ const ARROWHEAD_ASPECT: (u16, u16) = (2, 1); /// The key of [`StrokePanel::brushed`]: (document uid, revision, active Appearance row). type BrushedKey = (u64, u64, Option); +#[derive(Clone, Debug, Default)] +struct FieldGesture { + held: Option<(EditTarget, EditTarget)>, + serial: u64, +} + +/// Global Edit members in propagation order, with the transforms that place each member. +type GlobalEditTarget = Option>; + /// What the Stroke panel remembers between frames; `UiState::stroke_panel` holds it. #[derive(Clone, Debug, Default)] pub(crate) struct StrokePanel { @@ -60,6 +72,10 @@ pub(crate) struct StrokePanel { pub link_open: bool, /// The running gesture of a Stroke panel select. pub select_gesture: Option, + /// The editor gesture's starting target and targeting state. + editor_gesture: FieldGesture, + /// The arrow scale gesture's starting target and targeting state. + scale_gesture: FieldGesture, } /// The stroke a weight edit goes to. @@ -391,22 +407,125 @@ static BLANK_WEIGHT_STOPS: [f64; 2] = [0.25, 0.5]; /// scrubbing by its label, blank when mixed. A plain step stops at each preset (0.52 pt goes down to 0.5 pt, not to /// 0 pt); Shift or Page steps the grid by ten. // PLAN: the sheet names `NumberField<'static, f64>`; `NumberField::length` takes `Option`. -pub(crate) fn weight_number(app: &VectorcraftApp, weight: Option) -> NumberField<'static> { - let field = steps_weight(app, weight); +pub(crate) fn weight_number(app: &VectorcraftApp, weight: Option, target: &EditTarget) -> NumberField<'static> { + let field = steps_weight(app, weight, target); match weight_ladder(app) { Some(l) => field.presets(&l.rows), None => field, } } +/// The document edit state and session destination before a preview. +/// A field drops its unfinished value when either changes. +#[derive(Clone, Debug, Hash, PartialEq, Eq)] +pub(crate) struct Target { + /// The document. + doc: u64, + /// How many times File > Revert replaced the document's content. + reverts: u64, + /// The revision of the document that the next preview builds on. + revision: u64, + /// The pre-preview new-art paint state. + new_art: u64, + /// Whether new art uses a basic appearance. + new_art_basic: bool, + /// The selected objects and subjects, in targeting order. + objects: Vec, + subjects: Vec, + /// The active appearance row. + row: Option, + /// The selected object inside a dynamic symbol instance: its instance and path through the symbol's art. + symbol_part: Option<(NodeId, Vec)>, + /// Whether the Live Paint Bucket's stroke is edited. + bucket: bool, + /// The type object and characters the Type tool has selected. + characters: Option<(NodeId, usize, usize)>, + /// The frame ids in thread order when the Type tool has selected the whole story. + story: Option>, + /// The members and placement transforms used to propagate Global Edit changes. + global_edit: GlobalEditTarget, + /// Distinguishes a canceled gesture from a replacement with the same starting content. + gesture: u64, +} + +/// The edit target of the Stroke panel's fields, `None` without a document. +pub(crate) type EditTarget = Option; + +/// The [`EditTarget`] of the active document. +pub(crate) fn edit_target(app: &VectorcraftApp, _ctx: &egui::Context) -> EditTarget { + let st = app.session.active()?; + Some(Target { + doc: st.uid, + reverts: st.reverts, + revision: st.interaction.as_ref().map_or(st.revision, |it| it.revision), + new_art: if may_edit_new_art(app) { + paint_digest(vectorcraft_engine::inspect::new_art_paint_before_preview(&app.session)) + } else { + vectorcraft_engine::inspect::new_art_paint_before_preview(&app.session).stroke_width.to_bits() + }, + new_art_basic: app.session.prefs.new_art_basic, + objects: st.selection.objects.clone(), + subjects: st.selection.subjects().to_vec(), + row: app.session.appearance_item(), + symbol_part: st.selection.symbol_part.as_ref().map(|part| (part.instance, part.path.clone())), + bucket: app.session.tool_paints(true), + characters: character::text_editing(app), + story: character::text_story(app), + global_edit: st.global_edit.as_ref().map(|ge| ge.members.iter().map(|(id, xf)| (*id, xf.as_coeffs().map(f64::to_bits))).collect()), + gesture: 0, + }) +} + +pub(crate) fn target_key(target: &EditTarget) -> u64 { + let mut hasher = DefaultHasher::new(); + target.hash(&mut hasher); + hasher.finish() +} + +/// Whether the fields can edit the new-art paint. A selected path the Stroke panel edits directly +/// (not a guide, a clipping path or a Live Paint part) is always a target, so with one selected +/// the fields edit objects and the target skips formatting the new-art paint. +fn may_edit_new_art(app: &VectorcraftApp) -> bool { + use vectorcraft_tools::builder::{SOURCES_NAME, is_live_paint}; + let Some(st) = app.session.active() else { return true }; + if app.session.tool_paints(true) { + return true; + } + let d = &st.doc; + let edited_path = |id: NodeId| { + d.node(id).is_some_and(|n| matches!(n.kind, vectorcraft_doc::NodeKind::Path { guide: false, clipping: false, .. }) && !n.is_ruler_guide()) + && d.parent_of(id).and_then(|p| d.node(p)).is_none_or(|p| !is_live_paint(p) && p.name.as_deref() != Some(SOURCES_NAME)) + }; + !st.selection.objects.iter().any(|id| edited_path(*id)) +} + +fn paint_digest(paint: &impl std::fmt::Debug) -> u64 { + use std::fmt::Write as _; + + struct HashSink(DefaultHasher); + impl std::fmt::Write for HashSink { + fn write_str(&mut self, s: &str) -> std::fmt::Result { + self.0.write(s.as_bytes()); + Ok(()) + } + } + + let mut sink = HashSink(DefaultHasher::new()); + let _ = write!(sink, "{paint:?}"); + sink.0.finish() +} + /// [`weight_number`] without the presets list: a plain step still stops at each preset. -pub(crate) fn steps_weight(app: &VectorcraftApp, weight: Option) -> NumberField<'static> { +pub(crate) fn steps_weight(app: &VectorcraftApp, weight: Option, target: &impl egui::AsIdSalt) -> NumberField<'static> { let unit = app.session.stroke_unit(); let lengths = crate::fields::bare_points(LengthUnits::new(UnitKind::Points, shown_kind(unit), 72.0), app.session.prefs.numbers_without_units_are_points); let ladder = weight_ladder(app); - let field = - NumberField::length(tl!("Weight"), Bind::given(weight), lengths).range(0.0..=1000.0).step_arrows(StepArrows::Leading).scrub_by_label(); + let field = NumberField::length(tl!("Weight"), Bind::given(weight), lengths) + .range(0.0..=1000.0) + .step_arrows(StepArrows::Leading) + .scrub_by_label() + .edit_target(target); // The stepper steps the number the field shows; the ladders are in points. let in_points = move |stops: &'static [f64], blank: bool| { let step = crate::fields::stops_stepper(1.0, stops, move |pt| unit.format(pt)); @@ -449,8 +568,15 @@ pub(crate) fn apply_weight(app: &mut VectorcraftApp, out: &NumberOutput, target: /// The weight field in a row labelled `label` with the side label `side`: the output of the number field, none when /// the row's body did not run. -fn weight_row(app: &VectorcraftApp, ui: &mut Ui, label: &'static str, side: SideLabel, weight: Option) -> Option { - Field::new(label).side(side).id_salt("weight").sizing(Sizing::Content).show(ui, |ui, _| weight_number(app, weight).show(ui)).inner +fn weight_row( + app: &VectorcraftApp, + ui: &mut Ui, + label: &'static str, + side: SideLabel, + weight: Option, + target: &EditTarget, +) -> Option { + Field::new(label).side(side).id_salt("weight").sizing(Sizing::Content).show(ui, |ui, _| weight_number(app, weight, target).show(ui)).inner } /// The weight field whose link side label (`label`: the Control bar's "Stroke:", the Properties panel's "Stroke") @@ -459,7 +585,8 @@ fn weight_row(app: &VectorcraftApp, ui: &mut Ui, label: &'static str, side: Side pub(crate) fn link_field(app: &mut VectorcraftApp, ui: &mut Ui, label: &'static str, weight: Option) { let side = SideLabel::new().scrub(true).link().role(FieldLabelRole::Describes).tooltip(TooltipSpec::new(tl!("Stroke options"))); let mut open = app.ui.stroke_panel.link_open; - if let Some(out) = weight_row(app, ui, label, side, weight) { + let target = edit_target(app, ui.ctx()); + if let Some(out) = weight_row(app, ui, label, side, weight, &target) { apply_weight(app, &out, WeightTarget::Shown); open ^= out.link; } @@ -487,30 +614,66 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } } +/// Keeps a group's starting key while its own gesture runs in the same targeting state. +fn gesture_target(gesture: &mut FieldGesture, target: EditTarget) -> EditTarget { + let changed = gesture.held.as_ref().is_some_and(|(_, produced)| produced != &target); + if changed { + gesture.held = None; + gesture.serial = gesture.serial.wrapping_add(1); + } + let mut target = gesture.held.as_ref().map_or(target, |(target, _)| target.clone()); + if let Some(target) = &mut target { + target.gesture = gesture.serial; + } + target +} + +/// Keeps the starting target and the content produced after the component's edits are applied. +fn remember_gesture(gesture: &mut FieldGesture, target: &EditTarget, events: &craft::behavior::EditEvents, produced: EditTarget) { + for event in events.iter() { + match event { + EditEvent::Begin { .. } => gesture.held = Some((target.clone(), produced.clone())), + EditEvent::Commit { .. } | EditEvent::Cancel { .. } => gesture.held = None, + _ => {} + } + } + if let Some((_, last)) = &mut gesture.held { + *last = produced; + } +} + /// The rows of [`show`]. fn rows(app: &mut VectorcraftApp, ui: &mut Ui) { let st = current_stroke(app); let mixed = stroke_mixed(app, ui.ctx()); let weight = shown_weight(app, st.as_ref(), &mixed); - if let Some(out) = weight_row(app, ui, tl!("Weight"), SideLabel::new().scrub(true), weight) { + let mut target = edit_target(app, ui.ctx()); + if let Some(out) = weight_row(app, ui, tl!("Weight"), SideLabel::new().scrub(true), weight, &target) { apply_weight(app, &out, WeightTarget::Shown); + target = edit_target(app, ui.ctx()); } if app.ui.stroke_panel.hide_options { + app.ui.stroke_panel.editor_gesture.held = None; + app.ui.stroke_panel.scale_gesture.held = None; return; } let style = style_of(st.as_ref()); + let editor_target = gesture_target(&mut app.ui.stroke_panel.editor_gesture, target.clone()); let editor = StrokeEditor::new(tl!("Stroke"), Bind::given(style.clone())) .sections(StrokeSections::PANEL | StrokeSections::DASH_ALIGN) .closed(mixed.can_align) .caps_on_closed(true) .mixed(&mixed_of(&mixed)) - .host_labels(true); + .host_labels(true) + .edit_target(&editor_target); let output = editor.show(ui); if let (Some(new), Some(field)) = (output.events.landed(), output.field) { apply_style(app, &style, new.clone(), field); + target = edit_target(app, ui.ctx()); } + remember_gesture(&mut app.ui.stroke_panel.editor_gesture, &editor_target, &output.events, target.clone()); Divider::horizontal().show(ui); - arrow_rows(app, ui, st.as_ref()); + arrow_rows(app, ui, st.as_ref(), target); Divider::horizontal().show(ui); Field::new(tl!("Profile")).show(ui, |ui, _| { Row::new().wrap(true).show(ui, |ui, _| { @@ -520,8 +683,11 @@ fn rows(app: &mut VectorcraftApp, ui: &mut Ui) { }); } -/// The arrowhead rows: the start and end heads with Swap, the two scales with their link, and the alignment. -fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { +/// The arrowhead rows: the start and end heads with Swap, the two scales with their link, and the alignment. `target` +/// is the current edit target used to track scale gestures. +fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>, target: EditTarget) { + let scale_target = gesture_target(&mut app.ui.stroke_panel.scale_gesture, target.clone()); + let mut updated = false; let custom: Vec = app.session.arrowheads.heads().iter().cloned().map(Arrowhead::Custom).collect(); let entries: Vec>> = std::iter::once(None) .chain(Arrowhead::ALL.iter().cloned().map(Some)) @@ -546,10 +712,12 @@ fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { let out = if listed { select } else { select.unlisted_label(unlisted_arrow_name(head.as_ref())) }.show(ui); // A custom head goes with its art, as document.inspect reports it. apply_select(app, key, &out, |app, a| set(app, json!({ key: a }))); + updated |= out.events.iter().next().is_some(); } let swap = IconButton::new(IconId::new("arrow-left-right")).label(tl!("Swap start and end arrowheads")).enabled(st.is_some()).show(ui); if swap.clicked() { app.run("stroke.setAdvanced", json!({"swapArrows": true})).ok(); + updated = true; } }); }); @@ -563,6 +731,7 @@ fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { .mode(LinkMode::Equal) .unit_kind(UnitKind::Percent) .enabled(has_head) + .edit_target(&scale_target) .show(ui) }) .inner; @@ -571,6 +740,13 @@ fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { } if let Some([a, b]) = out.as_ref().and_then(|out| out.edit.events.landed()).map(|p| (*p).map(|m| m.same().copied().flatten())) { app.run("stroke.setAdvanced", json!({"arrowScale": [a.unwrap_or(scale.0), b.unwrap_or(scale.1)]})).ok(); + updated = true; + } + if let Some(out) = &out { + let produced = if updated { edit_target(app, ui.ctx()) } else { target }; + remember_gesture(&mut app.ui.stroke_panel.scale_gesture, &scale_target, &out.edit.events, produced); + } else { + app.ui.stroke_panel.scale_gesture.held = None; } let aligns: Vec> = ARROW_ALIGN.iter().map(|(v, _, icon, tip)| Entry::new(*v, *tip).icon(IconId::new(icon))).collect(); let out = Field::new(tl!("Align")) @@ -988,6 +1164,15 @@ mod tests { use super::*; use crate::tests::panel_harness::Panel; + #[test] + fn paint_digest_tracks_stroke_width() { + let paint = PaintDefaults::default(); + let mut changed = paint.clone(); + assert_eq!(paint_digest(&paint), paint_digest(&changed)); + changed.stroke_width += 1.0; + assert_ne!(paint_digest(&paint), paint_digest(&changed)); + } + #[test] fn editing_an_extended_dash_keeps_other_stroke_options_and_is_undoable() { use vectorcraft_engine::Session; @@ -1009,6 +1194,41 @@ mod tests { assert_eq!(current_stroke(&app).unwrap(), after); } + /// A field group's running gesture keeps the target it began with while its own edits change the stroke, and + /// takes the current target again once the gesture ends or the selection changes. + #[test] + fn a_gesture_keeps_its_starting_target_until_it_ends() { + let (mut app, path) = profiled_line(None); + let other = app.run("shape.line", json!({"x1": 10, "y1": 80, "x2": 90, "y2": 80})).unwrap(); + app.run("select.set", json!({"ids": [path["id"]]})).unwrap(); + let ctx = egui::Context::default(); + let shown = |target: &EditTarget| format!("{target:?}"); + let event = |e: EditEvent| craft::behavior::EditEvents::from(e); + let id = GestureId::new(1); + let mut gesture = FieldGesture::default(); + + let start = edit_target(&app, &ctx); + remember_gesture(&mut gesture, &start, &event(EditEvent::begin(id, Mixed::Same(10.0), std::sync::Arc::from("Miter"), None)), start.clone()); + app.run("stroke.set", json!({"miterLimit": 22})).unwrap(); + let fresh = edit_target(&app, &ctx); + assert_ne!(shown(&fresh), shown(&start), "the gesture's own edit changes the stroke's target"); + remember_gesture(&mut gesture, &start, &craft::behavior::EditEvents::::new(), fresh.clone()); + let held = gesture_target(&mut gesture, fresh.clone()); + assert_eq!(shown(&held), shown(&start), "the running gesture keeps its starting target"); + + remember_gesture(&mut gesture, &held, &event(EditEvent::commit(id, Mixed::Same(10.0), 22.0)), fresh.clone()); + let fresh = edit_target(&app, &ctx); + assert_eq!(shown(&gesture_target(&mut gesture, fresh)), shown(&edit_target(&app, &ctx)), "a commit ends it"); + + let start = edit_target(&app, &ctx); + remember_gesture(&mut gesture, &start, &event(EditEvent::begin(id, Mixed::Same(22.0), std::sync::Arc::from("Miter"), None)), start.clone()); + app.run("select.set", json!({"ids": [other["id"]]})).unwrap(); + let fresh = edit_target(&app, &ctx); + let now = gesture_target(&mut gesture, fresh); + assert_ne!(shown(&now), shown(&start), "another selection ends the held target"); + assert!(gesture.held.is_none()); + } + /// The Profile and arrowhead selects name a current value that is none of their choices on the closed face, and /// the open list keeps only the choices. #[test] diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 66cf954339..c2747a2615 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -1,6 +1,9 @@ -//! Headless frames of the Stroke panel's Dashed Line section. +//! Headless frames of the Stroke panel: its Dashed Line section, its row layout, and what its number fields edit. +use craft::ui::contract::Role; +use egui::{Key, Modifiers}; use serde_json::json; +use vectorcraft_doc::NodeId; use crate::tests::panel_harness::Panel; // PLAN: assumed path of object-panels-w8's `Panel` harness (op.A15). @@ -41,3 +44,1138 @@ fn the_panel_rows_start_their_controls_at_one_x() { let first = starts[0].1; assert!(starts.iter().all(|(_, x)| (x - first).abs() < 0.5), "controls start at {starts:?}"); } + +/// A document with two lines, `a` and `b`, with the same dashed stroke and start arrowhead, and `a` selected. +fn two_lines() -> (VectorcraftApp, NodeId, NodeId) { + let mut app = crate::testing::windowed(VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default())); + run(&mut app, "file.new", json!({"width": 200, "height": 200})); + let mut line = |y: f64| NodeId(run(&mut app, "shape.line", json!({"x1": 10, "y1": y, "x2": 190, "y2": y}))["id"].as_u64().unwrap()); + let (a, b) = (line(50.0), line(150.0)); + let head = serde_json::to_value(&vectorcraft_doc::Arrowhead::ALL[0]).unwrap(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "stroke.set", json!({"dash": [12, 12], "startArrow": head})); + run(&mut app, "select.set", json!({"ids": [a.0]})); + (app, a, b) +} + +/// The top stroke of object `id`. +fn stroke_of(app: &VectorcraftApp, id: NodeId) -> vectorcraft_doc::StrokeLayer { + app.session.active().unwrap().doc.node(id).unwrap().appearance.stroke().unwrap().clone() +} + +/// Starts an unfinished value in the number field `name`: selects its text and types `3+`. +fn start_typing(p: &mut Panel, name: &str) { + p.click_role(name, Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); +} + +/// Types `5` into the focused field and presses Enter. +fn finish_typing(p: &mut Panel) { + p.type_text("5"); + p.key(Key::Enter, Modifiers::NONE); +} + +#[test] +fn an_unfinished_value_does_not_reach_another_line_with_the_same_stroke() { + type Read = fn(&vectorcraft_doc::StrokeLayer) -> f64; + let fields: [(&str, Read); 6] = [ + ("Weight", |s| s.width), + ("Miter limit", |s| s.miter_limit), + ("Dash 1", |s| s.dash.as_ref().map_or(0.0, |d| d.pattern[0])), + ("Gap 1", |s| s.dash.as_ref().map_or(0.0, |d| d.pattern[1])), + ("Dash offset", |s| s.dash.as_ref().map_or(0.0, |d| d.offset)), + ("Scale 1", |s| s.arrow_scale.0), + ]; + for (name, read) in fields { + let (app, a, b) = two_lines(); + let before = read(&stroke_of(&app, a)); + assert_eq!(before, read(&stroke_of(&app, b)), "{name}: both lines start with one value"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, name); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role(name, Role::SPIN_BUTTON).as_deref(), Some("3+"), "{name}: the field drops the value typed for a"); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((read(&stroke_of(&app, a)), read(&stroke_of(&app, b))), (before, 5.0), "{name}: b takes 5, not 3+5"); + } +} + +/// The weight field the Control bar and the Properties panel show beside their Stroke link label. +fn show_link_field(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + let shown = current_stroke(app); + let mixed = stroke_mixed(app, ui.ctx()); + let weight = stroke::shown_weight(app, shown.as_ref(), &mixed); + stroke::link_field(app, ui, "Stroke:", weight); +} + +#[test] +fn an_unfinished_link_field_weight_does_not_reach_another_line() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "stroke.set", json!({"weight": 2})); + run(&mut app, "select.set", json!({"ids": [a.0]})); + let mut p = Panel::new(app, show_link_field); + start_typing(&mut p, "Weight"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the field drops the value typed for a"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, b).width), (2.0, 1.0), "b takes 1 pt, not 3+1, and a keeps 2 pt"); +} + +#[test] +fn changing_the_new_art_width_drops_an_unfinished_weight_on_a_selected_path() { + let mut app = app_with_rect(); + let id = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "stroke.set", json!({"weight": 2})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("stroke.set", json!({"defaultsOnly": true, "weight": 7})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + assert_ne!(app.session.paint.stroke_width, 4.0, "the new-art width does not receive the unfinished expression"); + assert_eq!(stroke_of(&app, id).width, 1.0); +} + +#[test] +fn replacing_the_new_art_stroke_drops_an_unfinished_weight() { + let (mut app, _, _) = two_lines(); + run(&mut app, "select.set", json!({"ids": []})); + let before = app.session.new_art_stroke(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("stroke.set", json!({"cap": "round"})).unwrap(); + assert_eq!(p.app().session.new_art_stroke().width, before.width); + assert_ne!(p.app().session.new_art_stroke().cap, before.cap); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(p.app().session.new_art_stroke().width, 5.0); +} + +#[test] +fn adding_an_identical_new_art_stroke_drops_an_unfinished_weight() { + let (mut app, _, _) = two_lines(); + let name = run(&mut app, "graphicStyle.new", json!({"name": "Stroke"}))["name"].as_str().unwrap().to_owned(); + run(&mut app, "select.set", json!({"ids": []})); + run(&mut app, "graphicStyle.apply", json!({"name": name})); + let before = app.session.new_art(); + assert_eq!(before.items.iter().filter(|item| !item.is_fill()).count(), 1); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("graphicStyle.apply", json!({"name": name, "add": true})).unwrap(); + let after = p.app().session.new_art(); + assert_eq!(after.items.iter().filter(|item| !item.is_fill()).count(), 2); + assert_eq!(before.stroke(), after.stroke()); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + assert_eq!(app.session.new_art_stroke().width, 5.0); + assert!(app.session.new_art().items.iter().all(|item| match item { + vectorcraft_doc::AppearanceItem::Stroke(stroke) => stroke.width != 8.0, + _ => true, + })); +} + +#[test] +fn changing_a_later_character_stroke_drops_an_unfinished_weight() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [id.0]})); + run(&mut app, "paint.setStroke", json!({"color": "#ff0000"})); + let before = app.session.shown_stroke().unwrap().width; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setRangeStyle", json!({"id": id.0, "start": 2, "end": 6, "strokeOptions": {"weight": 2}})).unwrap(); + assert_eq!(p.app().session.shown_stroke().unwrap().width, before); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "each character takes the fresh weight"); +} + +#[test] +fn a_collapsed_type_caret_drops_an_unfinished_weight_when_other_characters_change() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "text.setRangeStyle", json!({"id": id.0, "strokeOptions": {"weight": 1}})); + run(&mut app, "select.set", json!({"ids": [id.0]})); + app.session.select_tool("type", Default::default()).unwrap(); + app.session.set_tool_option("textSelection", &json!({"editing": id.0, "anchor": 1, "caret": 1})); + assert_eq!(character::text_editing(&app), Some((id, 1, 1))); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setRangeStyle", json!({"id": id.0, "start": 3, "end": 6, "strokeOptions": {"weight": 2}})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert!(t.runs.iter().all(|run| run.style.stroke_width != 4.0), "the unfinished expression reaches no character"); + assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "the fresh weight edits the whole frame"); +} + +#[test] +fn moving_a_run_boundary_in_selected_characters_drops_an_unfinished_weight() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "text.setRangeStyle", json!({"id": id.0, "start": 0, "end": 2, "strokeOptions": {"weight": 1}})); + run(&mut app, "text.setRangeStyle", json!({"id": id.0, "start": 2, "end": 6, "strokeOptions": {"weight": 2}})); + run(&mut app, "select.set", json!({"ids": [id.0]})); + app.session.select_tool("type", Default::default()).unwrap(); + app.session.set_tool_option("textSelection", &json!({"editing": id.0, "anchor": 1, "caret": 5})); + assert_eq!(character::text_editing(&app), Some((id, 1, 5))); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setRangeStyle", json!({"id": id.0, "start": 2, "end": 3, "strokeOptions": {"weight": 1}})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert!(t.runs.iter().all(|run| run.style.stroke_width != 4.0), "the unfinished expression reaches no character"); + let widths: Vec<_> = t.runs.iter().map(|run| (run.text.as_str(), run.style.stroke_width)).collect(); + assert_eq!(widths, [("Strok", 1.0), ("e", 2.0)], "the fresh weight edits only the selected characters"); +} + +/// Enables drags on numeric field bodies while showing the Stroke panel. +fn show_with_field_scrubbing(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + use craft::ui::runtime::env::{ScrubDrags, with_env}; + with_env( + ui, + |env| { + env.values.set(ScrubDrags::FieldAndLabel); + }, + |ui| stroke::show(app, ui), + ); +} + +#[test] +fn moving_another_stroke_to_the_top_ends_a_held_dash_scrub() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"dash": [12, 12]})); + run(&mut app, "appearance.moveItem", json!({"from": 0, "to": 2})); + assert_eq!(app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()), Some(1)); + let mut p = Panel::new(app, show_with_field_scrubbing); + p.drag_hold_role("Dash 1", Role::SPIN_BUTTON, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).dash.unwrap().pattern[0]; + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + assert!(stroke_of(&p.app(), a).dash.unwrap().pattern[0] > first, "the held gesture changes its starting stroke"); + p.app().run("appearance.moveItem", json!({"from": 0, "to": 2})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()), Some(2)); + let before = stroke_of(&p.app(), a); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(48.0, 0.0))]); + p.frame(); + p.release(); + assert_eq!(stroke_of(&p.app(), a), before, "later pointer moves leave the new top stroke unchanged"); +} + +#[test] +fn swapping_the_top_strokes_ends_a_held_scrub_at_the_same_row() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"dash": [12, 12]})); + let top = app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()); + let mut p = Panel::new(app, show_with_field_scrubbing); + p.drag_hold_role("Dash 1", Role::SPIN_BUTTON, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).dash.unwrap().pattern[0]; + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + assert!(stroke_of(&p.app(), a).dash.unwrap().pattern[0] > first, "the scrub keeps changing its starting stroke"); + p.app().run("appearance.moveItem", json!({"from": 1, "to": 2})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()), top); + let before = stroke_of(&p.app(), a); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(48.0, 0.0))]); + p.frame(); + p.release(); + assert_eq!(stroke_of(&p.app(), a), before, "the held scrub leaves the replacement stroke unchanged"); +} + +#[test] +fn changing_global_edit_members_drops_an_unfinished_weight() { + for change in ["start", "stop", "exclude"] { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "edit.duplicate", json!({"dx": 20}))["ids"][0].as_u64().unwrap()); + let c = NodeId(run(&mut app, "edit.duplicate", json!({"dy": 20}))["ids"][0].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + if change != "start" { + run(&mut app, "select.globalEdit", json!({})); + assert_eq!(app.session.active().unwrap().global_edit.as_ref().unwrap().members.len(), 3); + } + let before = [a, b, c].map(|id| stroke_of(&app, id)); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + if change == "exclude" { + p.app().run("select.globalEditExclude", json!({"id": b.0})).unwrap(); + } else { + p.app().run("select.globalEdit", json!({})).unwrap(); + } + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "{change}: the draft is dropped"); + finish_typing(&mut p); + for (id, before) in [a, b, c].into_iter().zip(before) { + let after = stroke_of(&p.app(), id); + assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); + assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); + } + } +} + +#[test] +fn replacing_text_with_the_same_byte_length_drops_an_unfinished_weight() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [id.0]})); + run(&mut app, "paint.setStroke", json!({"color": "#ff0000"})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setText", json!({"id": id.0, "text": "Weight"})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert_eq!(t.plain_text(), "Weight"); + assert!(t.runs.iter().all(|run| run.style.stroke_width == 5.0), "the replacement text takes only the fresh value"); +} + +#[test] +fn a_new_art_weight_scrub_keeps_going() { + let (mut app, _, _) = two_lines(); + run(&mut app, "select.set", json!({"ids": []})); + let mut p = Panel::new(app, stroke::show); + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(12.0, 0.0)); + let first = p.app().session.new_art_stroke().width; + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + let further = p.app().session.new_art_stroke().width; + assert!(further > first, "the held scrub keeps increasing the new-art weight"); + p.release(); + assert_eq!(p.app().session.new_art_stroke().width, further); +} + +#[test] +fn an_unfinished_weight_stays_with_its_line_and_document() { + let (mut app, a, _) = two_lines(); + // A second document built the same way: its line `a` has the same id and weight. + run(&mut app, "file.new", json!({"width": 200, "height": 200})); + let other = run(&mut app, "shape.line", json!({"x1": 10, "y1": 50, "x2": 190, "y2": 50}))["id"].as_u64().unwrap(); + assert_eq!(other, a.0, "both documents' lines have the same id"); + run(&mut app, "select.set", json!({"ids": [a.0]})); + run(&mut app, "document.activate", json!({"index": 0})); + let mut p = Panel::new(app, stroke::show); + + // With the selection and the document unchanged, the value typed so far is kept: 3+5 gives 8. + start_typing(&mut p, "Weight"); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 8.0, "an unchanged target keeps the typed value"); + p.app().run("stroke.set", json!({"weight": 1})).unwrap(); + + // Another document with the same selection drops it. + start_typing(&mut p, "Weight"); + p.app().run("document.activate", json!({"index": 1})).unwrap(); + p.frame(); + finish_typing(&mut p); + let width = |index: u64| { + p.app().run("document.activate", json!({"index": index})).unwrap(); + stroke_of(&p.app(), a).width + }; + assert_eq!((width(0), width(1)), (1.0, 5.0), "the other document takes 5 pt"); +} + +#[test] +fn an_unfinished_weight_is_dropped_by_file_revert() { + let (mut app, a, _) = two_lines(); + let dir = vectorcraft_testkit::TempDir::new("stroke-revert"); + app.services.read = Some(Box::new(|path| std::fs::read(path).map_err(|e| e.to_string()))); + app.services.write = Some(Box::new(|path, bytes| std::fs::write(path, bytes).map_err(|e| e.to_string()))); + app.run("file.saveAs", json!({"path": dir.join("Lines.vectorcraft")})).unwrap(); + // An unsaved change for Revert to undo, leaving the lines as saved. + app.run("shape.rectangle", json!({"x": 100, "y": 80, "width": 20, "height": 20})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + + // The restored document has the same line and, selected again, the same selection. + p.app().run("file.revert", json!({"confirmed": true})).unwrap(); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "Revert drops the unfinished value"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_another_appearance_row_becomes_active() { + let (mut app, a, _) = two_lines(); + // Two strokes of 1 pt: the Stroke panel edits the active one. + run(&mut app, "appearance.addStroke", json!({})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [first, second] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + appearance::select_row(&mut app, appearance::Sel::Item(first)); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + appearance::select_row(&mut p.app(), appearance::Sel::Item(second)); + assert_eq!(p.app().session.appearance_item(), Some(second)); + p.frame(); + finish_typing(&mut p); + let widths = { + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (ap.stroke_at(Some(first)).unwrap().width, ap.stroke_at(Some(second)).unwrap().width) + }; + assert_eq!(widths, (1.0, 5.0), "the second row takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_its_layer_is_targeted() { + let (mut app, a, b) = two_lines(); + run(&mut app, "edit.clear", json!({"ids": [b.0]})); + let layer = app.session.active().unwrap().doc.parent_of(a).unwrap(); + // The layer's rows match the path's: a fill under a 1 pt stroke. + run(&mut app, "appearance.addFill", json!({"ids": [layer.0]})); + run(&mut app, "appearance.addStroke", json!({"ids": [layer.0]})); + assert_eq!(stroke_of(&app, a).width, stroke_of(&app, layer).width); + let fills = |id: NodeId| -> Vec { + app.session.active().unwrap().doc.node(id).unwrap().appearance.items.iter().map(|item| item.is_fill()).collect() + }; + assert_eq!(fills(a), fills(layer), "the path and the layer have their rows in one order"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + // The path stays selected, and `stroke.set` with no active row still edits the path's stroke. + p.app().run("layer.target", json!({"id": layer.0})).unwrap(); + assert_eq!(p.app().session.active().unwrap().selection.objects, [a]); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, layer).width), (5.0, 1.0), "the subject change drops the draft and the layer keeps 1 pt"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_strokes_of_one_color_swap_places() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"cap": "round"})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!((&lower.paint, lower.width), (&upper.paint, upper.width)); + assert_ne!(lower.cap, upper.cap); + } + let before = stroke_of(&app, a); + assert_eq!(app.session.appearance_item(), None); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let moved = app.session.active().unwrap().doc.node(a).unwrap().appearance.stroke_at(Some(bottom)).unwrap(); + assert_eq!((moved.cap, moved.width), (before.cap, before.width), "the moved stroke keeps its weight"); + let shown = stroke_of(&app, a); + assert_ne!(shown.cap, before.cap, "the other stroke is now on top"); + assert_eq!(shown.width, 5.0, "the top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_strokes_that_differ_in_miter_limit_swap() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "stroke.set", json!({"miterLimit": 4})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"miterLimit": 10})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!(lower.width, upper.width); + assert_eq!((lower.miter_limit, upper.miter_limit), (4.0, 10.0)); + let mut matched = upper.clone(); + matched.miter_limit = lower.miter_limit; + assert_eq!(lower, &matched, "only the miter limits differ"); + } + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!((lower.miter_limit, upper.miter_limit), (10.0, 4.0)); + assert_eq!((lower.width, upper.width), (1.0, 5.0), "the top stroke takes a fresh 5 pt, not 3+5"); +} + +#[test] +fn a_miter_only_stroke_swap_drops_the_miter_draft() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [b.0]})); + run(&mut app, "stroke.set", json!({"miterLimit": 6})); + let lower = stroke_of(&app, b); + run(&mut app, "appearance.addStroke", json!({})); + let upper = stroke_of(&app, a); + app.session + .edit("Strokes", |d, _| { + let ap = &mut d.node_mut(b).unwrap().appearance; + let indices: Vec<_> = (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect(); + *ap.stroke_at_mut(Some(indices[0])).unwrap() = lower.clone(); + *ap.stroke_at_mut(Some(indices[1])).unwrap() = upper.clone(); + Ok(()) + }) + .unwrap(); + let strokes: Vec<_> = { + let ap = &app.session.active().unwrap().doc.node(b).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + let mut matched = lower.clone(); + matched.miter_limit = upper.miter_limit; + assert_eq!(matched, upper, "only the miter limits differ"); + assert_ne!(lower.miter_limit, upper.miter_limit); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + let shown = current_stroke(&app).unwrap().miter_limit; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Miter limit"); + assert_eq!(p.value_role("Miter limit", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.app().run("appearance.moveItem", json!({"ids": [b.0], "from": top, "to": bottom})).unwrap(); + p.frame(); + assert_eq!(current_stroke(&p.app()).unwrap().miter_limit, shown, "the first path keeps the shown value"); + assert_ne!(p.value_role("Miter limit", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the field drops the draft"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + for id in [a, b] { + let ap = &app.session.active().unwrap().doc.node(id).unwrap().appearance; + for i in 0..ap.items.len() { + if let Some(stroke) = ap.stroke_at(Some(i)) { + assert_ne!(stroke.miter_limit, 4.0, "the draft cannot reach either path's strokes"); + } + } + } +} + +#[test] +fn an_unfinished_weight_is_dropped_when_strokes_swap_places() { + let (mut app, a, _) = two_lines(); + run(&mut app, "paint.setStroke", json!({"color": "#ff0000"})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "paint.setStroke", json!({"color": "#0000ff"})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + let before = stroke_of(&app, a); + assert_eq!(app.session.appearance_item(), None); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let moved = ap.stroke_at(Some(bottom)).unwrap(); + assert_eq!((moved.paint.clone(), moved.width), (before.paint.clone(), before.width), "the moved stroke keeps its weight"); + let shown = stroke_of(&app, a); + assert_ne!(shown.paint, before.paint, "the other stroke is now on top"); + assert_eq!(shown.width, 5.0, "the top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_the_group_gets_its_own_stroke() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + assert!(app.session.active().unwrap().doc.node(group).unwrap().appearance.stroke().is_none()); + let before = stroke_of(&app, a).width; + assert_eq!(stroke_of(&app, b).width, before); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [group.0]})).unwrap(); + assert_eq!(stroke_of(&p.app(), group).width, before, "the group's stroke has the members' weight"); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), group).width, 5.0, "the group's stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_group_member_gets_a_stroke_on_top() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + assert!(app.session.active().unwrap().doc.node(group).unwrap().appearance.stroke().is_none()); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [a.0]})).unwrap(); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the member's top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_arrowhead_scale_is_dropped_when_a_member_of_a_stroked_group_gets_a_stroke_on_top() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "appearance.addStroke", json!({"ids": [group.0]})); + assert!(app.session.active().unwrap().doc.node(group).unwrap().appearance.stroke().is_some()); + assert_eq!(app.session.appearance_item(), None, "no row is active"); + let before = stroke_of(&app, b).arrow_scale; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Scale 1"); + p.app().run("appearance.addStroke", json!({"ids": [b.0]})).unwrap(); + assert_eq!(stroke_of(&p.app(), b).arrow_scale, before, "the new top stroke has the same arrowhead scale"); + assert_eq!(p.app().session.active().unwrap().selection.objects, [group]); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), b).arrow_scale.0, 5.0, "the member's top stroke takes 5, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_stroke_is_added_to_the_compound_of_a_selected_member() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + let compound = NodeId(run(&mut app, "object.compoundPath.make", json!({}))["id"].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + assert_eq!(app.session.active().unwrap().selection.objects, [a]); + assert_eq!(app.session.active().unwrap().doc.parent_of(a), Some(compound)); + let before = stroke_of(&app, compound).width; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [compound.0]})).unwrap(); + assert_eq!(p.app().session.active().unwrap().selection.objects, [a]); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + assert_eq!(stroke_of(&p.app(), compound).width, before, "the top stroke has the same weight"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let widths: Vec = app.session.active().unwrap().doc.node(compound).unwrap().appearance.painted_strokes().map(|s| s.width).collect(); + assert_eq!(widths, [before, 5.0], "the compound's new top stroke takes 5 pt, not 3+5"); + assert!(app.session.active().unwrap().doc.node(a).unwrap().appearance.stroke().is_none(), "the member has no stroke of its own"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_another_symbol_part_is_selected() { + let (mut app, a, b) = two_lines(); + let instance = run(&mut app, "symbol.new", json!({"name": "Lines", "ids": [a.0, b.0], "type": "dynamic"}))["id"].as_u64().unwrap(); + run(&mut app, "symbol.instance.selectPart", json!({"id": instance, "path": [0]})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("symbol.instance.selectPart", json!({"id": instance, "path": [1]})).unwrap(); + p.frame(); + assert_eq!(p.app().session.active().unwrap().selection.objects, [NodeId(instance)]); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the field drops the first part's draft"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_fill_row_becomes_active() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addFill", json!({})); + let fill = app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().position(|item| item.is_fill()).unwrap(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + appearance::select_row(&mut p.app(), appearance::Sel::Item(fill)); + assert_eq!(p.app().session.appearance_item(), Some(fill)); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the edit state change drops the unfinished value"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_the_live_paint_bucket_is_chosen() { + let (app, a, _) = two_lines(); + assert_eq!(stroke_of(&app, a).width, app.session.paint.stroke_width, "the line and the bucket's stroke have one weight"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().session.select_tool("livePaintBucket", Default::default()).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, app.session.paint.stroke_width), (1.0, 5.0), "the bucket's stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_other_characters_are_selected() { + use vectorcraft_doc::NodeKind; + use vectorcraft_engine::ViewInfo; + use vectorcraft_tools::{PointerEvent, PointerKind}; + let mut app = crate::testing::windowed(VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default())); + run(&mut app, "file.new", json!({"width": 400, "height": 300})); + let v = ViewInfo::default(); + app.session.select_tool("type", v).unwrap(); + for k in [PointerKind::Down, PointerKind::Up] { + app.session.pointer(&PointerEvent::new(k, 50.0, 200.0), v).unwrap(); + } + app.session.tool_text("Make this bold", v).unwrap(); + app.session.set_tool_option("select", &json!({"start": 0, "end": 4})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().session.set_tool_option("select", &json!({"start": 5, "end": 9})); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let id = app.session.active().unwrap().selection.objects[0]; + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + let widths: Vec<(&str, f64)> = t.runs.iter().map(|r| (r.text.as_str(), r.style.stroke_width)).collect(); + assert_eq!(widths, [("Make ", 0.0), ("this", 5.0), (" bold", 0.0)], "the second selection takes 5 pt, not 3+5"); +} + +#[test] +fn a_weight_scrub_that_creates_the_stroke_keeps_going() { + let (mut app, a, _) = two_lines(); + let stroke = app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().position(|item| !item.is_fill()).unwrap(); + run(&mut app, "appearance.removeItem", json!({"index": stroke})); + assert!(app.session.active().unwrap().doc.node(a).unwrap().appearance.stroke().is_none()); + let original = app.session.active().unwrap().doc.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let mut p = Panel::new(app, stroke::show); + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).width; + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + let further = stroke_of(&p.app(), a).width; + assert!(further > first, "the held scrub keeps increasing the weight after creating the stroke: {first} to {further}"); + p.release(); + assert_eq!(stroke_of(&p.app(), a).width, further, "release keeps the weight from the whole drag"); + { + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + assert_eq!(ap.items.iter().filter(|item| !item.is_fill()).count(), 1, "the scrub creates exactly one stroke row"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1, "the whole scrub is one undo step"); + } + p.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc, original, "one undo removes the scrub's stroke"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_stroke_is_added_on_top() { + let (app, a, _) = two_lines(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + // The new stroke has the line's 1 pt and goes on top, where `stroke.set` edits with no active row. + p.app().run("appearance.addStroke", json!({})).unwrap(); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let widths: Vec = app.session.active().unwrap().doc.node(a).unwrap().appearance.painted_strokes().map(|s| s.width).collect(); + assert_eq!(widths, [1.0, 5.0], "the new top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_fill_is_added() { + let (app, a, _) = two_lines(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + // A fill on top leaves the stroke `stroke.set` edits as it was. + p.app().run("appearance.addFill", json!({})).unwrap(); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the edit state change drops the unfinished value"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_the_whole_story_is_selected() { + use vectorcraft_doc::NodeKind; + let mut app = crate::testing::windowed(VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default())); + run(&mut app, "file.new", json!({"width": 900, "height": 300})); + let story = "The quick brown fox jumps over the lazy dog and keeps running far beyond the first frame. ".repeat(6); + let area = json!({"x": 10, "y": 10, "text": story, "size": 12, "area": {"width": 150, "height": 100}}); + let a = run(&mut app, "text.create", area)["id"].as_u64().unwrap(); + let b = run(&mut app, "text.thread.add", json!({"from": a, "rect": [200, 10, 150, 200]}))["id"].as_u64().unwrap(); + // Every character of frame `a`, then the whole story from it: the same frame and characters either way. + run(&mut app, "select.set", json!({"ids": [a]})); + app.session.select_tool("type", Default::default()).unwrap(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(a)).unwrap().kind else { panic!("type") }; + let len = vectorcraft_text::edit::runs_len(&t.runs); + app.session.set_tool_option("textSelection", &json!({"editing": a, "anchor": 0, "caret": len})); + let frame = character::text_editing(&app); + assert!(character::text_story(&app).is_none(), "one frame's characters"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("select.all", json!({})).unwrap(); + assert!(character::text_story(&p.app()).is_some(), "the whole story"); + assert_eq!(character::text_editing(&p.app()), frame, "the same frame and characters"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let widths = |id: u64| { + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("type") }; + t.runs.iter().map(|r| r.style.stroke_width).collect::>() + }; + assert!(widths(a).iter().chain(&widths(b)).all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {:?} {:?}", widths(a), widths(b)); +} + +#[test] +fn an_unfinished_weight_in_an_appearance_row_does_not_reach_another_line() { + let (app, a, b) = two_lines(); + let mut p = Panel::new(app, appearance::show); + start_typing(&mut p, "Weight"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, b).width), (1.0, 5.0), "b takes 5 pt, not 3+5"); +} + +#[test] +fn changing_global_edit_members_drops_an_unfinished_appearance_weight() { + for change in ["start", "stop", "exclude"] { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "edit.duplicate", json!({"dx": 20}))["ids"][0].as_u64().unwrap()); + let c = NodeId(run(&mut app, "edit.duplicate", json!({"dy": 20}))["ids"][0].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + if change != "start" { + run(&mut app, "select.globalEdit", json!({})); + assert_eq!(app.session.active().unwrap().global_edit.as_ref().unwrap().members.len(), 3); + } + let before = [a, b, c].map(|id| stroke_of(&app, id)); + let mut p = Panel::new(app, appearance::show); + start_typing(&mut p, "Weight"); + if change == "exclude" { + p.app().run("select.globalEditExclude", json!({"id": b.0})).unwrap(); + } else { + p.app().run("select.globalEdit", json!({})).unwrap(); + } + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "{change}: the draft is dropped"); + finish_typing(&mut p); + for (id, before) in [a, b, c].into_iter().zip(before) { + let after = stroke_of(&p.app(), id); + assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); + assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); + } + } +} + +#[test] +fn an_unfinished_weight_in_an_appearance_row_is_dropped_when_equal_width_strokes_swap() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "stroke.set", json!({"miterLimit": 4})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"miterLimit": 10})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!(lower.width, upper.width); + assert_ne!(lower.miter_limit, upper.miter_limit); + let mut matched = upper.clone(); + matched.miter_limit = lower.miter_limit; + assert_eq!(lower, &matched, "only the miter limits differ"); + } + let mut p = Panel::new(app, appearance::show); + start_typing(&mut p, "Weight"); + p.frame(); + assert_eq!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + let focused = p.ctx().memory(|m| m.focused()).expect("the row weight has focus"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + assert_eq!(p.ctx().memory(|m| m.focused()), Some(focused), "the same row field keeps focus across the swap"); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let widths: Vec<_> = ap + .items + .iter() + .filter_map(|item| match item { + vectorcraft_doc::AppearanceItem::Stroke(stroke) => Some(stroke.width), + _ => None, + }) + .collect(); + assert!(widths.iter().all(|width| *width != 8.0), "neither stroke receives 3+5: {widths:?}"); + assert_eq!(widths.iter().filter(|width| **width == 5.0).count(), 1, "the focused row takes a fresh 5 pt: {widths:?}"); +} + +#[test] +fn an_unfinished_group_weight_is_dropped_when_a_member_gets_a_stroke() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "appearance.addStroke", json!({"ids": [group.0]})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [a.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), group).width, 5.0, "the document change drops the unfinished value"); +} + +#[test] +fn a_weight_scrub_on_an_active_row_at_different_indices_keeps_going() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 10, "width": 50, "height": 100}))["id"].as_u64().unwrap()); + run(&mut app, "appearance.addFill", json!({"ids": [b.0]})); + run(&mut app, "appearance.moveItem", json!({"ids": [b.0], "from": 2, "to": 0})); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "appearance.setActiveItem", json!({"index": 1})); + for (id, index) in [(a, 1), (b, 2)] { + assert!(app.session.active().unwrap().doc.node(id).unwrap().appearance.stroke_at(Some(index)).is_some()); + } + let original = app.session.active().unwrap().doc.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let mut p = Panel::new(app, stroke::show); + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).width; + assert!(first > 1.0, "the first preview changes the weight"); + assert_eq!(stroke_of(&p.app(), b).width, first, "both matched rows receive the preview"); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + let further = stroke_of(&p.app(), a).width; + assert!(further > first, "the held scrub continues after its first preview"); + assert_eq!(stroke_of(&p.app(), b).width, further); + p.release(); + assert_eq!(stroke_of(&p.app(), a).width, further); + assert_eq!(stroke_of(&p.app(), b).width, further); + assert_eq!(p.app().session.active().unwrap().history.undo.len(), undo + 1, "the whole scrub is one undo step"); + p.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc, original); +} + +#[test] +fn a_weight_scrub_matching_a_lower_stroke_keeps_going() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 10, "width": 50, "height": 100}))["id"].as_u64().unwrap()); + app.session + .edit("Strokes", |d, _| { + let top = d.node(a).unwrap().appearance.stroke().unwrap().clone(); + let ap = &mut d.node_mut(b).unwrap().appearance; + ap.stroke_mut().unwrap().width = 2.0; + ap.items.push(vectorcraft_doc::AppearanceItem::Stroke(top)); + Ok(()) + }) + .unwrap(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "appearance.setActiveItem", json!({"index": 1})); + let original = app.session.active().unwrap().doc.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let mut p = Panel::new(app, stroke::show); + // A vertical move starts the horizontal scrub without changing the weight. + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(0.0, 12.0)); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(1.0, 0.0))]); + p.frame(); + assert_eq!(stroke_of(&p.app(), a).width, 2.0); + assert_eq!(stroke_of(&p.app(), b).width, 2.0, "the top stroke receives the matching preview"); + assert!(p.app().session.active().unwrap().interaction.is_some(), "the held scrub is still running at 2 pt"); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(3.0, 0.0))]); + p.frame(); + let further = stroke_of(&p.app(), a).width; + assert!(further > 2.0, "the scrub continues past the lower stroke's weight"); + assert_eq!(stroke_of(&p.app(), b).width, further, "both top strokes keep receiving previews"); + assert_eq!(p.app().session.active().unwrap().doc.node(b).unwrap().appearance.stroke_at(Some(1)).unwrap().width, 2.0); + p.release(); + assert_eq!(stroke_of(&p.app(), a).width, further); + assert_eq!(stroke_of(&p.app(), b).width, further); + assert_eq!(p.app().session.active().unwrap().history.undo.len(), undo + 1, "the scrub is one undo step"); + p.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc, original); +} + +#[test] +fn a_width_only_stroke_swap_drops_the_weight_draft() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 10, "width": 50, "height": 100}))["id"].as_u64().unwrap()); + app.session + .edit("Strokes", |d, _| { + let mut top = d.node(a).unwrap().appearance.stroke().unwrap().clone(); + top.width = 3.0; + let ap = &mut d.node_mut(b).unwrap().appearance; + ap.stroke_mut().unwrap().width = 2.0; + ap.items.push(vectorcraft_doc::AppearanceItem::Stroke(top)); + Ok(()) + }) + .unwrap(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + let mut p = Panel::new(app, stroke::show); + assert_eq!(p.value_role("Weight", Role::SPIN_BUTTON).unwrap_or_default(), ""); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"ids": [b.0], "from": 2, "to": 1})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the swap drops the typed value"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + for id in [a, b] { + let ap = &app.session.active().unwrap().doc.node(id).unwrap().appearance; + assert!(ap.painted_strokes().all(|s| s.width != 4.0), "no stroke receives the discarded 3+1 draft"); + } + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, b).width), (1.0, 1.0), "the fresh value reaches both top strokes"); +} + +#[test] +fn an_empty_groups_new_art_stroke_change_drops_an_unfinished_weight() { + let (mut app, _, _) = two_lines(); + let group = app + .session + .edit("Empty group", |doc, _| { + let id = doc.alloc_id(); + doc.insert(doc.default_layer(), 0, vectorcraft_doc::Node::group(id, vec![]))?; + Ok(id) + }) + .unwrap(); + run(&mut app, "select.set", json!({"ids": [group.0]})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + let before = p.app().session.new_art_stroke(); + p.app().run("stroke.set", json!({"cap": "round"})).unwrap(); + let after = p.app().session.new_art_stroke(); + assert_eq!(after.width, before.width); + assert_ne!(after.cap, before.cap); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(p.app().session.new_art_stroke().width, 5.0, "new art receives only the fresh value"); +} + +#[test] +fn simplifying_the_new_art_stack_drops_an_unfinished_appearance_weight() { + let mut app = app_with_rect(); + run(&mut app, "appearance.setNewArtBasic", json!({"on": false})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "select.none", json!({})); + let inherited = app.session.new_art(); + assert_eq!(inherited.items.len(), 3, "a fill below two strokes"); + let lower = inherited.stroke_at(Some(1)).unwrap(); + assert_eq!(lower.width, inherited.stroke_at(Some(2)).unwrap().width); + let mut p = Panel::new(app, appearance::show); + p.click_role_nth("Weight", Role::SPIN_BUTTON, 1); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + p.frame(); + assert!(p.shows_value("3+"), "the lower stroke holds the unfinished value"); + let revision = p.app().session.active().unwrap().revision; + p.app().run("appearance.setNewArtBasic", json!({"on": true})).unwrap(); + assert_eq!(p.app().session.active().unwrap().revision, revision, "only the preference changes"); + assert_eq!(p.app().session.new_art().items.len(), 2, "one stroke survives at the lower stroke's row index"); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(p.app().session.new_art_stroke().width, 5.0, "new art receives 5 pt, not 3+5"); +} + +#[test] +fn unlocking_a_global_edit_member_drops_an_unfinished_weight() { + for show in [stroke::show, appearance::show] { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "edit.duplicate", json!({"dx": 20}))["ids"][0].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + run(&mut app, "select.globalEdit", json!({})); + run(&mut app, "object.lock", json!({"ids": [b.0]})); + assert!(app.session.active().unwrap().global_edit.as_ref().unwrap().members.iter().any(|(id, _)| *id == b)); + let mut p = Panel::new(app, show); + start_typing(&mut p, "Weight"); + p.app().run("object.unlockAll", json!({})).unwrap(); + assert!(!p.app().session.active().unwrap().doc.node(b).unwrap().locked); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + assert_eq!(p.app().session.active().unwrap().global_edit.as_ref().unwrap().members.len(), 2); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_ne!(stroke_of(&p.app(), b).width, 8.0, "the unfinished expression does not reach the unlocked member"); + } +} + +#[test] +fn an_outside_appearance_change_ends_a_held_scrub() { + for name in ["Miter limit", "Dash 1", "Gap 1", "Dash offset", "Scale 1"] { + let (app, a, _) = two_lines(); + let mut p = Panel::new(app, show_with_field_scrubbing); + p.drag_hold_role(name, Role::SPIN_BUTTON, egui::vec2(12.0, 0.0)); + p.app().run("appearance.setItem", json!({"index": 0, "opacity": 0.5})).unwrap(); + let before = stroke_of(&p.app(), a); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(48.0, 0.0))]); + p.frame(); + p.release(); + assert_eq!(stroke_of(&p.app(), a), before, "{name}: later pointer moves leave the changed stroke alone"); + } +} + +#[test] +fn rebasing_a_tool_preview_drops_an_unfinished_weight() { + use vectorcraft_engine::ViewInfo; + use vectorcraft_tools::{PointerEvent, PointerKind}; + for show in [stroke::show, appearance::show] { + let (mut app, a, b) = two_lines(); + let view = ViewInfo { smart_guides: false, ..Default::default() }; + app.session.select_tool("selection", view).unwrap(); + for (kind, x) in [(PointerKind::Down, 50.0), (PointerKind::Drag, 60.0)] { + app.session.pointer(&PointerEvent::new(kind, x, 50.0), view).unwrap(); + } + assert!(app.session.active().unwrap().interaction.as_ref().unwrap().by_tool()); + let mut p = Panel::new(app, show); + start_typing(&mut p, "Weight"); + let revision = p.app().session.active().unwrap().interaction.as_ref().unwrap().revision; + p.app().run("appearance.setItem", json!({"ids": [b.0], "index": 1, "opacity": 0.5})).unwrap(); + assert!(p.app().session.active().unwrap().interaction.as_ref().unwrap().revision > revision); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the rebased document receives only the fresh value"); + assert_ne!(stroke_of(&p.app(), b).width, 8.0, "the unfinished expression reaches no other stroke"); + } +} diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 95c0b2f649..fc3210dc19 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "37d0532f42eb3421769c8a454e3e25a20fbcff97"; +const REV: &str = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 4f421c32ae2a0460b107ef52a1a686f97551d879 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 22:06:35 -0800 Subject: [PATCH 06/24] Effects: a cached effect raster follows the edge smoothing mode and ready placed bitmaps Art and Type edge smoothing share a coverage threshold, but Type snaps glyphs to the pixel grid, so a raster's inputs now hold the mode itself. While placed documents draw in the background, a raster of content that holds a placed document, shows symbol art or uses brushed strokes is made again once a background bitmap is ready. Content with only ordinary images, or painted only with patterns (whose tiles draw without background bitmaps), keeps its raster. --- crates/render/src/fx/entries.rs | 27 ++++++- crates/render/src/fx/pixels.rs | 33 ++++---- crates/render/src/fx/tests.rs | 90 ++++++++++++++++++++++ crates/render/src/tests/placed_document.rs | 86 +++++++++++++++++++++ 4 files changed, 218 insertions(+), 18 deletions(-) diff --git a/crates/render/src/fx/entries.rs b/crates/render/src/fx/entries.rs index 64c1cf5ad9..1f9e930cc4 100644 --- a/crates/render/src/fx/entries.rs +++ b/crates/render/src/fx/entries.rs @@ -227,6 +227,10 @@ pub(crate) struct Reads { /// Images and placed documents: their pixels and files, and the options and the layer's Dim /// Images they are drawn with. pub(super) images: bool, + /// Placed documents, symbol art and brushed strokes: the global bitmap generation while + /// progressive previews are on. Symbol and brush art can hold placed documents. Pattern tiles + /// draw with progressive previews off. + pub(super) placed_documents: bool, /// Brushed strokes: the brush library. pub(super) brushes: bool, /// Type: the fonts, whether overprinting shows ([`crate::proof::overprints`]) and the @@ -243,13 +247,24 @@ impl Reads { Self::of_all(std::iter::once(n)) } - /// What the content of `nodes` reads together. A pattern's art can hold anything, as a - /// symbol's can, so content painted with a pattern reads everything else too (#1723). + /// What the content of `nodes` reads together. Pattern and symbol art can hold anything, so + /// content showing either reads the other document resources too (#1723). Progressive bitmap + /// readiness follows content that holds placed documents, shows symbol art or uses brushed + /// strokes. Pattern tiles draw with progressive previews off. pub(crate) fn of_all<'a>(nodes: impl Iterator) -> Self { let mut reads = Self::default(); nodes.for_each(|n| reads.add(n)); + reads.placed_documents |= reads.symbols || reads.brushes; if reads.symbols || reads.patterns { - return Self { patterns: true, symbols: true, images: true, brushes: true, text: true, plugins: reads.plugins }; + return Self { + patterns: true, + symbols: true, + images: true, + placed_documents: reads.placed_documents, + brushes: true, + text: true, + plugins: reads.plugins, + }; } reads } @@ -280,7 +295,11 @@ impl Reads { } match &c.kind { NodeKind::SymbolInstance { .. } => self.symbols = true, - NodeKind::Image(_) | NodeKind::PlacedDocument(_) => self.images = true, + NodeKind::Image(_) => self.images = true, + NodeKind::PlacedDocument(_) => { + self.images = true; + self.placed_documents = true; + } NodeKind::Text(t) => { self.text = true; self.symbols |= t.runs.iter().any(|r| r.inline.is_some()); diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 56f10e763d..41dfc7e0cb 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -593,24 +593,26 @@ impl Renderer { } /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the - /// color settings, the edge smoothing, the hidden objects, whether guides and template layers - /// are left out, the guide color and style, whether Layer Options show on screen, whether - /// dashed strokes draw as solid lines, the document's raster effects resolution (which a Rasterize or De-Interlace anywhere - /// in the content follows), the knockout `n` inherits and, while `n` holds the isolated group, - /// isolation mode; the pattern definitions, symbols and + /// color settings, the edge smoothing mode, the hidden objects, whether guides and template + /// layers are left out, the guide color and style, whether Layer Options show on screen, + /// whether dashed strokes draw as solid lines, the document's raster effects resolution (which + /// a Rasterize or De-Interlace anywhere in the content follows), the knockout `n` inherits and, + /// while `n` holds the isolated group, isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the - /// layer's Dim Images and the options they are drawn with (with - /// [`crate::RenderOptions::kept_images_only`], also which pixels and undecodable notes the - /// image store holds); for type the fonts and the hyphenation exceptions, whether overprinting shows - /// ([`crate::proof::overprints`]) and Document Setup's substitution highlights; and the - /// plug-ins installed, with the names of the document's swatches and patterns and its pattern - /// definitions (a plug-in's painted pieces can name them), when an object in it has a plug-in - /// effect, and when it shows symbol or pattern art and an object in the document's symbol or - /// pattern art has one. + /// layer's Dim Images, the options they are drawn with, and (with + /// [`crate::RenderOptions::kept_images_only`]) which pixels and undecodable notes the image + /// store holds; for content that holds placed documents, shows symbol art or uses brushed + /// strokes, the global bitmap generation ([`crate::placed_document::generation`]) while + /// progressive previews are on (pattern tiles draw with them off); for type the fonts and the + /// hyphenation exceptions, whether overprinting shows ([`crate::proof::overprints`]) and + /// Document Setup's substitution highlights; and the plug-ins installed, with the names of + /// the document's swatches and patterns and its pattern definitions (a plug-in's painted + /// pieces can name them), when an object in it has a plug-in effect, and when it shows symbol + /// or pattern art and an object in the document's symbol or pattern art has one. pub(crate) fn raster_inputs(&mut self, f: &Frame, n: &Node, reads: Reads) -> Inputs { let doc = self.doc_inputs(f.doc); let mut h = DefaultHasher::new(); - (doc.cms, f.opts.anti_alias.threshold(), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); + (doc.cms, std::mem::discriminant(&f.opts.anti_alias), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); // Cached effects on containers can include paths made into guides, drawn in the guide // color and style, template layers, and sublayers drawn as their Layer Options show them. let o = f.opts; @@ -639,6 +641,9 @@ impl Renderer { // or notes an image as undecodable. o.kept_images_only.then(|| crate::images::store().added()).hash(&mut h); } + if reads.placed_documents && o.progressive_placed { + crate::placed_document::generation().hash(&mut h); + } if reads.brushes { self.brushes.library_key(f.doc, self.stamp).hash(&mut h); } diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 970bbcc514..8a4580f327 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -9,6 +9,59 @@ use super::{DRAG_PIXEL_BUDGET, Drawn, PIXEL_BUDGET, drag_scale, filter_region, f use crate::tests_fontchange::{fonts_steady, with_fonts_unchanged}; use crate::{RenderOptions, Rendered, Renderer}; +/// Placed documents, symbol art and brushed strokes follow progressive bitmap readiness. +/// Plain images and paths painted only with patterns keep their rasters when a bitmap is ready. +#[test] +fn reads_follow_progressive_placed_documents_in_content_and_art() { + use super::Reads; + use vectorcraft_doc::{ImageObject, LinkInfo, NodeKind, PlacedDocument}; + + let mut d = Document::new(100.0, 100.0); + let placed = Node::new( + d.alloc_id(), + NodeKind::PlacedDocument(Box::new(PlacedDocument { + link: LinkInfo::new("/art/card.vectorcraft"), + key: "placed".into(), + bounding: false, + page_box: Default::default(), + width: 20.0, + height: 20.0, + xf: Affine::IDENTITY, + placement: Default::default(), + })), + ); + assert!(Reads::of(&placed).placed_documents, "a placed document reads progressive bitmap readiness"); + + let symbol = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Stamp".into(), xf: Affine::IDENTITY }); + assert!(Reads::of(&symbol).placed_documents, "a symbol instance reads progressive bitmap readiness"); + + let mut appearance = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 1.0); + appearance.stroke_mut().unwrap().brush = Some("Stamp".into()); + let brushed = Node::path(d.alloc_id(), shapes::line((0.0, 0.0).into(), (20.0, 20.0).into()), appearance); + assert!(Reads::of(&brushed).placed_documents, "a brushed stroke reads progressive bitmap readiness"); + + let image = Node::new( + d.alloc_id(), + NodeKind::Image(Box::new(ImageObject { + key: "image".into(), + width: 20, + height: 20, + xf: Affine::IDENTITY, + link: None, + placement: Default::default(), + pixels: None, + })), + ); + assert!(!Reads::of(&image).placed_documents, "a plain image does not read progressive bitmap readiness"); + + let patterned = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(0.0, 0.0, 20.0, 20.0)), + Appearance::basic(Paint::Pattern { pattern: "Tile".into(), xf: Affine::IDENTITY }, Paint::None, 0.0), + ); + assert!(!Reads::of(&patterned).placed_documents, "a pattern-only path does not read progressive bitmap readiness"); +} + /// Rasterize and culling include the complete rendered image under lights from opposite sides. #[test] fn rendered_three_d_painted_bounds_hold_both_shadows() { @@ -2052,6 +2105,43 @@ fn guide_style_and_layer_options_filter_the_whole_object_raster_again_after_a_pa } } +/// Art and Type edge smoothing share a coverage threshold, but Type snaps glyphs to the pixel +/// grid: switching between them filters the whole-object raster of a group with type again after +/// a pan by whole pixels. +#[test] +fn anti_aliasing_mode_filters_the_whole_object_text_raster_again_after_a_pan() { + use vectorcraft_doc::NodeKind; + use vectorcraft_doc::text::{CharStyle, TextObject}; + + let _fonts = fonts_steady(); + let mut d = Document::new(100.0, 100.0); + let white = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(100.0, 100.0, 300.0, 250.0)), + Appearance::basic(Paint::solid(Color::WHITE), Paint::None, 0.0), + ); + let style = CharStyle { font_family: "Source Sans 3".into(), size: 20.0, fill: Paint::solid(Color::BLACK), ..Default::default() }; + let text = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(Point::new(270.013, 180.017), "Hm", style)))); + let mut group = Node::group(d.alloc_id(), vec![Arc::new(white), Arc::new(text)]); + group.appearance.effects = vec![Effect { id: "blur.radial".into(), params: json!({"amount": 1, "quality": "draft"}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, group).unwrap(); + let art = RenderOptions { background: Some([255, 255, 255, 255]), anti_alias: crate::AntiAlias::Art, ..Default::default() }; + let snapped = RenderOptions { anti_alias: crate::AntiAlias::Type, ..art.clone() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-280.0, -175.0)); + with_fonts_unchanged(|| { + let unchanged = Renderer::new().render(&d, 1280, 800, view(40.0), &art).pixels; + let fresh = Renderer::new().render(&d, 1280, 800, view(40.0), &snapped).pixels; + assert!(fresh != unchanged, "Art and Type anti-aliasing draw different text pixels"); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &art); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + let pixels = r.render(&d, 1280, 800, view(40.0), &snapped).pixels; + assert!(pixels == fresh, "changing anti-aliasing mode filters the text again after a whole-pixel pan"); + }); +} + /// A whole-object raster gives way to its view copy when the cache budget cannot hold both. /// The same view draws the copy again without filtering the content. #[test] diff --git a/crates/render/src/tests/placed_document.rs b/crates/render/src/tests/placed_document.rs index d7606f3094..09916148d5 100644 --- a/crates/render/src/tests/placed_document.rs +++ b/crates/render/src/tests/placed_document.rs @@ -575,6 +575,92 @@ fn on_screen_a_placed_document_shows_a_placeholder_then_its_bitmap() { } } +/// A group with a whole-object effect drawn while its placed document showed a placeholder +/// filters its content again with the bitmap after a pan by whole pixels. +#[test] +fn a_ready_placed_bitmap_filters_the_whole_object_raster_again_after_a_pan() { + let _serial = serial(); + vectorcraft_doc::placed_document::set_loader(gated_blue_page); + let mut d = Document::new(100.0, 100.0); + let key = "whole-object-preview-1"; + d.images.insert(key.into(), ImageBlob::new("application/json", b"blue whole-object preview".to_vec())); + let white = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(100.0, 100.0, 300.0, 250.0)), + Appearance::basic(Paint::solid(Color::WHITE), Paint::None, 0.0), + ); + let placed = placed_node(d.alloc_id().0, key, 40.0, 20.0, Affine::translate((280.0, 170.0)) * Affine::scale(0.5)); + let mut group = Node::group(d.alloc_id(), vec![Arc::new(white), Arc::new(placed)]); + group.appearance.effects = + vec![vectorcraft_doc::Effect { id: "blur.radial".into(), params: serde_json::json!({"amount": 1, "quality": "draft"}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, group).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), progressive_placed: true, ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-290.0, -175.0)); + let gate = shut_gate(); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let image = &r.pixel_fx.values().next().unwrap().image; + assert!( + image.width() > 1280 && image.height() > 800 && f64::from(image.width()) < 200.0 * 64.0, + "the group keeps a lower-resolution whole-object effect raster" + ); + let placeholder = Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels; + drop(gate); + settle(); + let fresh = Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(fresh != placeholder, "the ready placed bitmap changes the effect's pixels"); + let pixels = r.render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(pixels == fresh, "a ready placed bitmap filters the content again after a whole-pixel pan"); +} + +/// A group with a whole-object effect that holds only an ordinary image keeps its raster after a +/// placed document's bitmap in another document is ready and the view pans by whole pixels. +#[test] +fn an_ordinary_image_keeps_its_whole_object_raster_when_a_placed_bitmap_elsewhere_is_ready() { + let _serial = serial(); + let elsewhere = doc("ordinary-image-unrelated-preview-1"); + let mut d = Document::new(100.0, 100.0); + let raw = [0u8, 0, 255, 255].repeat(40 * 20); + let blue = craft_image_codecs::Image::from_raw(40, 20, craft_image_codecs::ChannelLayout::Rgba, craft_image_codecs::SampleType::U8, raw).unwrap(); + let png = craft_image_codecs::encode(&blue, craft_image_codecs::Format::Png, &craft_image_codecs::EncodeOptions::default()).unwrap(); + let key = "whole-object-ordinary-image-1"; + d.images.insert(key.into(), ImageBlob::new("image/png", png.to_vec())); + let image = vectorcraft_doc::ImageObject { + key: key.into(), + width: 40, + height: 20, + xf: Affine::translate((10.0, 10.0)) * Affine::scale(2.0), + link: None, + placement: Default::default(), + pixels: None, + }; + let image = Node::new(d.alloc_id(), NodeKind::Image(Box::new(image))); + let mut group = Node::group(d.alloc_id(), vec![Arc::new(image)]); + group.appearance.effects = + vec![vectorcraft_doc::Effect { id: "blur.radial".into(), params: serde_json::json!({"amount": 1, "quality": "draft"}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, group).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), progressive_placed: true, ..Default::default() }; + let gate = shut_gate(); + let mut r = Renderer::new(); + let _ = r.render(&d, 100, 100, Affine::IDENTITY, &opts); + let kept = r.pixel_fx.values().next().unwrap().image.clone(); + let _ = r.render(&d, 100, 100, Affine::translate((8.0, 0.0)), &opts); + assert!(Arc::ptr_eq(&kept, &r.pixel_fx.values().next().unwrap().image), "a whole-pixel pan keeps the ordinary image's effect raster"); + let generation = placed_document::generation(); + render(&elsewhere, true); + assert!(placed_document::pending_for("ordinary-image-unrelated-preview-1"), "the unrelated placed bitmap waits for the gate"); + drop(gate); + settle(); + assert!(placed_document::generation() > generation, "the unrelated placed bitmap becomes ready"); + let _ = r.render(&d, 100, 100, Affine::translate((16.0, 0.0)), &opts); + assert!( + Arc::ptr_eq(&kept, &r.pixel_fx.values().next().unwrap().image), + "an unrelated ready placed bitmap preserves the ordinary image's effect raster after a whole-pixel pan" + ); +} + #[test] fn a_bitmap_that_panics_while_made_on_the_drawing_thread_stops_being_pending() { let _serial = serial(); From d445184a1fda1fe45f4b6fddbb2507d7be659a6a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 22:28:30 -0800 Subject: [PATCH 07/24] Effects: a cached effect raster follows whether placed documents draw from background bitmaps Placed documents draw exactly instead of from a background bitmap in Overprint Preview, under a proof, in Outline and in other inks. A raster's inputs now hold that choice, from the same check that draws placed documents (placed_document::progressive_bitmaps), so turning Overprint Preview on before a bitmap is ready no longer leaves its placeholder in a raster kept across pans. The count of bitmaps made is still hashed whenever background bitmaps are on, since art drawn in another ink, such as an opacity mask, can still use them. --- crates/render/src/fx/pixels.rs | 27 +++++++++------- crates/render/src/placed_document.rs | 8 +++-- crates/render/src/tests/placed_document.rs | 36 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 41dfc7e0cb..972d3e4f04 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -599,16 +599,17 @@ impl Renderer { /// a Rasterize or De-Interlace anywhere in the content follows), the knockout `n` inherits and, /// while `n` holds the isolated group, isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the - /// layer's Dim Images, the options they are drawn with, and (with - /// [`crate::RenderOptions::kept_images_only`]) which pixels and undecodable notes the image - /// store holds; for content that holds placed documents, shows symbol art or uses brushed - /// strokes, the global bitmap generation ([`crate::placed_document::generation`]) while - /// progressive previews are on (pattern tiles draw with them off); for type the fonts and the + /// layer's Dim Images and the options they are drawn with (with + /// [`crate::RenderOptions::kept_images_only`], also which pixels and undecodable notes the + /// image store holds); for content that holds placed documents, shows symbol art or uses + /// brushed strokes, whether placed documents draw from background bitmaps + /// ([`crate::placed_document::progressive_bitmaps`]) and, when progressive previews are on, + /// how many bitmaps are ready ([`crate::placed_document::generation`]); for type the fonts and the /// hyphenation exceptions, whether overprinting shows ([`crate::proof::overprints`]) and - /// Document Setup's substitution highlights; and the plug-ins installed, with the names of - /// the document's swatches and patterns and its pattern definitions (a plug-in's painted - /// pieces can name them), when an object in it has a plug-in effect, and when it shows symbol - /// or pattern art and an object in the document's symbol or pattern art has one. + /// Document Setup's substitution highlights; and the plug-ins installed, with the names of the + /// document's swatches and patterns and its pattern definitions (a plug-in's painted pieces + /// can name them), when an object in it has a plug-in effect, and when it shows symbol or + /// pattern art and an object in the document's symbol or pattern art has one. pub(crate) fn raster_inputs(&mut self, f: &Frame, n: &Node, reads: Reads) -> Inputs { let doc = self.doc_inputs(f.doc); let mut h = DefaultHasher::new(); @@ -641,8 +642,12 @@ impl Renderer { // or notes an image as undecodable. o.kept_images_only.then(|| crate::images::store().added()).hash(&mut h); } - if reads.placed_documents && o.progressive_placed { - crate::placed_document::generation().hash(&mut h); + if reads.placed_documents { + let progressive = crate::placed_document::progressive_bitmaps(f); + progressive.hash(&mut h); + if f.opts.progressive_placed { + crate::placed_document::generation().hash(&mut h); + } } if reads.brushes { self.brushes.library_key(f.doc, self.stamp).hash(&mut h); diff --git a/crates/render/src/placed_document.rs b/crates/render/src/placed_document.rs index fab8122af4..ec0d55ac48 100644 --- a/crates/render/src/placed_document.rs +++ b/crates/render/src/placed_document.rs @@ -550,6 +550,11 @@ fn mean_scale(a: Affine) -> f64 { a.determinant().abs().sqrt() } +/// Whether frame `f` allows placed documents to draw from progressive bitmaps. +pub(crate) fn progressive_bitmaps(f: &Frame) -> bool { + f.opts.progressive_placed && f.ink == Ink::Display && !f.opts.outline && f.opts.proof.is_none() && !f.opts.overprint_preview +} + impl Renderer { /// Draw placed document `p` in frame `f`: from a cached bitmap on screen, else exactly; in /// Outline mode without Document Setup → Show Images in Outline Mode, its box crossed from @@ -558,8 +563,7 @@ impl Renderer { if self.crosses_placed(f) { return self.draw_crossed_placed(ctx, f, p); } - let plain = f.ink == Ink::Display && !f.opts.outline && f.opts.proof.is_none() && !f.opts.overprint_preview; - if f.opts.progressive_placed && plain && depth() == 0 && self.draw_placed_bitmap(ctx, f, p) { + if progressive_bitmaps(f) && depth() == 0 && self.draw_placed_bitmap(ctx, f, p) { return; } let Some(blob) = f.doc.images.get(&p.key) else { return }; diff --git a/crates/render/src/tests/placed_document.rs b/crates/render/src/tests/placed_document.rs index 09916148d5..57340de555 100644 --- a/crates/render/src/tests/placed_document.rs +++ b/crates/render/src/tests/placed_document.rs @@ -614,6 +614,42 @@ fn a_ready_placed_bitmap_filters_the_whole_object_raster_again_after_a_pan() { assert!(pixels == fresh, "a ready placed bitmap filters the content again after a whole-pixel pan"); } +/// A group with a whole-object effect that holds a placed document's placeholder filters its +/// content again when Overprint Preview turns on and the view pans by whole pixels before the +/// bitmap is ready. +#[test] +fn overprint_preview_filters_the_whole_object_raster_again_after_a_pan() { + let _serial = serial(); + vectorcraft_doc::placed_document::set_loader(gated_blue_page); + let mut d = Document::new(100.0, 100.0); + let key = "whole-object-overprint-preview-1"; + d.images.insert(key.into(), ImageBlob::new("application/json", b"blue whole-object overprint preview".to_vec())); + let white = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(100.0, 100.0, 300.0, 250.0)), + Appearance::basic(Paint::solid(Color::WHITE), Paint::None, 0.0), + ); + let placed = placed_node(d.alloc_id().0, key, 40.0, 20.0, Affine::translate((280.0, 170.0)) * Affine::scale(0.5)); + let mut group = Node::group(d.alloc_id(), vec![Arc::new(white), Arc::new(placed)]); + group.appearance.effects = + vec![vectorcraft_doc::Effect { id: "blur.radial".into(), params: serde_json::json!({"amount": 1, "quality": "draft"}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, group).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), progressive_placed: true, ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-290.0, -175.0)); + let gate = shut_gate(); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let placeholder = Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels; + let opts = RenderOptions { overprint_preview: true, ..opts }; + let fresh = Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(fresh != placeholder, "Overprint Preview draws the placed art before its bitmap is ready"); + let pixels = r.render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(pixels == fresh, "Overprint Preview filters the content again after a whole-pixel pan"); + drop(gate); + settle(); +} + /// A group with a whole-object effect that holds only an ordinary image keeps its raster after a /// placed document's bitmap in another document is ready and the view pans by whole pixels. #[test] From 6d1850e630687a3a42d05d539cafb98d983a5edc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 23:27:33 -0800 Subject: [PATCH 08/24] Tests: leaving Edit Text during a drag advances the baseline revision Type in perspective enters Object > Perspective > Edit Text, an interaction begins, and the edit ends: the interaction's baseline text is projected again and its revision advances to the document's, so a field shown during the drag drops a value typed before the change. --- .../engine/src/tests/interaction_commands.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/engine/src/tests/interaction_commands.rs b/crates/engine/src/tests/interaction_commands.rs index 20ab3876ee..4eefe43bc3 100644 --- a/crates/engine/src/tests/interaction_commands.rs +++ b/crates/engine/src/tests/interaction_commands.rs @@ -878,3 +878,26 @@ fn a_grid_change_during_an_interaction_advances_its_baseline_revision() { assert!(it.revision > revision, "a direct baseline change advances its revision"); assert_eq!(crate::cmd::distortcmds::grid_of(&it.doc).visible, crate::cmd::distortcmds::grid_of(&st.doc).visible); } + +#[test] +fn leaving_perspective_type_editing_during_an_interaction_advances_its_baseline_revision() { + let (mut s, _) = crate::tests_persp_select::persp_session(); + let r = s.execute("text.create", &json!({"x": 430, "y": 400, "text": "HELLO", "size": 48})).unwrap(); + let id = NodeId(r["id"].as_u64().unwrap()); + s.execute("perspective.attach", &json!({"ids": [id.0], "plane": "right"})).unwrap(); + s.execute("perspective.editText", &json!({"id": id.0})).unwrap(); + s.begin_interaction("Edit").unwrap(); + let it = s.doc().unwrap().interaction.as_ref().unwrap(); + let revision = it.revision; + let text = it.doc.node(id).unwrap(); + assert!(text.extras().perspective.as_deref().unwrap().editing, "the baseline starts in Edit Text mode"); + assert!(text.projection().is_none(), "the baseline text is flat while editing"); + crate::cmd::distortcmds::finish_edit_text(s.doc_mut().unwrap(), id); + let st = s.doc().unwrap(); + let it = st.interaction.as_ref().unwrap(); + let text = it.doc.node(id).unwrap(); + assert!(!text.extras().perspective.as_deref().unwrap().editing, "the baseline leaves Edit Text mode"); + assert!(text.projection().is_some(), "the baseline text is projected again"); + assert!(it.revision > revision, "leaving Edit Text advances the baseline revision"); + assert_eq!(it.revision, st.revision, "the baseline revision is the document's new revision"); +} From f30d267acae4bee82dd372671b8f3d7bebeb5282 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 23:34:11 -0800 Subject: [PATCH 09/24] Effects: test that a pan by part of a pixel filters a width-capped whole-object raster again A 2000 x 1 pt bar with Torn Edges at 6400% has a whole-object raster capped at the widest raster side, so a vertical pan by part of a pixel can leave its scale, size and rounded origin unchanged. Only the whole-pixel pan check then keeps the raster from being drawn on a moved sampling grid; the new test covers it. The PixelEntry::view doc now says which lower-resolution rasters keep a view tag: those of an image kept for one placement and those a drag keeps. --- crates/render/src/fx/raster.rs | 10 ++++++---- crates/render/src/fx/tests.rs | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/crates/render/src/fx/raster.rs b/crates/render/src/fx/raster.rs index 5b9d8ca120..7cd2dc9916 100644 --- a/crates/render/src/fx/raster.rs +++ b/crates/render/src/fx/raster.rs @@ -90,10 +90,12 @@ pub(crate) struct PixelEntry { pub(super) rel: (f64, f64), pub(super) k: f64, pub(crate) image: std::sync::Arc, - /// For a raster of the content's whole reach, `None`: it draws after a pan too. For one - /// cropped to the view, the view and the rect it was made for: it draws only there, so - /// dragging other art over the object keeps it (a wide blur, or any blur zoomed in, reaches - /// past the pixel budget). + /// For a raster of the content's whole reach at full size, or at a lower resolution with its + /// pans kept in [`Self::pan`], `None`: it draws after a pan too. For one cropped to the view, + /// or another raster made at a lower resolution (of an image kept for one placement, or kept + /// by a drag), the view and the rect it was made for: it draws only there, so dragging other + /// art over the object keeps it (a wide blur, or any blur zoomed in, reaches past the pixel + /// budget). pub(super) view: Option, /// For a raster a drag's frame kept of content cropped to the view, the device pixels (against /// the anchor's view position) whose pixels the effects decided with all they look at: the diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 8a4580f327..0b1da35bd7 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2003,6 +2003,28 @@ fn pans_draw_the_lower_resolution_raster_of_the_whole_object_again() { assert!(pixels == Renderer::new().render(&d, 1280, 800, view(48.0, 40.5), &opts).pixels, "after a pan by part of a pixel"); } +/// At 6400% a 2000 × 1 pt bar with Torn Edges is 128000 px wide, so its whole-object raster is +/// capped at the widest raster side and its scale stays the same across vertical pans. A vertical +/// pan by part of a pixel that leaves the raster's rounded origin and size unchanged moves the +/// sampling grid, so it filters the content again. +#[test] +fn a_pan_by_part_of_a_pixel_filters_a_width_capped_whole_object_raster_again() { + let d = doc_with(Rect::new(100.0, 100.0, 2100.0, 101.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |y: f64| Affine::translate((640.0, y)) * Affine::scale(64.0) * Affine::translate((-1100.0, -100.5)); + for (start, pan) in [(400.1, 40.2), (400.3, 40.7)] { + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(start), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + assert_eq!(u32::from(kept.image.width()), crate::MAX_RASTER_SIDE, "the raster is as wide as a raster can be"); + let image = kept.image.clone(); + let pixels = r.render(&d, 1280, 800, view(start + pan), &opts).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "a pan of {pan} px from {start} filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(start + pan), &opts).pixels, "after a pan of {pan} px from {start}"); + } +} + /// Hiding a member of a group filters its whole-object raster again after a pan by whole pixels. #[test] fn hiding_a_member_filters_the_whole_object_raster_again_after_a_pan() { From 08face9fa34a58a7dda6cbaf179ea4147a7ed6da Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 00:17:48 -0800 Subject: [PATCH 10/24] Effects: kept effect rasters follow the render mode and trim one frame at a time A whole-object raster kept across pans holds offscreen groups and masks drawn in the frame's render mode, so the raster inputs now include RenderOptions::precise and switching it filters the content again. When the effect cache is over its budget, the trimmer goes through the frames from the least recently drawn: within each frame it first turns whole rasters into their view copies and only then evicts that frame's entries. An older shadow or raster now goes before a newer whole raster loses its whole image, and a shadow drawn in the same frame as a whole raster stays cached when the view copy alone makes room. --- crates/render/src/fx/pixels.rs | 78 +++++++++++----------- crates/render/src/fx/raster.rs | 3 +- crates/render/src/fx/tests.rs | 115 +++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 39 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 972d3e4f04..0fd0720e7e 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -449,8 +449,9 @@ impl Renderer { /// pixels of a frame through the same view ([`PixelEntry::shown`]) is drawn instead, made again /// for a frame it does not serve. A copy that alone exceeds [`FX_RASTER_BUDGET`] is not made; /// the raster draws scaled. When the cache exceeds its budget, [`Self::trim_fx_rasters`] - /// replaces whole rasters with their view copies before evicting entries. A raster that covers - /// none of `screen`'s pixels draws scaled. + /// replaces a frame's whole rasters with their view copies before it evicts that frame's + /// entries, least recently drawn frames first. + /// A raster that covers none of `screen`'s pixels draws scaled. fn draw_kept( &mut self, ctx: &mut RenderContext, @@ -593,10 +594,11 @@ impl Renderer { } /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the - /// color settings, the edge smoothing mode, the hidden objects, whether guides and template - /// layers are left out, the guide color and style, whether Layer Options show on screen, - /// whether dashed strokes draw as solid lines, the document's raster effects resolution (which - /// a Rasterize or De-Interlace anywhere in the content follows), the knockout `n` inherits and, + /// color settings, the render mode ([`crate::RenderOptions::precise`]), the edge smoothing mode, + /// the hidden objects, whether guides and template layers are left out, the guide color and + /// style, whether Layer Options show on screen, whether dashed strokes draw as solid lines, + /// the document's raster effects resolution (which a Rasterize or De-Interlace anywhere in the + /// content follows), the knockout `n` inherits and, /// while `n` holds the isolated group, isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the /// layer's Dim Images and the options they are drawn with (with @@ -613,7 +615,7 @@ impl Renderer { pub(crate) fn raster_inputs(&mut self, f: &Frame, n: &Node, reads: Reads) -> Inputs { let doc = self.doc_inputs(f.doc); let mut h = DefaultHasher::new(); - (doc.cms, std::mem::discriminant(&f.opts.anti_alias), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); + (doc.cms, f.opts.precise, std::mem::discriminant(&f.opts.anti_alias), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); // Cached effects on containers can include paths made into guides, drawn in the guide // color and style, template layers, and sublayers drawn as their Layer Options show them. let o = f.opts; @@ -717,46 +719,46 @@ impl Renderer { d } - /// Replace whole rasters that have view copies with those copies, least recently drawn first, - /// then evict the least recently drawn shadow and filtered-content entries until they fit - /// `budget` bytes ([`FX_RASTER_BUDGET`]). + /// Trim the shadow and filtered-content entries to `budget` bytes ([`FX_RASTER_BUDGET`]), one + /// frame stamp at a time from the least recently drawn: replace that stamp's whole rasters that + /// have view copies with those copies, then, while the entries still exceed the budget, evict + /// that stamp's entries, reduced ones included. pub(super) fn trim_fx_rasters(&mut self, budget: usize) { let mut total: usize = self.shadows.values().map(|e| e.bytes()).sum::() + self.pixel_fx.values().map(|e| e.bytes()).sum::(); if total <= budget { return; } - let mut copies: Vec<_> = self.pixel_fx.values_mut().filter(|e| e.pan.is_some() && e.shown.is_some()).collect(); - copies.sort_unstable_by_key(|e| e.stamp); - for e in copies { - if total <= budget { - break; - } - if let Some((view, copy, rel)) = e.shown.take() { - total -= raster_bytes(&e.image); - e.image = copy; - e.k = 1.0; - e.rel = rel; - e.view = Some(view); - e.pan = None; - } - } - if total <= budget { - return; - } - let shadows = self.shadows.iter().map(|(k, e)| (e.stamp, false, *k, e.bytes())); - let pixels = self.pixel_fx.iter().map(|(k, e)| (e.stamp, true, *k, e.bytes())); + let shadows = self.shadows.iter().map(|(k, e)| (e.stamp, false, *k)); + let pixels = self.pixel_fx.iter().map(|(k, e)| (e.stamp, true, *k)); let mut all: Vec<_> = shadows.chain(pixels).collect(); all.sort_unstable_by_key(|e| e.0); - for (_, pixel, key, bytes) in all { - if total <= budget { - break; + for group in all.chunk_by(|a, b| a.0 == b.0) { + for &(_, pixel, key) in group { + if total <= budget { + return; + } + if pixel + && let Some(e) = self.pixel_fx.get_mut(&key).filter(|e| e.pan.is_some()) + && let Some((view, copy, rel)) = e.shown.take() + { + total -= raster_bytes(&e.image); + e.image = copy; + e.k = 1.0; + e.rel = rel; + e.view = Some(view); + e.pan = None; + } } - if pixel { - self.pixel_fx.remove(&key); - } else { - self.shadows.remove(&key); + for &(_, pixel, key) in group { + if total <= budget { + return; + } + if pixel { + total -= self.pixel_fx.remove(&key).map_or(0, |e| e.bytes()); + } else { + total -= self.shadows.remove(&key).map_or(0, |e| e.bytes()); + } } - total -= bytes; } } diff --git a/crates/render/src/fx/raster.rs b/crates/render/src/fx/raster.rs index 7cd2dc9916..89cb9046eb 100644 --- a/crates/render/src/fx/raster.rs +++ b/crates/render/src/fx/raster.rs @@ -112,7 +112,8 @@ pub(crate) struct PixelEntry { /// the view and rect they were made for, and their top-left against the anchor's view position: /// a frame they serve copies them ([`Renderer::draw_kept`]). Copies that alone exceed the cache /// budget are not made. When the cache exceeds its budget, [`Renderer::trim_fx_rasters`] - /// replaces whole rasters with their view copies before evicting entries. + /// goes through the frames least recently drawn first, and replaces a frame's whole rasters + /// with their view copies before it evicts that frame's entries. pub(super) shown: Option<(ViewCrop, std::sync::Arc, (f64, f64))>, pub(super) made: Made, /// What the content read when the raster was made, with the channels the effects ran on and, diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 0b1da35bd7..1913b30b4a 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2127,6 +2127,24 @@ fn guide_style_and_layer_options_filter_the_whole_object_raster_again_after_a_pa } } +/// Switching the render mode ([`crate::RenderOptions::precise`]) filters the whole-object raster +/// again after a pan by whole pixels. +#[test] +fn render_mode_filters_the_whole_object_raster_again_after_a_pan() { + let d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { precise: false, background: Some([255, 255, 255, 255]), ..Default::default() }; + let precise = RenderOptions { precise: true, ..opts.clone() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.pan.is_some(), "a raster of the whole object at a lower resolution"); + let image = kept.image.clone(); + let pixels = r.render(&d, 1280, 800, view(40.0), &precise).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "the precise render mode filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &precise).pixels, "in the precise render mode"); +} + /// Art and Type edge smoothing share a coverage threshold, but Type snaps glyphs to the pixel /// grid: switching between them filters the whole-object raster of a group with type again after /// a pan by whole pixels. @@ -2189,6 +2207,103 @@ fn a_lower_resolution_whole_raster_keeps_its_view_copy_under_the_cache_budget() assert!(pixels == Renderer::new().render(&d, 1280, 800, view, &opts).pixels, "the copy draws the same pixels as a new renderer"); } +/// An older shadow gives way before the newest whole-object raster loses its whole image. +#[test] +fn an_older_shadow_is_evicted_before_the_newest_whole_raster_loses_its_whole_image() { + let shadow_fx = ("stylize.dropShadow", json!({"x": 4, "y": 3, "blur": 2, "opacity": 80})); + let shadow = doc_with(Rect::new(20.0, 20.0, 40.0, 40.0), Color::BLACK, vec![shadow_fx]); + let d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = Affine::translate((640.0, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&shadow, 200, 200, Affine::scale(2.0), &opts); + assert_eq!(r.shadows.len(), 1, "the first frame keeps a shadow"); + let _ = r.render(&d, 1280, 800, view, &opts); + assert_eq!(r.pixel_fx.len(), 1); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.pan.is_some() && kept.k < 1.0 && kept.shown.is_some(), "the whole raster holds its view copy"); + assert!(r.shadows.values().all(|e| e.stamp < kept.stamp), "the shadow is older than the whole raster"); + let image = kept.image.clone(); + let budget = kept.bytes(); + assert!(r.shadows.values().all(|e| e.bytes() > 0), "the shadow and the whole raster together exceed the budget"); + r.trim_fx_rasters(budget); + assert!(r.shadows.is_empty(), "the older shadow is evicted first"); + assert_eq!(r.pixel_fx.len(), 1); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.pan.is_some() && kept.view.is_none(), "the newest raster stays whole"); + assert!(Arc::ptr_eq(&kept.image, &image), "the newest raster keeps its whole image"); + assert!(kept.shown.is_some(), "the newest raster keeps its view copy"); + assert!(kept.bytes() <= budget, "the remaining entry fits the budget"); +} + +/// An older whole raster and its view copy give way before a newer whole raster is reduced. A +/// frame's start holds the previous frame's rasters, so the test marks one of two rasters older. +#[test] +fn an_older_whole_raster_is_evicted_before_a_newer_whole_raster_is_reduced() { + let mut d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::BLACK, vec![("sketch.tornEdges", json!({}))]); + let next = doc_with(Rect::new(300.0, 100.0, 500.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let mut n = (**next.layers[0].children().unwrap().first().unwrap()).clone(); + n.id = d.alloc_id(); + d.insert(Some(d.layers[0].id), 0, n).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = Affine::translate((640.0, 400.0)) * Affine::scale(64.0) * Affine::translate((-300.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view, &opts); + assert_eq!(r.pixel_fx.len(), 2, "the view shows both objects"); + assert!(r.pixel_fx.values().all(|e| e.pan.is_some() && e.shown.is_some()), "both whole rasters hold view copies"); + let older_stamp = r.stamp - 1; + if let Some(e) = r.pixel_fx.values_mut().next() { + e.stamp = older_stamp; + } + let old = r.pixel_fx.values().find(|e| e.stamp == older_stamp).unwrap(); + let kept = r.pixel_fx.values().find(|e| e.stamp > older_stamp).unwrap(); + let newest_stamp = kept.stamp; + let image = kept.image.clone(); + let copy = kept.shown.as_ref().unwrap().1.clone(); + let budget = kept.bytes(); + assert!(old.bytes() > super::entries::raster_bytes(&old.image), "reducing the older raster leaves the cache over budget"); + r.trim_fx_rasters(budget); + assert_eq!(r.pixel_fx.len(), 1, "the older entry is evicted"); + let kept = r.pixel_fx.values().next().unwrap(); + assert_eq!(kept.stamp, newest_stamp); + assert!(kept.pan.is_some() && kept.view.is_none(), "the newer raster stays whole"); + assert!(Arc::ptr_eq(&kept.image, &image), "the newer raster keeps its whole image"); + assert!(Arc::ptr_eq(&kept.shown.as_ref().unwrap().1, ©), "the newer raster keeps its view copy"); + assert!(kept.bytes() <= budget, "the remaining entry fits the budget"); +} + +/// A whole raster is reduced before a shadow drawn in the same frame is evicted. +#[test] +fn a_whole_raster_is_reduced_before_a_shadow_of_the_same_stamp_is_evicted() { + let shadow_fx = ("stylize.dropShadow", json!({"x": 0.25, "y": 0.25, "blur": 0.5, "opacity": 80})); + let shadow = doc_with(Rect::new(292.0, 174.0, 293.0, 175.0), Color::BLACK, vec![shadow_fx]); + let mut d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let mut n = (**shadow.layers[0].children().unwrap().first().unwrap()).clone(); + n.id = d.alloc_id(); + d.insert(Some(d.layers[0].id), 0, n).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = Affine::translate((640.0, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view, &opts); + assert_eq!(r.shadows.len(), 1); + assert_eq!(r.pixel_fx.len(), 1); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.pan.is_some() && kept.shown.is_some(), "the whole raster holds its view copy"); + let shadow = r.shadows.values().next().unwrap(); + assert_eq!(shadow.stamp, kept.stamp, "both effects are drawn in the same frame"); + let copy = kept.shown.as_ref().unwrap().1.clone(); + let budget = shadow.bytes() + kept.bytes() - super::entries::raster_bytes(&kept.image); + assert!(shadow.bytes() > 0, "the shadow occupies cache space"); + r.trim_fx_rasters(budget); + assert_eq!(r.shadows.len(), 1, "the shadow stays cached"); + assert_eq!(r.pixel_fx.len(), 1, "the reduced raster stays cached"); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.view.is_some() && kept.pan.is_none() && kept.shown.is_none(), "the entry holds only its view copy"); + assert_eq!(kept.k, 1.0); + assert!(Arc::ptr_eq(&kept.image, ©), "the copy replaces the whole raster"); + assert!(kept.bytes() + r.shadows.values().map(|e| e.bytes()).sum::() <= budget, "both entries fit the budget"); +} + #[test] fn a_drag_glow_fallback_cannot_be_spliced_into_a_still_frame() { let doc = doc_with( From f1ca37ae68cd0016b91e731fa049d6e776635605 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 00:39:50 -0800 Subject: [PATCH 11/24] Dependencies: move the craft-libs pin to the edit-target branch on 4c330f6bd1 The branch's two commits on the craft-libs commit main pins: the stroke editor and linked fields take an edit target, and the linked fields' Equal link history starts again when the target changes. The skrifa patch stays at 37d0532f42. --- Cargo.lock | 182 ++++++++++++++++---------------- Cargo.toml | 82 +++++++------- apps/vectorcraft-web/Cargo.toml | 2 +- xtask/src/pdf_deps.rs | 2 +- 4 files changed, 134 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48b15a71b0..2e9cf8544c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1256,7 +1256,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-automation", "craft-behavior", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "crc32fast", "flate2", @@ -1319,7 +1319,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "rustix 1.1.6", ] @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1383,7 +1383,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-docpath", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "crc32fast", "flate2", @@ -1410,7 +1410,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "egui", ] @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "md-5", "rayon", @@ -1427,12 +1427,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-cms", @@ -1452,7 +1452,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1468,7 +1468,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1478,7 +1478,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "rayon", ] @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1512,7 +1512,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "blake3", "craft-ecproj-format", @@ -1528,7 +1528,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", ] @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-dwg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "acadrust", "craft-dxf", @@ -1565,7 +1565,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-codepage", "encoding_rs", @@ -1577,7 +1577,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", "serde_json", @@ -1587,12 +1587,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-atomic", "dirs", @@ -1602,7 +1602,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1617,7 +1617,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1636,7 +1636,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1645,7 +1645,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "cap-primitives", "craft-atomic", @@ -1668,12 +1668,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "gif", ] @@ -1681,7 +1681,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", ] @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1702,7 +1702,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-dds", "craft-jpeg", @@ -1759,7 +1759,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1777,7 +1777,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "thiserror 2.0.21", ] @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1796,7 +1796,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-host", "craft-i18n", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-i18n", @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -1843,7 +1843,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1855,7 +1855,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "encoding_rs", "image", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "chrono", "craft-codepage", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "uds_windows", "winsafe", @@ -1885,7 +1885,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-keymap", @@ -1901,7 +1901,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1910,7 +1910,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", "serde", @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "async-channel", "async-io", @@ -1966,7 +1966,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1975,7 +1975,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -1999,7 +1999,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2010,7 +2010,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-eps", "flate2", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "encoding_rs", "flate2", @@ -2035,7 +2035,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "dispatch2", "egui", @@ -2048,7 +2048,7 @@ dependencies = [ [[package]] name = "craft-raster3d" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "rayon", "thiserror 2.0.21", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-atomic", "craft-host", @@ -2093,7 +2093,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "fax", "hayro-ccitt", @@ -2104,7 +2104,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2125,7 +2125,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-keymap", @@ -2137,7 +2137,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2162,7 +2162,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "thiserror 2.0.21", ] @@ -2170,7 +2170,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2185,7 +2185,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-atomic", "craft-behavior", @@ -2200,7 +2200,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", "thiserror 2.0.21", @@ -2210,7 +2210,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", "thiserror 2.0.21", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-keymap", @@ -2234,12 +2234,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2253,7 +2253,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "accesskit", "craft-behavior", @@ -2308,7 +2308,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2319,7 +2319,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2337,7 +2337,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2358,7 +2358,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2379,7 +2379,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2398,7 +2398,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.22.1", "chrono", @@ -2430,7 +2430,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", "serde", @@ -2441,7 +2441,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2451,7 +2451,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "js-sys", "serde_json", @@ -2462,7 +2462,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "winsafe", ] @@ -2470,7 +2470,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-appkit", "craft-atomic", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3862,7 +3862,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3871,7 +3871,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3889,7 +3889,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3907,12 +3907,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", "hayro-ccitt", @@ -4895,7 +4895,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.22.1", "bumpalo", @@ -5052,7 +5052,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index e092abae33..02aa062b65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,57 +10,57 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified). -craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # The metallic-roughness BRDF and environment light the 3D effects' Roughness and Metallic shade with. -craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps. -craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -200,13 +200,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa). # It stays at this rev until craft-libs#5222 merges. skrifa = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 4162ab4a03..26168a76c8 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index b1cbae54ee..e7d414901e 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6"; +const REV: &str = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 19808d2b03a3adc00c9fab15488ae39a6b4d8cc4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 00:40:53 -0800 Subject: [PATCH 12/24] Effects: kept effect rasters follow Show Images in Outline Mode A layer with effects can hold a sublayer with Preview off, whose images draw as frames or as grayscale pixels depending on Show Images in Outline Mode. The raster inputs of content that reads images now include that setting, so toggling it filters a whole-object raster kept across pans again. --- crates/render/src/fx/pixels.rs | 9 ++++--- crates/render/src/fx/tests.rs | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 0fd0720e7e..4789dc83b5 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -598,10 +598,10 @@ impl Renderer { /// the hidden objects, whether guides and template layers are left out, the guide color and /// style, whether Layer Options show on screen, whether dashed strokes draw as solid lines, /// the document's raster effects resolution (which a Rasterize or De-Interlace anywhere in the - /// content follows), the knockout `n` inherits and, - /// while `n` holds the isolated group, isolation mode; the pattern definitions, symbols and - /// brush library it reads; for images and placed documents their pixels and files, the - /// layer's Dim Images and the options they are drawn with (with + /// content follows), the knockout `n` inherits and, while `n` holds the isolated group, + /// isolation mode; the pattern definitions, symbols and brush library it reads; for images and + /// placed documents their pixels and files, the layer's Dim Images, whether images show in + /// Outline mode ([`Self::shows_outline_images`]) and the options they are drawn with (with /// [`crate::RenderOptions::kept_images_only`], also which pixels and undecodable notes the /// image store holds); for content that holds placed documents, shows symbol art or uses /// brushed strokes, whether placed documents draw from background bitmaps @@ -638,6 +638,7 @@ impl Renderer { if reads.images { let o = f.opts; (doc.images, self.dim_images.map(f32::to_bits), o.smooth_images, o.image_mips, o.trace_views, o.progressive_placed).hash(&mut h); + self.shows_outline_images(f).hash(&mut h); o.trace_source.as_deref().hash(&mut h); o.mark_undecoded_images.hash(&mut h); // With only kept pixels drawn, a raster is made again once the store holds more pixels diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 1913b30b4a..b3e1eaa546 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2082,6 +2082,55 @@ fn hiding_templates_filters_the_whole_object_raster_again_after_a_pan() { } } +/// Show Images in Outline Mode filters the whole-object raster of a layer with Torn Edges and +/// an embedded image in a sublayer with Preview off again after a pan by whole pixels. +#[test] +fn outline_images_filters_the_whole_object_raster_again_after_a_pan() { + use vectorcraft_doc::{ImageBlob, ImageObject, NodeKind}; + + let mut d = Document::new(100.0, 100.0); + let l = d.layers[0].id; + let white = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(100.0, 100.0, 300.0, 250.0)), + Appearance::basic(Paint::solid(Color::WHITE), Paint::None, 0.0), + ); + let rgba = [255, 0, 0, 255].repeat(200 * 150); + let png = crate::encode::png::encode(&rgba, 200, 150, &Default::default()).unwrap(); + d.images.insert("red".into(), ImageBlob::new("image/png", png)); + let im = ImageObject { + key: "red".into(), + width: 200, + height: 150, + xf: Affine::translate((100.0, 100.0)), + link: None, + placement: Default::default(), + pixels: None, + }; + let image = Arc::new(Node::new(d.alloc_id(), NodeKind::Image(Box::new(im)))); + let mut outlined = Node::layer(d.alloc_id(), "Outlined", vectorcraft_doc::LayerColor::Preset(0)); + if let NodeKind::Layer { preview, children, .. } = &mut outlined.kind { + *preview = false; + children.push(image); + } + d.insert(Some(l), 0, white).unwrap(); + d.insert(Some(l), 1, outlined).unwrap(); + d.node_mut(l).unwrap().appearance.effects = vec![Effect { id: "sketch.tornEdges".into(), params: json!({}), visible: true }]; + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.pan.is_some(), "a raster of the whole object at a lower resolution"); + let image = kept.image.clone(); + let unchanged = Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels; + d.setup.outline_images = true; + let pixels = r.render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "Show Images in Outline Mode filters the content again"); + assert!(pixels != unchanged, "Show Images in Outline Mode changes the image through the effect"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "Show Images in Outline Mode draws as a new renderer does"); +} + /// A new guide color or style, or turning the Layer Options' screen look on or off, filters the /// whole-object raster of a layer with effects that holds a guide and a sublayer with Preview /// off again after a pan by whole pixels. From 383a5aa87f118b9079916f8ee07e50cd80e73df3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:04:37 -0800 Subject: [PATCH 13/24] Effects: a whole-object raster draws again only after a pan by whole pixels within rounding A raster of the whole object kept at a lower resolution now draws after a pan only when the pan is whole to within floating-point rounding (a tolerance scaled to the translation, between 1e-9 and 1e-6 px per axis, and never looser than the 1e-6 px check rasters cropped to the view use). A width-capped raster panned vertically by 40.0000001 or 39.9999999 px keeps its scale, size and rounded origin, so the looser check drew it on a shifted sampling grid; it is now filtered again, and a pan of exactly 40 px still draws the kept raster. --- crates/render/src/fx/pixels.rs | 6 +++--- crates/render/src/fx/raster.rs | 14 +++++++++++++- crates/render/src/fx/tests.rs | 27 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 4789dc83b5..9a04d4d62b 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -4,7 +4,7 @@ use super::entries::{Content, DocInputs, Drawn, FX_RASTER_BUDGET, Inputs, ItemGe use super::raster::RASTERIZED; use super::raster::{ DRAG_PIXEL_BUDGET, PIXEL_BUDGET, PixelEntry, ViewCrop, content_changing, doc_raster_ppi, drag_scale, draw_placed, draw_scaled, filter_region, - filter_region_within, hard_edged, image_size, linear_key, looks_around, pan_margin, panned_whole, + filter_region_within, hard_edged, image_size, linear_key, looks_around, pan_margin, panned_exactly_whole, }; use super::{ Affine, AppearanceItem, Arc, BezPath, Channels, DefaultHasher, Document, FillRule, Frame, GeomContext, Hash, Hasher, Ink, Node, PixelFx, @@ -206,9 +206,9 @@ impl Renderer { None => e.pan.map_or(whole, |(pan, output_pan, output_linear)| { let p = f.view * e.anchor; entire - && panned_whole(pan, f.view) + && panned_exactly_whole(pan, f.view) && output_linear == linear_key(f.output) - && panned_whole(output_pan, f.output) + && panned_exactly_whole(output_pan, f.output) && e.k.to_bits() == k.to_bits() && f64::from(e.image.width()) == w && f64::from(e.image.height()) == h diff --git a/crates/render/src/fx/raster.rs b/crates/render/src/fx/raster.rs index 89cb9046eb..1f036c734e 100644 --- a/crates/render/src/fx/raster.rs +++ b/crates/render/src/fx/raster.rs @@ -104,7 +104,7 @@ pub(crate) struct PixelEntry { pub(super) valid: Option, /// For a raster of the content's whole reach made at a lower resolution than the view's, the /// pans of the view and output it was made through, and the output's linear coefficients: it - /// draws when both grids pan by whole pixels ([`panned_whole`]), the output's linear + /// draws when both grids pan by whole pixels ([`panned_exactly_whole`]), the output's linear /// coefficients stay the same, its rounded origin matches a fresh render's floored origin, /// and its scale and size match a fresh render's. `None` for other rasters. pub(super) pan: Option<(Vec2, Vec2, [u64; 4])>, @@ -146,6 +146,18 @@ pub(super) fn panned_whole(pan: Vec2, view: Affine) -> bool { (d - Vec2::new(d.x.round(), d.y.round())).hypot() < 1e-6 } +/// Is `view` panned by whole device pixels from `pan`, allowing floating-point rounding +/// with a tolerance between 1e-9 and 1e-6 device pixels per axis and a combined error +/// below 1e-6 device pixels, as required by [`panned_whole`]? +pub(super) fn panned_exactly_whole(pan: Vec2, view: Affine) -> bool { + let at = view.translation(); + let whole = |a: f64, b: f64| { + let d = b - a; + (d - d.round()).abs() <= (f64::EPSILON * 64.0 * (a.abs() + b.abs())).clamp(1e-9, 1e-6) + }; + panned_whole(pan, view) && whole(pan.x, at.x) && whole(pan.y, at.y) +} + /// The four linear coefficients of `view` (zoom and rotation, not the pan), as cache keys. pub(crate) fn linear_key(view: Affine) -> [u64; 4] { let c = view.as_coeffs(); diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index b3e1eaa546..8c1e327215 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2025,6 +2025,33 @@ fn a_pan_by_part_of_a_pixel_filters_a_width_capped_whole_object_raster_again() { } } +/// A width-capped whole-object raster draws after a whole-pixel pan, but filters again when the +/// pan differs from whole pixels by more than floating-point rounding. +#[test] +fn a_pan_near_a_whole_pixel_filters_a_width_capped_whole_object_raster_again() { + let d = doc_with(Rect::new(100.0, 100.0, 2100.0, 101.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |y: f64| Affine::translate((640.0, y)) * Affine::scale(64.0) * Affine::translate((-1100.0, -100.5)); + let drawn = |r: &Renderer, image: &Arc| r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, image)); + for start in [400.1, 400.3] { + for pan in [40.0000001, 39.9999999, 40.0] { + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(start), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + assert_eq!(u32::from(kept.image.width()), crate::MAX_RASTER_SIDE, "the raster is as wide as a raster can be"); + let image = kept.image.clone(); + let pixels = r.render(&d, 1280, 800, view(start + pan), &opts).pixels; + if pan == 40.0 { + assert!(drawn(&r, &image), "a whole-pixel pan of the width-capped raster draws the kept raster"); + } else { + assert!(!drawn(&r, &image), "a pan within 1e-6 px of whole but off the grid filters the content again"); + } + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(start + pan), &opts).pixels, "after a pan of {pan} px from {start}"); + } + } +} + /// Hiding a member of a group filters its whole-object raster again after a pan by whole pixels. #[test] fn hiding_a_member_filters_the_whole_object_raster_again_after_a_pan() { From b843077e9e4d41797d5585ac530505abb6a9dfac Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:29:48 -0800 Subject: [PATCH 14/24] Effects: kept effect rasters follow image smoothing in brush art and symbol editing Brush art can hold images, so content with brushed strokes now counts as reading images and its effect raster is filtered again when image options such as bitmap smoothing change. While symbol editing hides the instance it started from, the effect raster of a group holding that instance is filtered again instead of showing the instance under the editing copy after a pan. --- crates/render/src/fx/entries.rs | 5 +- crates/render/src/fx/pixels.rs | 6 +- crates/render/src/fx/tests.rs | 110 ++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 4 deletions(-) diff --git a/crates/render/src/fx/entries.rs b/crates/render/src/fx/entries.rs index 1f9e930cc4..32df616e25 100644 --- a/crates/render/src/fx/entries.rs +++ b/crates/render/src/fx/entries.rs @@ -224,8 +224,8 @@ pub(crate) struct Reads { /// Symbol instances and type with inline graphics: the symbols' art. Symbol art can hold /// anything, so content that shows a symbol reads everything else too. pub(super) symbols: bool, - /// Images and placed documents: their pixels and files, and the options and the layer's Dim - /// Images they are drawn with. + /// Images, placed documents and brush art: their pixels and files, and the options and the + /// layer's Dim Images they are drawn with. pub(super) images: bool, /// Placed documents, symbol art and brushed strokes: the global bitmap generation while /// progressive previews are on. Symbol and brush art can hold placed documents. Pattern tiles @@ -255,6 +255,7 @@ impl Reads { let mut reads = Self::default(); nodes.for_each(|n| reads.add(n)); reads.placed_documents |= reads.symbols || reads.brushes; + reads.images |= reads.brushes; if reads.symbols || reads.patterns { return Self { patterns: true, diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 9a04d4d62b..42b52a5e55 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -595,8 +595,9 @@ impl Renderer { /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the /// color settings, the render mode ([`crate::RenderOptions::precise`]), the edge smoothing mode, - /// the hidden objects, whether guides and template layers are left out, the guide color and - /// style, whether Layer Options show on screen, whether dashed strokes draw as solid lines, + /// the hidden objects and the instance left out during symbol editing, whether guides and + /// template layers are left out, the guide color and style, whether Layer Options show on + /// screen, whether dashed strokes draw as solid lines, /// the document's raster effects resolution (which a Rasterize or De-Interlace anywhere in the /// content follows), the knockout `n` inherits and, while `n` holds the isolated group, /// isolation mode; the pattern definitions, symbols and brush library it reads; for images and @@ -623,6 +624,7 @@ impl Renderer { // Cached effects can include dashed strokes drawn as solid lines. f.opts.solid_dashes.hash(&mut h); f.hidden_inputs.hash(&mut h); + f.opts.isolated.and_then(|_| f.doc.symbol_edit.as_ref()?.instance).hash(&mut h); if let Some((isolated, path)) = self.isolation_path(f) && n.id != isolated && path.contains(&n.id) diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 8c1e327215..3c866b6aaf 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -62,6 +62,22 @@ fn reads_follow_progressive_placed_documents_in_content_and_art() { assert!(!Reads::of(&patterned).placed_documents, "a pattern-only path does not read progressive bitmap readiness"); } +/// Brush and symbol art can hold images drawn with the frame's image options. +#[test] +fn reads_follow_images_in_brush_and_symbol_art() { + use super::Reads; + use vectorcraft_doc::NodeKind; + + let mut d = Document::new(100.0, 100.0); + let mut appearance = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 1.0); + appearance.stroke_mut().unwrap().brush = Some("Stamp".into()); + let brushed = Node::path(d.alloc_id(), shapes::line((0.0, 0.0).into(), (20.0, 20.0).into()), appearance); + assert!(Reads::of(&brushed).images, "a brushed stroke reads images"); + + let symbol = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Stamp".into(), xf: Affine::IDENTITY }); + assert!(Reads::of(&symbol).images, "a symbol instance reads images"); +} + /// Rasterize and culling include the complete rendered image under lights from opposite sides. #[test] fn rendered_three_d_painted_bounds_hold_both_shadows() { @@ -2075,6 +2091,100 @@ fn hiding_a_member_filters_the_whole_object_raster_again_after_a_pan() { assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "hiding a member filters the content again"); } +/// Image smoothing changes the pixels of an effected stroke whose scatter brush holds an image. +#[test] +fn image_smoothing_filters_a_brushed_strokes_raster_again_after_a_pan() { + use vectorcraft_brush::{Brush, BrushKind, Colorization, Scatter}; + use vectorcraft_doc::{ImageBlob, ImageObject, NodeKind}; + + let mut d = Document::new(160.0, 100.0); + let rgba = [0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255]; + let png = crate::encode::png::encode(&rgba, 2, 2, &Default::default()).unwrap(); + d.images.insert("checks".into(), ImageBlob::new("image/png", png)); + let art = Node::new( + d.alloc_id(), + NodeKind::Image(Box::new(ImageObject { + key: "checks".into(), + width: 2, + height: 2, + xf: Affine::IDENTITY, + link: None, + placement: Default::default(), + pixels: None, + })), + ); + vectorcraft_brush::store( + &mut d, + &[Brush { name: "Checks".into(), kind: BrushKind::Scatter(Scatter { art, colorization: Colorization::None, ..Default::default() }) }], + ); + let mut appearance = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 20.0); + appearance.stroke_mut().unwrap().brush = Some("Checks".into()); + let mut n = Node::path(d.alloc_id(), shapes::line((20.0, 50.0).into(), (100.0, 50.0).into()), appearance); + n.appearance.effects = vec![Effect { id: "blur.gaussian".into(), params: json!({"radius": 1}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, n).unwrap(); + let mut opts = RenderOptions { background: Some([255, 255, 255, 255]), smooth_images: false, image_mips: false, ..Default::default() }; + let mut r = Renderer::new(); + let _ = r.render(&d, 160, 100, Affine::IDENTITY, &opts); + let image = r.pixel_fx.values().next().unwrap().image.clone(); + let view = Affine::translate((4.0, 0.0)); + let unchanged = Renderer::new().render(&d, 160, 100, view, &opts).pixels; + opts.smooth_images = true; + let pixels = r.render(&d, 160, 100, view, &opts).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "image smoothing filters the content again"); + assert!(pixels != unchanged, "image smoothing changes the brush art through the effect"); + assert!(pixels == Renderer::new().render(&d, 160, 100, view, &opts).pixels, "image smoothing draws as a new renderer does"); +} + +/// Symbol editing leaves out the original instance inside a group's whole-object raster. +#[test] +fn symbol_editing_filters_the_whole_object_raster_again_after_a_pan() { + use vectorcraft_doc::{NodeKind, Symbol, SymbolEdit}; + + let mut d = Document::new(100.0, 100.0); + let white = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(100.0, 100.0, 300.0, 250.0)), + Appearance::basic(Paint::solid(Color::WHITE), Paint::None, 0.0), + ); + let art = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(200.0, 100.0, 300.0, 250.0)), + Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0), + ); + d.symbols.push(Symbol { dynamic: false, name: "Stamp".into(), art: Arc::new(art.clone()) }); + let instance = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Stamp".into(), xf: Affine::IDENTITY }); + let id = instance.id; + let mut g = Node::group(d.alloc_id(), vec![Arc::new(white), Arc::new(instance)]); + g.appearance.effects = vec![Effect { id: "sketch.tornEdges".into(), params: json!({}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, g).unwrap(); + let mut opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |dx: f64| Affine::translate((640.0 + dx, 400.0)) * Affine::scale(64.0) * Affine::translate((-295.0, -175.0)); + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + let image = kept.image.clone(); + let layer = d.add_layer(Some("Stamp")); + let copy = d.reid(&art); + d.insert(Some(layer), 0, copy).unwrap(); + d.symbol_edit = Some(SymbolEdit { + symbol: "Stamp".into(), + layer, + instance: Some(id), + xf: Affine::IDENTITY, + group: false, + changed: false, + back_isolation: None, + back_layer: None, + }); + opts.isolated = Some(layer); + let pixels = r.render(&d, 1280, 800, view(40.0), &opts).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "symbol editing filters the content again"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "symbol editing draws as a new renderer does"); +} + /// Hiding or skipping template layers filters the whole-object raster of a layer with effects /// that holds a template sublayer again after a pan by whole pixels. #[test] From 9e49dbdd288cec5707b06ffb587dadc88ae3e895 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:49:34 -0800 Subject: [PATCH 15/24] Effects: kept effect rasters of brushed strokes follow symbols and patterns in brush art Brush art can stamp symbols and use patterns, so content with brushed strokes now reads every document resource, as content showing symbol or pattern art already does. Editing a symbol that a scatter brush stamps filters the stroke's effect raster again instead of drawing the old pixels after a pan. --- crates/render/src/fx/entries.rs | 18 ++++++------- crates/render/src/fx/tests.rs | 47 ++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/crates/render/src/fx/entries.rs b/crates/render/src/fx/entries.rs index 32df616e25..9714d5f8a8 100644 --- a/crates/render/src/fx/entries.rs +++ b/crates/render/src/fx/entries.rs @@ -221,17 +221,18 @@ pub(crate) struct Reads { /// Pattern paints: the pattern definitions. Their art can hold anything, so content painted /// with a pattern reads everything else too. pub(super) patterns: bool, - /// Symbol instances and type with inline graphics: the symbols' art. Symbol art can hold - /// anything, so content that shows a symbol reads everything else too. + /// Symbol instances, type with inline graphics, pattern art and brush art: the symbols' art. + /// Symbol art can hold anything, so content that shows a symbol reads everything else too. pub(super) symbols: bool, - /// Images, placed documents and brush art: their pixels and files, and the options and the - /// layer's Dim Images they are drawn with. + /// Images, placed documents, symbol art, pattern art and brush art: their pixels and files, + /// and the options and the layer's Dim Images they are drawn with. pub(super) images: bool, /// Placed documents, symbol art and brushed strokes: the global bitmap generation while /// progressive previews are on. Symbol and brush art can hold placed documents. Pattern tiles /// draw with progressive previews off. pub(super) placed_documents: bool, - /// Brushed strokes: the brush library. + /// Brushed strokes, symbol art and pattern art: the brush library. Brush art can hold + /// anything, so content that uses a brushed stroke reads everything else too. pub(super) brushes: bool, /// Type: the fonts, whether overprinting shows ([`crate::proof::overprints`]) and the /// substitution highlights. @@ -247,16 +248,15 @@ impl Reads { Self::of_all(std::iter::once(n)) } - /// What the content of `nodes` reads together. Pattern and symbol art can hold anything, so - /// content showing either reads the other document resources too (#1723). Progressive bitmap + /// What the content of `nodes` reads together. Pattern, symbol and brush art can hold anything, + /// so content showing any of them reads the other document resources too (#1723). Progressive bitmap /// readiness follows content that holds placed documents, shows symbol art or uses brushed /// strokes. Pattern tiles draw with progressive previews off. pub(crate) fn of_all<'a>(nodes: impl Iterator) -> Self { let mut reads = Self::default(); nodes.for_each(|n| reads.add(n)); reads.placed_documents |= reads.symbols || reads.brushes; - reads.images |= reads.brushes; - if reads.symbols || reads.patterns { + if reads.symbols || reads.patterns || reads.brushes { return Self { patterns: true, symbols: true, diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 3c866b6aaf..a0e1f9e61a 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -62,7 +62,8 @@ fn reads_follow_progressive_placed_documents_in_content_and_art() { assert!(!Reads::of(&patterned).placed_documents, "a pattern-only path does not read progressive bitmap readiness"); } -/// Brush and symbol art can hold images drawn with the frame's image options. +/// Brush and symbol art can hold images drawn with the frame's image options, and brush art can +/// show symbols. #[test] fn reads_follow_images_in_brush_and_symbol_art() { use super::Reads; @@ -73,6 +74,7 @@ fn reads_follow_images_in_brush_and_symbol_art() { appearance.stroke_mut().unwrap().brush = Some("Stamp".into()); let brushed = Node::path(d.alloc_id(), shapes::line((0.0, 0.0).into(), (20.0, 20.0).into()), appearance); assert!(Reads::of(&brushed).images, "a brushed stroke reads images"); + assert!(Reads::of(&brushed).symbols, "a brushed stroke reads symbol art"); let symbol = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Stamp".into(), xf: Affine::IDENTITY }); assert!(Reads::of(&symbol).images, "a symbol instance reads images"); @@ -2136,6 +2138,49 @@ fn image_smoothing_filters_a_brushed_strokes_raster_again_after_a_pan() { assert!(pixels == Renderer::new().render(&d, 160, 100, view, &opts).pixels, "image smoothing draws as a new renderer does"); } +/// A symbol's fill color changes the pixels of an effected stroke whose scatter brush shows it. +#[test] +fn editing_a_symbol_in_brush_art_filters_a_brushed_strokes_raster_again_after_a_pan() { + use vectorcraft_brush::{Brush, BrushKind, Colorization, Scatter}; + use vectorcraft_doc::{NodeKind, Symbol}; + + let mut d = Document::new(160.0, 100.0); + let mut art = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(-4.0, -4.0, 4.0, 4.0)), + Appearance::basic(Paint::solid(Color::rgb(0.9, 0.1, 0.1)), Paint::None, 0.0), + ); + d.symbols.push(Symbol { dynamic: false, name: "Stamp".into(), art: Arc::new(art.clone()) }); + let instance = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Stamp".into(), xf: Affine::IDENTITY }); + vectorcraft_brush::store( + &mut d, + &[Brush { + name: "Stamps".into(), + kind: BrushKind::Scatter(Scatter { art: instance, colorization: Colorization::None, ..Default::default() }), + }], + ); + let mut appearance = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 2.0); + appearance.stroke_mut().unwrap().brush = Some("Stamps".into()); + let mut n = Node::path(d.alloc_id(), shapes::line((20.0, 50.0).into(), (100.0, 50.0).into()), appearance); + n.appearance.effects = vec![Effect { id: "blur.gaussian".into(), params: json!({"radius": 1}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, n).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let mut r = Renderer::new(); + let _ = r.render(&d, 160, 100, Affine::IDENTITY, &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.view.is_none(), "a raster of the whole object"); + let image = kept.image.clone(); + let view = Affine::translate((4.0, 0.0)); + let unchanged = Renderer::new().render(&d, 160, 100, view, &opts).pixels; + art.appearance = Appearance::basic(Paint::solid(Color::rgb(0.1, 0.4, 0.9)), Paint::None, 0.0).into(); + d.symbols[0].art = Arc::new(art); + let pixels = r.render(&d, 160, 100, view, &opts).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "editing a symbol in brush art filters the content again"); + assert!(pixels == Renderer::new().render(&d, 160, 100, view, &opts).pixels, "the edited symbol draws as a new renderer does"); + assert!(pixels != unchanged, "the edited symbol changes the brush art through the effect"); +} + /// Symbol editing leaves out the original instance inside a group's whole-object raster. #[test] fn symbol_editing_filters_the_whole_object_raster_again_after_a_pan() { From 545f6f97cf79b4fa6526e1e9ee3016cede5c410e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:39:15 -0800 Subject: [PATCH 16/24] Effects: kept effect rasters of brushed strokes follow plug-ins used in brush art The brush library now notes whether any brush art holds a plug-in effect. Content with brushed strokes then reads the plug-ins installed, so installing or removing a plug-in that brush art uses filters the stroke's effect raster again instead of drawing the old pixels after a pan. --- crates/render/src/brush_fx.rs | 9 +++++++ crates/render/src/fx/entries.rs | 3 ++- crates/render/src/fx/pixels.rs | 5 ++-- crates/render/src/fx/tests.rs | 43 +++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/crates/render/src/brush_fx.rs b/crates/render/src/brush_fx.rs index 1660ae6caa..96db25a357 100644 --- a/crates/render/src/brush_fx.rs +++ b/crates/render/src/brush_fx.rs @@ -61,6 +61,8 @@ pub(crate) struct BrushCache { /// (frame stamp, document address) the library was last validated for. checked: (u64, usize), lib: HashMap>, + /// Whether brush art or an opacity mask there has a visible plug-in effect. + plugins: bool, /// The names and art of the document's patterns and symbols ([`definitions`]) when the library /// was last validated, the art held weakly as the pattern tiles hold theirs. definitions: Vec<(String, Weak)>, @@ -78,6 +80,7 @@ impl Default for BrushCache { key: 0, checked: (0, 0), lib: HashMap::new(), + plugins: false, definitions: Vec::new(), entries: FrameCache::new(lru::BRUSH_BUDGET, 512), #[cfg(test)] @@ -113,6 +116,7 @@ impl BrushCache { for b in vectorcraft_brush::library(doc) { self.lib.entry(b.name.clone()).or_insert_with(|| Arc::new(b)); } + self.plugins = self.lib.values().any(|b| b.art().into_iter().any(crate::holds_plugin_effect)); } /// [`Self::key`] for the brush library `doc` holds (checked once a frame, `stamp`). @@ -121,6 +125,11 @@ impl BrushCache { self.key } + /// Whether brush art has a visible plug-in effect, valid after [`Self::library_key`] for the frame. + pub(crate) fn has_plugins(&self) -> bool { + self.plugins + } + /// [`Self::library_key`] checked now, between frames: `doc` may be the document of the last /// frame, edited in place. pub(crate) fn library_key_now(&mut self, doc: &Document, stamp: u64) -> u64 { diff --git a/crates/render/src/fx/entries.rs b/crates/render/src/fx/entries.rs index 9714d5f8a8..d28412ab8c 100644 --- a/crates/render/src/fx/entries.rs +++ b/crates/render/src/fx/entries.rs @@ -238,7 +238,8 @@ pub(crate) struct Reads { /// substitution highlights. pub(super) text: bool, /// Plug-in effects on its objects: the plug-ins installed. Those in the symbol and pattern art - /// it shows are found with the document's inputs ([`DocInputs`]). + /// it shows are found with the document's inputs ([`DocInputs`]). Those in brush art are found + /// with the brush library ([`crate::brush_fx::BrushCache`]). pub(super) plugins: bool, } diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 42b52a5e55..19458a2c54 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -611,7 +611,8 @@ impl Renderer { /// hyphenation exceptions, whether overprinting shows ([`crate::proof::overprints`]) and /// Document Setup's substitution highlights; and the plug-ins installed, with the names of the /// document's swatches and patterns and its pattern definitions (a plug-in's painted pieces - /// can name them), when an object in it has a plug-in effect, and when it shows symbol or + /// can name them), when an object in the content has a plug-in effect, when it uses brushed + /// strokes and an object in the document's brush art has one, and when it shows symbol or /// pattern art and an object in the document's symbol or pattern art has one. pub(crate) fn raster_inputs(&mut self, f: &Frame, n: &Node, reads: Reads) -> Inputs { let doc = self.doc_inputs(f.doc); @@ -667,7 +668,7 @@ impl Renderer { // Color bitmap glyphs are sampled as images are (`draw_glyph_image`). (vectorcraft_text::layout_inputs(), crate::proof::overprints(f.opts), highlights, o.smooth_images).hash(&mut h); } - if reads.plugins || (doc.plugins && (reads.symbols || reads.patterns)) { + if reads.plugins || (reads.brushes && self.brushes.has_plugins()) || (doc.plugins && (reads.symbols || reads.patterns)) { (effects::plugin_revision(), doc.names, doc.patterns).hash(&mut h); } Inputs { reads, key: h.finish(), _doc: doc } diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index a0e1f9e61a..bf026092db 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2181,6 +2181,49 @@ fn editing_a_symbol_in_brush_art_filters_a_brushed_strokes_raster_again_after_a_ assert!(pixels != unchanged, "the edited symbol changes the brush art through the effect"); } +/// Removing a plug-in used only in brush art filters a stroke again after a whole-pixel pan. +#[test] +fn removing_a_plugin_in_brush_art_filters_a_brushed_strokes_raster_again_after_a_pan() { + use vectorcraft_brush::{Brush, BrushKind, Colorization, Scatter}; + use vectorcraft_geom::{PathData, SubPath}; + use vectorcraft_plugins::wat as tpl; + + let _fonts = fonts_steady(); + const ID: &str = "test.render.fx.brush-art"; + let triangle = PathData::single(SubPath::polyline(&[Point::new(-4.0, -4.0), Point::new(4.0, -4.0), Point::new(0.0, 4.0)], true)); + let output = json!({"objects": [{"path": triangle}]}).to_string(); + let module = wat::parse_str(tpl::returning(&tpl::manifest(ID, "effect", "{}"), &output)).unwrap(); + vectorcraft_plugins::registry::install_bytes(&module).unwrap(); + + let mut d = Document::new(160.0, 100.0); + let mut r = Renderer::new(); + let mut art = + Node::path(d.alloc_id(), shapes::rectangle(Rect::new(-4.0, -4.0, 4.0, 4.0)), Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0)); + art.appearance.effects = vec![Effect { id: format!("plugin.{ID}"), params: json!({}), visible: true }]; + vectorcraft_brush::store( + &mut d, + &[Brush { name: "Stamps".into(), kind: BrushKind::Scatter(Scatter { art, colorization: Colorization::None, ..Default::default() }) }], + ); + let mut appearance = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 2.0); + appearance.stroke_mut().unwrap().brush = Some("Stamps".into()); + let mut n = Node::path(d.alloc_id(), shapes::line((20.0, 50.0).into(), (100.0, 50.0).into()), appearance); + n.appearance.effects = vec![Effect { id: "blur.gaussian".into(), params: json!({"radius": 1}), visible: true }]; + let l = d.layers[0].id; + d.insert(Some(l), 0, n).unwrap(); + let opts = RenderOptions { precise: true, background: Some([255, 255, 255, 255]), ..Default::default() }; + let _ = r.render(&d, 160, 100, Affine::IDENTITY, &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.view.is_none(), "a raster of the whole object"); + let image = kept.image.clone(); + let view = Affine::translate((4.0, 0.0)); + let unchanged = Renderer::new().render(&d, 160, 100, view, &opts).pixels; + assert!(vectorcraft_plugins::registry::remove(ID), "the plug-in was installed"); + let pixels = r.render(&d, 160, 100, view, &opts).pixels; + assert!(!r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "removing the brush art's plug-in filters the content again"); + assert!(pixels != unchanged, "the plug-in changes the brush art through the effect"); + assert!(pixels == Renderer::new().render(&d, 160, 100, view, &opts).pixels, "removing the plug-in draws as a new renderer does"); +} + /// Symbol editing leaves out the original instance inside a group's whole-object raster. #[test] fn symbol_editing_filters_the_whole_object_raster_again_after_a_pan() { From ada6cc4f55d08f1ac4940d7b06749c3a7560644c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:51:48 -0800 Subject: [PATCH 17/24] Tests: Global Edit weight tests check that the field takes a fresh value Both Global Edit tests now assert that the selected object takes the 5 pt typed after the member change, so a draft cleared together with the field's focus fails them. --- crates/ui-egui/src/panels/tests_stroke.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index c2747a2615..758a5031c1 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -342,6 +342,7 @@ fn changing_global_edit_members_drops_an_unfinished_weight() { assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); } + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "{change}: the field still takes a fresh weight"); } } @@ -893,6 +894,7 @@ fn changing_global_edit_members_drops_an_unfinished_appearance_weight() { assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); } + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "{change}: the field still takes a fresh weight"); } } From 276a00fe18b8974bcf16b99db64ae362493fbe3e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:06:19 -0800 Subject: [PATCH 18/24] Tests: check the stroke tests' collections before their all() assertions The gate's test-lint rejects an assert!(...all(...)) with no length or emptiness check, since an empty collection passes it. Four new stroke tests asserted every run's weight without one. Each now checks that the text keeps its characters (and runs) first; the new-art test checks that both strokes remain, and the threaded-story test that both frames hold characters. --- crates/ui-egui/src/panels/tests_stroke.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 758a5031c1..08c60f1093 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -179,6 +179,7 @@ fn adding_an_identical_new_art_stroke_drops_an_unfinished_weight() { finish_typing(&mut p); let app = p.app(); assert_eq!(app.session.new_art_stroke().width, 5.0); + assert_eq!(app.session.new_art().items.iter().filter(|item| !item.is_fill()).count(), 2, "new art keeps both strokes"); assert!(app.session.new_art().items.iter().all(|item| match item { vectorcraft_doc::AppearanceItem::Stroke(stroke) => stroke.width != 8.0, _ => true, @@ -203,6 +204,8 @@ fn changing_a_later_character_stroke_drops_an_unfinished_weight() { p.key(Key::Enter, Modifiers::NONE); let app = p.app(); let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert_eq!(t.plain_text(), "Stroke"); + assert!(!t.runs.is_empty(), "the text keeps its runs"); assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "each character takes the fresh weight"); } @@ -225,6 +228,8 @@ fn a_collapsed_type_caret_drops_an_unfinished_weight_when_other_characters_chang p.key(Key::Enter, Modifiers::NONE); let app = p.app(); let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert_eq!(t.plain_text(), "Stroke"); + assert!(!t.runs.is_empty(), "the text keeps its runs"); assert!(t.runs.iter().all(|run| run.style.stroke_width != 4.0), "the unfinished expression reaches no character"); assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "the fresh weight edits the whole frame"); } @@ -362,6 +367,7 @@ fn replacing_text_with_the_same_byte_length_drops_an_unfinished_weight() { let app = p.app(); let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; assert_eq!(t.plain_text(), "Weight"); + assert!(!t.runs.is_empty(), "the replacement text has runs"); assert!(t.runs.iter().all(|run| run.style.stroke_width == 5.0), "the replacement text takes only the fresh value"); } @@ -851,6 +857,11 @@ fn an_unfinished_weight_is_dropped_when_the_whole_story_is_selected() { let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("type") }; t.runs.iter().map(|r| r.style.stroke_width).collect::>() }; + let text_len = |id: u64| { + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("type") }; + vectorcraft_text::edit::runs_len(&t.runs) + }; + assert!(text_len(a) > 0 && text_len(b) > 0, "both frames hold characters"); assert!(widths(a).iter().chain(&widths(b)).all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {:?} {:?}", widths(a), widths(b)); } From 3493a12c0056af2919a3c5c44965e72872dbfbdb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:05:49 -0800 Subject: [PATCH 19/24] Tests: check each threaded frame's runs before its all() assertion test-lint counts a size check only on a plain local just before the all() that reads it, so the threaded-story test still failed the gate's all-unguarded rule. Each frame's widths are now a local, checked for runs, then asserted. --- crates/ui-egui/src/panels/tests_stroke.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 08c60f1093..04057e291d 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -862,7 +862,11 @@ fn an_unfinished_weight_is_dropped_when_the_whole_story_is_selected() { vectorcraft_text::edit::runs_len(&t.runs) }; assert!(text_len(a) > 0 && text_len(b) > 0, "both frames hold characters"); - assert!(widths(a).iter().chain(&widths(b)).all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {:?} {:?}", widths(a), widths(b)); + let (first, second) = (widths(a), widths(b)); + assert!(!first.is_empty(), "the first frame has runs"); + assert!(first.iter().all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {first:?}"); + assert!(!second.is_empty(), "the second frame has runs"); + assert!(second.iter().all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {second:?}"); } #[test] From 4c6f8e6f1031d340c5d35486710a540eaa15de5f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 09:26:29 -0800 Subject: [PATCH 20/24] Effects: a whole-object raster keeps its scale across whole-pixel pans of a centered view The canvas pans by moving the document point at the center of the view, and the device rect of the object's reach then shifts by whole pixels plus floating-point rounding. The size of the raster's region is now rounded to 2^-20 device pixels before its scale and dimensions are computed, so a whole-pixel pan at 9600% or 5000% gives the same scale bits as the first frame and draws the kept raster instead of filtering the object again. New tests cover pans of a centered view at both scales, and each check that a kept raster was made for this output, scale and size. --- crates/render/src/fx/pixels.rs | 4 +- crates/render/src/fx/raster.rs | 3 +- crates/render/src/fx/tests.rs | 73 ++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 19458a2c54..87bc4d09e2 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -161,7 +161,9 @@ impl Renderer { _ => full, }; let (x0, y0) = (region.x0.floor(), region.y0.floor()); - let (rw, rh) = ((region.x1 - x0).max(1.0), (region.y1 - y0).max(1.0)); + // Sizes rounded to 2^-20 device pixels keep raster dimensions and filter scales stable across whole-pixel pans. + let size = |v: f64| v.trunc() + (v.fract() * 1_048_576.0).round() / 1_048_576.0; + let (rw, rh) = (size((region.x1 - x0).max(1.0)), size((region.y1 - y0).max(1.0))); // (vello_cpu panics drawing near `u16::MAX` pixels a side.) let side = f64::from(crate::MAX_RASTER_SIDE); let k = (PIXEL_BUDGET / (rw * rh)).sqrt().min(side / rw).min(side / rh).min(1.0); diff --git a/crates/render/src/fx/raster.rs b/crates/render/src/fx/raster.rs index 1f036c734e..99723f215e 100644 --- a/crates/render/src/fx/raster.rs +++ b/crates/render/src/fx/raster.rs @@ -106,7 +106,8 @@ pub(crate) struct PixelEntry { /// pans of the view and output it was made through, and the output's linear coefficients: it /// draws when both grids pan by whole pixels ([`panned_exactly_whole`]), the output's linear /// coefficients stay the same, its rounded origin matches a fresh render's floored origin, - /// and its scale and size match a fresh render's. `None` for other rasters. + /// its scale is bit-identical to a fresh render's, and its size matches a fresh render's. + /// `None` for other rasters. pub(super) pan: Option<(Vec2, Vec2, [u64; 4])>, /// For such a raster, its pixels resampled to the device pixels of the last frame that drew it, /// the view and rect they were made for, and their top-left against the anchor's view position: diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index bf026092db..707ef3f17b 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2043,6 +2043,79 @@ fn a_pan_by_part_of_a_pixel_filters_a_width_capped_whole_object_raster_again() { } } +/// The canvas centers its view on a document point and pans by moving that point by the pan's +/// device pixels over the scale. At 9600% and 5000% each whole-pixel pan keeps the raster's scale +/// and size bit-identical to a fresh render's and draws the kept raster. +#[test] +fn pans_of_a_centered_view_draw_the_whole_object_raster_again() { + let d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |scale: f64, c: Point| Affine::translate((640.0, 400.0)) * Affine::scale(scale) * Affine::translate((-c.x, -c.y)); + for (scale, c) in [(96.0, Point::new(295.3, 175.7)), (96.0, Point::new(291.137, 171.913)), (50.0, Point::new(291.137, 171.913))] { + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(scale, c), &opts); + let kept = r.pixel_fx.values().next().unwrap(); + assert!(kept.k < 1.0 && kept.view.is_none(), "a raster of the whole object at a lower resolution"); + let image = kept.image.clone(); + let mut at = c; + for i in 1..=4 { + at.x -= 40.0 / scale; + let pixels = r.render(&d, 1280, 800, view(scale, at), &opts).pixels; + assert!(r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "pan {i} of 40 px at scale {scale} from {c:?} draws the kept raster"); + let mut fresh = Renderer::new(); + assert!(pixels == fresh.render(&d, 1280, 800, view(scale, at), &opts).pixels, "pan {i} at scale {scale} from {c:?}"); + let made = fresh.pixel_fx.values().next().unwrap(); + let kept = r.pixel_fx.values().next().unwrap(); + assert_eq!(kept.k.to_bits(), made.k.to_bits(), "pan {i} at scale {scale} from {c:?}"); + assert_eq!((kept.image.width(), kept.image.height()), (made.image.width(), made.image.height())); + } + } +} + +/// A whole-object raster kept for pans draws again only while its scale, its size, and the zoom, +/// rotation and whole-pixel pan of the output it was made for match the frame's. +#[test] +fn a_whole_object_raster_draws_after_a_pan_only_as_made_for_this_output_scale_and_size() { + use super::linear_key; + let d = doc_with(Rect::new(100.0, 100.0, 2100.0, 101.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let view = |dy: f64| Affine::translate((640.0, 400.0 + dy)) * Affine::scale(64.0) * Affine::translate((-1100.0, -100.5)); + type Change = fn(&mut super::PixelEntry); + let changes: [(&str, Change); 6] = [ + ("the same output scale and size", |_| {}), + ("an output at another zoom", |e| { + if let Some(pan) = &mut e.pan { + pan.2 = linear_key(Affine::scale(2.0) * Affine::scale(64.0)); + } + }), + ("an output panned by part of a pixel", |e| { + if let Some(pan) = &mut e.pan { + pan.1.y += 0.5; + } + }), + ("a scale off by a small relative amount", |e| e.k *= 1.0 + 1e-6), + ("another width", |e| { + e.image = Arc::new(vello_cpu::Pixmap::new(e.image.width() + 1, e.image.height())); + }), + ("another height", |e| { + e.image = Arc::new(vello_cpu::Pixmap::new(e.image.width(), e.image.height() + 1)); + }), + ]; + for (case, (what, change)) in changes.into_iter().enumerate() { + let mut r = Renderer::new(); + let _ = r.render(&d, 1280, 800, view(0.0), &opts); + let e = r.pixel_fx.values_mut().next().unwrap(); + assert!(e.k < 1.0 && e.pan.is_some(), "a raster of the whole object kept for pans"); + assert_eq!(u32::from(e.image.width()), crate::MAX_RASTER_SIDE, "the raster is as wide as a raster can be"); + change(e); + let image = e.image.clone(); + let pixels = r.render(&d, 1280, 800, view(40.0), &opts).pixels; + let reused = r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)); + assert_eq!(reused, case == 0, "reuse after a pan, for {what}"); + assert!(pixels == Renderer::new().render(&d, 1280, 800, view(40.0), &opts).pixels, "after a pan, for {what}"); + } +} + /// A width-capped whole-object raster draws after a whole-pixel pan, but filters again when the /// pan differs from whole pixels by more than floating-point rounding. #[test] From 901f78bedddd22d9f3e37dbb3d3b65f5e4910e9b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 10:48:05 -0800 Subject: [PATCH 21/24] Effects: a whole-object raster keeps its origin across whole-pixel pans of a centered view The canvas pans by moving the view's center, which leaves rounding error in the view's translation (for example -13680.000000000002). Flooring the raster's left or top edge then put the origin one pixel lower, the width or height grew by a pixel, the scale changed, and the whole object was filtered again. The origin is now rounded to 2^-20 device pixels, ties to even, before it is floored, as the sizes already were. pans_of_a_centered_view_draw_the_whole_object_raster_again now pans across and down in turn at scales 56, 72, 96 and 120, with centers on whole points too. --- crates/render/src/fx/pixels.rs | 12 ++++++++---- crates/render/src/fx/tests.rs | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 87bc4d09e2..b742d5718f 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -160,10 +160,14 @@ impl Renderer { Some(m) if !fits => full.intersect(room.inflate(m, m)), _ => full, }; - let (x0, y0) = (region.x0.floor(), region.y0.floor()); - // Sizes rounded to 2^-20 device pixels keep raster dimensions and filter scales stable across whole-pixel pans. - let size = |v: f64| v.trunc() + (v.fract() * 1_048_576.0).round() / 1_048_576.0; - let (rw, rh) = (size((region.x1 - x0).max(1.0)), size((region.y1 - y0).max(1.0))); + // The origin and the sizes, rounded to 2^-20 device pixels, keep the raster's place, dimensions + // and filter scale stable across whole-pixel pans that leave rounding error in the view. Origin + // ties round to even steps, so whole-pixel shifts round alike across zero. Origins of 2^32 pixels + // or more in magnitude are kept as they are. Size fractions round ties away from zero. + let snap_origin = |v: f64| if v.abs() < 4_294_967_296.0 { (v * 1_048_576.0).round_ties_even() / 1_048_576.0 } else { v }; + let round_size = |v: f64| v.trunc() + (v.fract() * 1_048_576.0).round() / 1_048_576.0; + let (x0, y0) = (snap_origin(region.x0).floor(), snap_origin(region.y0).floor()); + let (rw, rh) = (round_size((region.x1 - x0).max(1.0)), round_size((region.y1 - y0).max(1.0))); // (vello_cpu panics drawing near `u16::MAX` pixels a side.) let side = f64::from(crate::MAX_RASTER_SIDE); let k = (PIXEL_BUDGET / (rw * rh)).sqrt().min(side / rw).min(side / rh).min(1.0); diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 707ef3f17b..21e0e9fbd9 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -2044,14 +2044,23 @@ fn a_pan_by_part_of_a_pixel_filters_a_width_capped_whole_object_raster_again() { } /// The canvas centers its view on a document point and pans by moving that point by the pan's -/// device pixels over the scale. At 9600% and 5000% each whole-pixel pan keeps the raster's scale +/// device pixels over the scale, here across and down in turn. At scales from 50 to 120, with +/// centers on whole points and between them, each whole-pixel pan keeps the raster's origin, scale /// and size bit-identical to a fresh render's and draws the kept raster. #[test] fn pans_of_a_centered_view_draw_the_whole_object_raster_again() { let d = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), vec![("sketch.tornEdges", json!({}))]); let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; let view = |scale: f64, c: Point| Affine::translate((640.0, 400.0)) * Affine::scale(scale) * Affine::translate((-c.x, -c.y)); - for (scale, c) in [(96.0, Point::new(295.3, 175.7)), (96.0, Point::new(291.137, 171.913)), (50.0, Point::new(291.137, 171.913))] { + for (scale, c) in [ + (96.0, Point::new(295.3, 175.7)), + (96.0, Point::new(291.137, 171.913)), + (96.0, Point::new(150.0, 120.0)), + (72.0, Point::new(200.0, 175.0)), + (120.0, Point::new(295.3, 175.7)), + (56.0, Point::new(150.0, 120.0)), + (50.0, Point::new(291.137, 171.913)), + ] { let mut r = Renderer::new(); let _ = r.render(&d, 1280, 800, view(scale, c), &opts); let kept = r.pixel_fx.values().next().unwrap(); @@ -2059,7 +2068,11 @@ fn pans_of_a_centered_view_draw_the_whole_object_raster_again() { let image = kept.image.clone(); let mut at = c; for i in 1..=4 { - at.x -= 40.0 / scale; + if i % 2 == 1 { + at.x -= 40.0 / scale; + } else { + at.y -= 40.0 / scale; + } let pixels = r.render(&d, 1280, 800, view(scale, at), &opts).pixels; assert!(r.pixel_fx.values().any(|e| Arc::ptr_eq(&e.image, &image)), "pan {i} of 40 px at scale {scale} from {c:?} draws the kept raster"); let mut fresh = Renderer::new(); From 268c9a641a88fb7a1c974c356848def1e8509f88 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 10:58:25 -0800 Subject: [PATCH 22/24] Windows: a pen or touch stroke stays down until the pen lifts With Windows Ink, winit reports a pen in contact as a touch, and egui turns it into the primary press. Since the craft-libs pin took d3a4e1592, the window host reads the mouse buttons with GetAsyncKeyState to find a release the window never received. A pen or a finger in contact is not a mouse button there, so the host released the press on the stroke's first move: a Pencil stroke drawn with a tablet pen left a mark a few pixels long. The message hook now notes each pointer in contact, from its WM_POINTERDOWN to its up, cancel, leave or capture change, and the app's window services report the primary button down while one is. A mouse message from a mouse ends every contact, so a contact whose end went to another window does not keep the primary button held. The thread's sent-message hook is installed when a pointer goes into contact, so the leave and capture change reach it without a Wintab context. craft-libs#5596 fixes the same check in the window host. When the pin takes it, ContactWindows can go back to SystemWindows. --- apps/vectorcraft/src/main.rs | 4 +- apps/vectorcraft/src/windows_stylus.rs | 151 ++++++++++++++++++++++++- apps/vectorcraft/src/windows_wintab.rs | 14 ++- 3 files changed, 159 insertions(+), 10 deletions(-) diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs index 63135d00e5..cdbf2a0173 100644 --- a/apps/vectorcraft/src/main.rs +++ b/apps/vectorcraft/src/main.rs @@ -91,7 +91,6 @@ use craft::ui::shell::embed; use craft::window::Prefix; use craft::window::policy::{TitleBarPref, decide_for}; use craft::window::restore::Store; -use craft::window::system::SystemWindows; use vectorcraft_engine::Session; use vectorcraft_engine::cmd::fileio; use vectorcraft_engine::file_access::{self, AutomationRoots}; @@ -885,7 +884,8 @@ fn main() -> std::process::ExitCode { if let Some(window) = &winit_window { restore_main_window(window, &placement, settings.lock().get().ui.legacy_window, wayland); } - let spec = InstallSpec::new(shell_info, Arc::new(SystemWindows)) + // A pen or a finger in contact counts as the primary button (`windows_stylus`). + let spec = InstallSpec::new(shell_info, Arc::new(windows_stylus::ContactWindows)) .app_id(vectorcraft_ui_egui::os_window::app_id()) .placement(Arc::new(Mutex::new(placement))) .frame(decision); diff --git a/apps/vectorcraft/src/windows_stylus.rs b/apps/vectorcraft/src/windows_stylus.rs index b8e6b88ee1..cbeca212ae 100644 --- a/apps/vectorcraft/src/windows_stylus.rs +++ b/apps/vectorcraft/src/windows_stylus.rs @@ -28,13 +28,20 @@ //! converted to radians. `POINTER_PEN_INFO` has no field for an airbrush pen's finger wheel, which //! comes from the tablet driver's Wintab interface instead, when it has one //! ([`crate::windows_wintab`]). +//! +//! The window host reads the mouse buttons Windows reports down ([`ContactWindows`]) to release a +//! press whose release the window never received. A pen or a finger in contact is not a mouse +//! button there, so [`msg_hook`] also notes each pointer in contact, and [`ContactWindows`] reports +//! the primary button down while one is. Otherwise the press of a pen stroke is released on its +//! first move. #![cfg_attr(not(windows), allow(dead_code))] use std::cell::Cell; -use std::sync::OnceLock; +use std::sync::{Mutex, OnceLock, PoisonError}; -use craft::behavior::PointerSample; +use craft::behavior::{Monitor, PointerSample}; use craft::ui::runtime::pen::PenSource; +use craft::window::system::{HeldButtons, SystemWindows, WindowSystem}; /// `POINTER_MESSAGE_FLAG_SECONDBUTTON` (`winuser.h`): in the high word of a pointer message's /// `wParam`, a pen in contact with its barrel button pressed. @@ -44,6 +51,8 @@ const POINTER_MESSAGE_FLAG_SECONDBUTTON: usize = 0x0020; const POINTER_MESSAGE_FLAG_INRANGE: usize = 0x0002; /// `POINTER_MESSAGE_FLAG_CANCELED` (`winuser.h`): the pointer's input was canceled. const POINTER_MESSAGE_FLAG_CANCELED: usize = 0x8000; +/// `POINTER_MESSAGE_FLAG_INCONTACT` (`winuser.h`): a pen or a finger touching the surface. +const POINTER_MESSAGE_FLAG_INCONTACT: usize = 0x0004; /// `PEN_FLAG_INVERTED` and `PEN_FLAG_ERASER` (`winuser.h`), in `POINTER_PEN_INFO::penFlags`. const PEN_FLAG_INVERTED: u32 = 0x0002; const PEN_FLAG_ERASER: u32 = 0x0004; @@ -67,6 +76,8 @@ const WM_POINTERDOWN: u32 = 0x0246; const WM_POINTERUP: u32 = 0x0247; const WM_POINTERENTER: u32 = 0x0249; const WM_POINTERLEAVE: u32 = 0x024A; +/// `WM_POINTERCAPTURECHANGED` (`winuser.h`): another window took the pointer's capture. +const WM_POINTERCAPTURECHANGED: u32 = 0x024C; /// A pen's tilt along x and y and its barrel rotation, in radians. type Pose = ([f32; 2], f32); @@ -81,6 +92,82 @@ thread_local! { /// The pen source [`msg_hook`] writes, once [`start`] has made it. static FEED: OnceLock = OnceLock::new(); +/// The ids of the pointers in contact (pens and fingers), from [`msg_hook`]. +static CONTACTS: Mutex> = Mutex::new(Vec::new()); + +/// The running platform's window services ([`SystemWindows`]), with the primary button reported +/// down while a pen or a finger is in contact. +pub struct ContactWindows; + +impl WindowSystem for ContactWindows { + fn desktop_pointer(&self) -> Option<[f32; 2]> { + SystemWindows.desktop_pointer() + } + + fn buttons_held(&self) -> Option { + let in_contact = !CONTACTS.lock().unwrap_or_else(PoisonError::into_inner).is_empty(); + with_contact(SystemWindows.buttons_held(), in_contact) + } + + fn discard_marked_text(&self) -> bool { + SystemWindows.discard_marked_text() + } + + fn command_held(&self) -> Option { + SystemWindows.command_held() + } + + fn warp_pointer(&self, to: [f32; 2]) -> bool { + SystemWindows.warp_pointer(to) + } + + fn monitors(&self) -> Vec { + SystemWindows.monitors() + } +} + +/// The buttons `held` with the primary one added while a pointer is `in_contact`; `None` where the +/// platform tells nothing. +fn with_contact(held: Option, in_contact: bool) -> Option { + held.map(|mut held| { + if in_contact { + held.insert(HeldButtons::PRIMARY); + } + held + }) +} + +/// The pointer a message with this `wParam` is about, and whether it is now in contact: a pointer +/// that goes down or moves with `POINTER_MESSAGE_FLAG_INCONTACT` and no cancel is; one that hovers, +/// is canceled, goes up, leaves or loses its capture to another window is not. `None` for any other +/// message. +fn contact_update(message: u32, wparam: usize) -> Option<(u32, bool)> { + let id = (wparam & 0xffff) as u32; + let flags = wparam >> 16; + match message { + WM_POINTERDOWN | WM_POINTERUPDATE => Some((id, flags & POINTER_MESSAGE_FLAG_INCONTACT != 0 && flags & POINTER_MESSAGE_FLAG_CANCELED == 0)), + WM_POINTERUP | WM_POINTERLEAVE | WM_POINTERCAPTURECHANGED => Some((id, false)), + _ => None, + } +} + +/// Notes in `contacts` the pointer that a message with this `wParam` puts in or out of contact +/// ([`contact_update`]). A mouse message that a mouse made (`from_mouse`) ends every contact, so a +/// contact whose end went to another window does not hold the primary button for the mouse. +/// Returns whether the message put a pointer in contact. +fn follow_contact(contacts: &mut Vec, message: u32, wparam: usize, from_mouse: impl FnOnce() -> bool) -> bool { + match contact_update(message, wparam) { + Some((id, true)) if !contacts.contains(&id) => { + contacts.push(id); + return true; + } + Some((id, false)) => contacts.retain(|c| *c != id), + None if MOUSE_MESSAGES.contains(&message) && !contacts.is_empty() && from_mouse() => contacts.clear(), + _ => {} + } + false +} + /// The canvas's pen source, which [`msg_hook`] writes before winit handles each message. pub fn start() -> PenSource { FEED.get_or_init(PenSource::default).clone() @@ -99,6 +186,13 @@ pub fn msg_hook(msg: *const std::ffi::c_void) -> bool { let Some(msg) = (unsafe { msg.cast::().as_ref() }) else { return false; }; + // SAFETY: `GetMessageExtraInfo` reads the extra information of the thread's last message. + let from_mouse = || is_mouse(unsafe { GetMessageExtraInfo() }.0 as u32); + let touched = follow_contact(&mut CONTACTS.lock().unwrap_or_else(PoisonError::into_inner), msg.message, msg.wParam.0, from_mouse); + // The contact's sent leave and capture change come through the thread's hook. + if touched { + crate::windows_wintab::hook_sent_messages(msg.time); + } let Some(pen) = FEED.get() else { return false; }; @@ -119,8 +213,6 @@ pub fn msg_hook(msg: *const std::ffi::c_void) -> bool { let pose = pen_pose(info.penMask, info.tiltX, info.tiltY, info.rotation); Some(pen_sample(info.pressure, info.penMask, info.penFlags, in_contact, pose, wheel)) }; - // SAFETY: `GetMessageExtraInfo` reads the extra information of the thread's last message. - let from_mouse = || is_mouse(unsafe { GetMessageExtraInfo() }.0 as u32); if let Some(sample) = feed_update(msg.message, msg.wParam.0, read_pen, from_mouse) { // The barrel goes first: the contact's press reads it with the sample. pen.set_barrel(sample.is_some() && (msg.wParam.0 >> 16) & POINTER_MESSAGE_FLAG_SECONDBUTTON != 0); @@ -187,9 +279,13 @@ fn sent_forgets_wheel(message: u32, wparam: usize, pen: Option) -> bool { /// A message Windows sent to a window procedure of the thread, from the Wintab reader's hook on /// them ([`crate::windows_wintab`]): a pen leaving the window starts the wheel readings afresh, as -/// [`msg_hook`] does for the messages it sees. +/// [`msg_hook`] does for the messages it sees, and a pointer that leaves it or loses its capture is +/// no longer in contact. #[cfg(windows)] pub fn sent_message(message: u32, wparam: usize) { + if matches!(message, WM_POINTERLEAVE | WM_POINTERCAPTURECHANGED) { + follow_contact(&mut CONTACTS.lock().unwrap_or_else(PoisonError::into_inner), message, wparam, || false); + } if sent_forgets_wheel(message, wparam, WHEEL_PEN.get()) { crate::windows_wintab::forget(); } @@ -328,6 +424,51 @@ mod tests { assert_eq!(pen_sample(2000, PEN_MASK_PRESSURE, 0, false, UPRIGHT, None).pressure, 0.0); } + #[test] + fn a_pointer_in_contact_holds_the_primary_button() { + assert_eq!(with_contact(Some(HeldButtons::NONE), true), Some(HeldButtons::PRIMARY), "a pen stroke while no mouse button is down"); + assert_eq!(with_contact(Some(HeldButtons::NONE), false), Some(HeldButtons::NONE)); + let held = with_contact(Some(HeldButtons::SECONDARY), true).unwrap_or_default(); + assert!(held.contains(HeldButtons::PRIMARY) && held.contains(HeldButtons::SECONDARY), "the mouse's own buttons stay"); + assert_eq!(with_contact(None, true), None, "a platform that tells nothing still tells nothing"); + } + + #[test] + fn a_pen_stroke_is_in_contact_from_its_down_to_its_up() { + let flags = |f: usize| (f << 16) | 7; + let touching = flags(POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT); + let no_mouse = || -> bool { panic!("a pointer message is not a mouse message") }; + let mut contacts = vec![]; + follow_contact(&mut contacts, WM_POINTERUPDATE, flags(POINTER_MESSAGE_FLAG_INRANGE), no_mouse); + assert!(contacts.is_empty(), "a hovering pen is in no contact"); + assert!(follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse), "the pen goes into contact"); + assert_eq!(contacts, [7], "the pen touches down"); + assert!(!follow_contact(&mut contacts, WM_POINTERUPDATE, touching, no_mouse), "it is already in contact"); + assert_eq!(contacts, [7], "and stays in contact while it moves"); + follow_contact(&mut contacts, WM_POINTERDOWN, (POINTER_MESSAGE_FLAG_INCONTACT << 16) | 9, no_mouse); + follow_contact(&mut contacts, WM_POINTERUP, flags(POINTER_MESSAGE_FLAG_INRANGE), no_mouse); + assert_eq!(contacts, [9], "the pen goes up and a finger stays down"); + follow_contact(&mut contacts, WM_POINTERUPDATE, ((POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_CANCELED) << 16) | 9, no_mouse); + assert!(contacts.is_empty(), "a canceled contact ends"); + follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); + follow_contact(&mut contacts, WM_POINTERLEAVE, 7, no_mouse); + assert!(contacts.is_empty(), "a pointer that leaves the window ends its contact"); + follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); + follow_contact(&mut contacts, WM_POINTERCAPTURECHANGED, 7, no_mouse); + assert!(contacts.is_empty(), "a pointer whose capture another window took ends its contact"); + + // WM_LBUTTONDOWN. + follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); + follow_contact(&mut contacts, 0x0201, 0, || false); + assert_eq!(contacts, [7], "a mouse message Windows made from the pen keeps the contact"); + follow_contact(&mut contacts, 0x0201, 0, || true); + assert!(contacts.is_empty(), "a press of the mouse ends a contact whose end never arrived"); + // WM_KEYDOWN. + follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); + follow_contact(&mut contacts, 0x0100, 0, || -> bool { panic!("not a mouse message") }); + assert_eq!(contacts, [7]); + } + #[test] fn mouse_messages_from_a_pen_or_a_touch_are_told_apart() { assert!(is_mouse(0), "a mouse"); diff --git a/apps/vectorcraft/src/windows_wintab.rs b/apps/vectorcraft/src/windows_wintab.rs index 31da32a1ff..50ccff2af8 100644 --- a/apps/vectorcraft/src/windows_wintab.rs +++ b/apps/vectorcraft/src/windows_wintab.rs @@ -625,7 +625,7 @@ fn message(message: u32, wparam: usize, lparam: isize) -> Message { } #[cfg(windows)] -pub use win::{forget, msg_hook, pen_wheel, set_wheel_used, wheel_pen}; +pub use win::{forget, hook_sent_messages, msg_hook, pen_wheel, set_wheel_used, wheel_pen}; #[cfg(windows)] #[allow(unsafe_code)] @@ -758,8 +758,9 @@ mod win { /// The thread's hook on the messages Windows sends to its windows' procedures, which winit's /// message hook does not see: another app becoming the active one (`WM_ACTIVATEAPP`, sent to a /// top-level window of the app, ) - /// closes the context ([`deactivate`]), and a pen's `WM_POINTERENTER` and `WM_POINTERLEAVE` - /// () go to + /// closes the context ([`deactivate`]), and a pointer's `WM_POINTERENTER`, `WM_POINTERLEAVE` + /// () and + /// `WM_POINTERCAPTURECHANGED` go to /// [`crate::windows_stylus::sent_message`]. The hook sees them whichever of the app's windows /// they are sent to (). unsafe extern "system" fn call_wnd_proc(code: i32, wparam: WPARAM, lparam: LPARAM) -> LRESULT { @@ -1089,6 +1090,13 @@ mod win { settle(); } + /// Installs [`call_wnd_proc`] for a pointer that went into contact at the message time `time`, + /// so the pointer's sent `WM_POINTERLEAVE` and `WM_POINTERCAPTURECHANGED` reach + /// [`crate::windows_stylus::sent_message`] whether or not a context opens ([`hook_thread`]). + pub fn hook_sent_messages(time: u32) -> bool { + hook_thread(time) + } + /// The pen whose leaving starts the readings afresh, for a message of the pen with the pointer /// id `pen` ([`Readings::owner_or`]). pub fn wheel_pen(pen: u32) -> u32 { From 3552f83b32879a945b8bff2206a956c2fd6cb87d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 12:02:44 -0800 Subject: [PATCH 23/24] Windows: note a pen contact only once its leave can arrive When the thread's sent-message hook failed to install, the message hook still noted the pointer in contact. Its WM_POINTERLEAVE and WM_POINTERCAPTURECHANGED are sent, so they never reached the contact list, and ContactWindows kept the primary button held until a mouse message from a mouse cleared it. follow_contact now adds a pointer only when the hook is installed. When the install fails, the contact is not noted, and the pointer's next in-contact message tries the install again. --- apps/vectorcraft/src/windows_stylus.rs | 69 +++++++++++++++++--------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/apps/vectorcraft/src/windows_stylus.rs b/apps/vectorcraft/src/windows_stylus.rs index cbeca212ae..8b0a0a7e2a 100644 --- a/apps/vectorcraft/src/windows_stylus.rs +++ b/apps/vectorcraft/src/windows_stylus.rs @@ -154,10 +154,12 @@ fn contact_update(message: u32, wparam: usize) -> Option<(u32, bool)> { /// Notes in `contacts` the pointer that a message with this `wParam` puts in or out of contact /// ([`contact_update`]). A mouse message that a mouse made (`from_mouse`) ends every contact, so a /// contact whose end went to another window does not hold the primary button for the mouse. -/// Returns whether the message put a pointer in contact. -fn follow_contact(contacts: &mut Vec, message: u32, wparam: usize, from_mouse: impl FnOnce() -> bool) -> bool { +/// A pointer goes into contact only when `watched` returns true: the thread's hook that sees its +/// sent leave and capture change is installed. Otherwise a later message of the contact tries +/// again. Returns whether the message put a pointer in contact. +fn follow_contact(contacts: &mut Vec, message: u32, wparam: usize, from_mouse: impl FnOnce() -> bool, watched: impl FnOnce() -> bool) -> bool { match contact_update(message, wparam) { - Some((id, true)) if !contacts.contains(&id) => { + Some((id, true)) if !contacts.contains(&id) && watched() => { contacts.push(id); return true; } @@ -188,11 +190,10 @@ pub fn msg_hook(msg: *const std::ffi::c_void) -> bool { }; // SAFETY: `GetMessageExtraInfo` reads the extra information of the thread's last message. let from_mouse = || is_mouse(unsafe { GetMessageExtraInfo() }.0 as u32); - let touched = follow_contact(&mut CONTACTS.lock().unwrap_or_else(PoisonError::into_inner), msg.message, msg.wParam.0, from_mouse); - // The contact's sent leave and capture change come through the thread's hook. - if touched { - crate::windows_wintab::hook_sent_messages(msg.time); - } + // The contact's sent leave and capture change come through the thread's hook, so a contact is + // noted only once the hook is installed. + let watched = || crate::windows_wintab::hook_sent_messages(msg.time); + follow_contact(&mut CONTACTS.lock().unwrap_or_else(PoisonError::into_inner), msg.message, msg.wParam.0, from_mouse, watched); let Some(pen) = FEED.get() else { return false; }; @@ -284,7 +285,7 @@ fn sent_forgets_wheel(message: u32, wparam: usize, pen: Option) -> bool { #[cfg(windows)] pub fn sent_message(message: u32, wparam: usize) { if matches!(message, WM_POINTERLEAVE | WM_POINTERCAPTURECHANGED) { - follow_contact(&mut CONTACTS.lock().unwrap_or_else(PoisonError::into_inner), message, wparam, || false); + follow_contact(&mut CONTACTS.lock().unwrap_or_else(PoisonError::into_inner), message, wparam, || false, || true); } if sent_forgets_wheel(message, wparam, WHEEL_PEN.get()) { crate::windows_wintab::forget(); @@ -438,37 +439,57 @@ mod tests { let flags = |f: usize| (f << 16) | 7; let touching = flags(POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT); let no_mouse = || -> bool { panic!("a pointer message is not a mouse message") }; + let follow = |contacts: &mut Vec, message: u32, wparam: usize| follow_contact(contacts, message, wparam, no_mouse, || true); let mut contacts = vec![]; - follow_contact(&mut contacts, WM_POINTERUPDATE, flags(POINTER_MESSAGE_FLAG_INRANGE), no_mouse); + follow(&mut contacts, WM_POINTERUPDATE, flags(POINTER_MESSAGE_FLAG_INRANGE)); assert!(contacts.is_empty(), "a hovering pen is in no contact"); - assert!(follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse), "the pen goes into contact"); + assert!(follow(&mut contacts, WM_POINTERDOWN, touching), "the pen goes into contact"); assert_eq!(contacts, [7], "the pen touches down"); - assert!(!follow_contact(&mut contacts, WM_POINTERUPDATE, touching, no_mouse), "it is already in contact"); + assert!(!follow(&mut contacts, WM_POINTERUPDATE, touching), "it is already in contact"); assert_eq!(contacts, [7], "and stays in contact while it moves"); - follow_contact(&mut contacts, WM_POINTERDOWN, (POINTER_MESSAGE_FLAG_INCONTACT << 16) | 9, no_mouse); - follow_contact(&mut contacts, WM_POINTERUP, flags(POINTER_MESSAGE_FLAG_INRANGE), no_mouse); + follow(&mut contacts, WM_POINTERDOWN, (POINTER_MESSAGE_FLAG_INCONTACT << 16) | 9); + follow(&mut contacts, WM_POINTERUP, flags(POINTER_MESSAGE_FLAG_INRANGE)); assert_eq!(contacts, [9], "the pen goes up and a finger stays down"); - follow_contact(&mut contacts, WM_POINTERUPDATE, ((POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_CANCELED) << 16) | 9, no_mouse); + follow(&mut contacts, WM_POINTERUPDATE, ((POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_CANCELED) << 16) | 9); assert!(contacts.is_empty(), "a canceled contact ends"); - follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); - follow_contact(&mut contacts, WM_POINTERLEAVE, 7, no_mouse); + follow(&mut contacts, WM_POINTERDOWN, touching); + follow(&mut contacts, WM_POINTERLEAVE, 7); assert!(contacts.is_empty(), "a pointer that leaves the window ends its contact"); - follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); - follow_contact(&mut contacts, WM_POINTERCAPTURECHANGED, 7, no_mouse); + follow(&mut contacts, WM_POINTERDOWN, touching); + follow(&mut contacts, WM_POINTERCAPTURECHANGED, 7); assert!(contacts.is_empty(), "a pointer whose capture another window took ends its contact"); // WM_LBUTTONDOWN. - follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); - follow_contact(&mut contacts, 0x0201, 0, || false); + follow(&mut contacts, WM_POINTERDOWN, touching); + follow_contact(&mut contacts, 0x0201, 0, || false, || true); assert_eq!(contacts, [7], "a mouse message Windows made from the pen keeps the contact"); - follow_contact(&mut contacts, 0x0201, 0, || true); + follow_contact(&mut contacts, 0x0201, 0, || true, || true); assert!(contacts.is_empty(), "a press of the mouse ends a contact whose end never arrived"); // WM_KEYDOWN. - follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse); - follow_contact(&mut contacts, 0x0100, 0, || -> bool { panic!("not a mouse message") }); + follow(&mut contacts, WM_POINTERDOWN, touching); + follow_contact(&mut contacts, 0x0100, 0, || -> bool { panic!("not a mouse message") }, || true); assert_eq!(contacts, [7]); } + #[test] + fn a_contact_is_noted_only_while_its_end_can_arrive() { + let touching = ((POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT) << 16) | 7; + let no_mouse = || -> bool { panic!("a pointer message is not a mouse message") }; + let mut contacts = vec![]; + assert!(!follow_contact(&mut contacts, WM_POINTERDOWN, touching, no_mouse, || false), "the hook did not install"); + assert!(contacts.is_empty(), "a contact whose leave could not arrive is not noted"); + assert!(follow_contact(&mut contacts, WM_POINTERUPDATE, touching, no_mouse, || true), "the next move tries again"); + assert_eq!(contacts, [7]); + let asked = std::cell::Cell::new(false); + follow_contact(&mut contacts, WM_POINTERUPDATE, touching, no_mouse, || { + asked.set(true); + true + }); + assert!(!asked.get(), "a pointer already in contact does not install the hook again"); + follow_contact(&mut contacts, WM_POINTERUP, 7, no_mouse, || -> bool { panic!("an up is not a contact") }); + assert!(contacts.is_empty()); + } + #[test] fn mouse_messages_from_a_pen_or_a_touch_are_told_apart() { assert!(is_mouse(0), "a mouse"); From 356e07b44c146c56beed3de08fee8c38d5778f01 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 12:30:58 -0800 Subject: [PATCH 24/24] Main: engine tests that share process-wide state run apart under cargo test FreeBSD CI runs `cargo test --workspace`, which runs a crate's tests as threads of one process; Linux CI runs nextest, one process per test. Four vectorcraft-engine tests failed only in the shared process: - Events plug-ins are installed in the process-wide registry, so every installed one reacts to every session's changes and spends handlers of each session's frame budget (MAX_FRAME_HANDLERS, 4). With other tests' plug-ins installed at the same time, the plug-in a test counts on was left for a later frame and its handler never ran. a_plugin_installed_before_the_delivery_gets_no_earlier_events, a_save_reaches_the_plugin_when_its_document_closes_first and background_installs_during_a_drag_record_the_settled_baseline failed this way. The tests that install events plug-ins now hold a test lock (hold_event_plugins) while their session lives; sessions on one thread share it. - a_stale_placed_item_is_not_a_relative_object and a_stale_placed_item_is_refused_as_the_relative_object_of_move used the same fixture folder name, and each test empties its folder first, so one deleted the other's a.png. The second one now uses its own folder. `cargo test -p vectorcraft-engine --lib` on Linux reproduces all of them before this change. --- crates/engine/src/plugin_events.rs | 48 ++++++++++++++++++++ crates/engine/src/tests/plugin_events.rs | 27 +++++++++-- crates/engine/src/tests/script_dom_images.rs | 2 +- 3 files changed, 73 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/plugin_events.rs b/crates/engine/src/plugin_events.rs index 4a85763667..eda96e8c5d 100644 --- a/crates/engine/src/plugin_events.rs +++ b/crates/engine/src/plugin_events.rs @@ -68,6 +68,53 @@ type Recipient = (String, String, u64); #[cfg(test)] std::thread_local! { pub(crate) static RECIPIENT_IDENTITIES: std::cell::Cell = const { std::cell::Cell::new(0) }; + /// How many [`EventPluginsHeld`] this thread holds. + static EVENT_PLUGINS_HELD: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// The thread whose test has events plug-ins installed in the process-wide registry, if any. +#[cfg(test)] +static EVENT_PLUGINS_OWNER: std::sync::Mutex> = std::sync::Mutex::new(None); +#[cfg(test)] +static EVENT_PLUGINS_FREED: std::sync::Condvar = std::sync::Condvar::new(); + +/// Held by a test that installs events plug-ins in the process-wide registry. Every such plug-in +/// reacts to every session's changes and spends handlers of every session's frame budget +/// ([`MAX_FRAME_HANDLERS`]), so when tests run as threads of one process, another test's plug-ins +/// would take the handlers a test counts on. A thread waits while another thread holds one; the +/// guards one thread holds count as one, until the last of them is dropped. +#[cfg(test)] +pub(crate) struct EventPluginsHeld { + /// Dropped on the thread that made it. + _thread: std::marker::PhantomData<*const ()>, +} + +#[cfg(test)] +pub(crate) fn hold_event_plugins() -> EventPluginsHeld { + if EVENT_PLUGINS_HELD.with(std::cell::Cell::get) == 0 { + let me = std::thread::current().id(); + let mut owner = EVENT_PLUGINS_OWNER.lock().unwrap_or_else(std::sync::PoisonError::into_inner); + while owner.is_some_and(|t| t != me) { + owner = EVENT_PLUGINS_FREED.wait(owner).unwrap_or_else(std::sync::PoisonError::into_inner); + } + *owner = Some(me); + } + EVENT_PLUGINS_HELD.with(|n| n.set(n.get() + 1)); + EventPluginsHeld { _thread: std::marker::PhantomData } +} + +#[cfg(test)] +impl Drop for EventPluginsHeld { + fn drop(&mut self) { + let last = EVENT_PLUGINS_HELD.with(|n| { + n.set(n.get() - 1); + n.get() == 0 + }); + if last { + *EVENT_PLUGINS_OWNER.lock().unwrap_or_else(std::sync::PoisonError::into_inner) = None; + EVENT_PLUGINS_FREED.notify_all(); + } + } } /// The recipient `p` is. @@ -836,6 +883,7 @@ mod tests { use serde_json::json; use vectorcraft_plugins::wat as tpl; let id = "test.events.nested"; + let _held = hold_event_plugins(); let mut s = Session::new(); s.execute("file.new", &json!({})).unwrap(); s.allow_plugin_grants_from_requests(); diff --git a/crates/engine/src/tests/plugin_events.rs b/crates/engine/src/tests/plugin_events.rs index f7ac63e770..0b0a4ba4ee 100644 --- a/crates/engine/src/tests/plugin_events.rs +++ b/crates/engine/src/tests/plugin_events.rs @@ -12,12 +12,33 @@ fn run(s: &mut Session, cmd: &str, p: Value) -> Value { s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd}: {e}")) } -/// A session with a 400 × 200 document that takes `grant` from requests. -fn session() -> Session { +/// A session that holds [`crate::plugin_events::hold_event_plugins`] while it lives. +struct Held { + s: Session, + _held: crate::plugin_events::EventPluginsHeld, +} + +impl std::ops::Deref for Held { + type Target = Session; + fn deref(&self) -> &Session { + &self.s + } +} + +impl std::ops::DerefMut for Held { + fn deref_mut(&mut self) -> &mut Session { + &mut self.s + } +} + +/// A session with a 400 × 200 document that takes `grant` from requests. The plug-ins its test +/// installs are the only events plug-ins installed while it lives. +fn session() -> Held { + let held = crate::plugin_events::hold_event_plugins(); let mut s = Session::new(); s.execute("file.new", &json!({"width": 400, "height": 200})).unwrap(); s.allow_plugin_grants_from_requests(); - s + Held { s, _held: held } } fn rect(s: &mut Session, x: f64) -> NodeId { diff --git a/crates/engine/src/tests/script_dom_images.rs b/crates/engine/src/tests/script_dom_images.rs index 8fc2876981..da4411eb94 100644 --- a/crates/engine/src/tests/script_dom_images.rs +++ b/crates/engine/src/tests/script_dom_images.rs @@ -802,7 +802,7 @@ fn a_placed_items_file_binds_the_exact_id_of_the_image_placed() { /// it became is named by a fresh wrapper. #[test] fn a_stale_placed_item_is_refused_as_the_relative_object_of_move() { - let base = folder("stale-relative"); + let base = folder("stale-relative-move"); let a = base.join("main/a.png"); std::fs::write(&a, gray_png(4, 4)).unwrap(); let mut s = session();