From 1e2bc0fee889e0a1682e54ab6c5a2817a234f4c2 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 05:29:36 +0800 Subject: [PATCH 001/115] Preserve symbol pattern resources and affine stroke scaling in AI exports --- crates/eps/src/ai_editing.rs | 4 +- crates/eps/src/ai_editing/tests.rs | 177 +++++++++++++++++++- crates/eps/src/ai_editing/writer.rs | 40 ++++- crates/eps/src/ai_editing/writer/images.rs | 2 +- crates/eps/src/ai_editing/writer/paints.rs | 37 +++- crates/eps/src/ai_editing/writer/symbols.rs | 6 + crates/eps/src/import/ai/read/directives.rs | 8 +- crates/eps/src/import/ai/read/document.rs | 6 + crates/eps/src/import/ai/read/types.rs | 2 + docs/file-format-parity.md | 8 +- 10 files changed, 265 insertions(+), 25 deletions(-) diff --git a/crates/eps/src/ai_editing.rs b/crates/eps/src/ai_editing.rs index 82ed02f1f8..a952fbac6c 100644 --- a/crates/eps/src/ai_editing.rs +++ b/crates/eps/src/ai_editing.rs @@ -181,7 +181,7 @@ //! (gradients that dither are written without dither's noise, Perceptual gradients and gradients //! mixed around the hue wheel as the stops on their curve in process colors, at most 256, and //! gradient stops linked to global process colors as their colors), pattern fills whose tiles aren't a grid, whose art reaches past -//! the tile or is painted with patterns, and pattern fills in symbols, as their tiles cut +//! the tile or is painted with patterns, and pattern fills in large-canvas symbols, as their tiles cut //! to the shape, clipping groups and clipping layers whose clipping object isn't a path, //! and the clipping groups inside them, as their art cut to that object (its fill cut too, its //! stroke not; an image in a clipping group of the region it is cut to), images that can't be @@ -225,7 +225,7 @@ use vectorcraft_pdf::PrivateData; use crate::ps; mod writer; -pub(crate) use writer::{DYNAMIC_KEY, OVERRIDES_KEY, hex_decode}; +pub(crate) use writer::{DYNAMIC_KEY, OVERRIDES_KEY, PATTERN_SPACE_KEY, hex_decode}; use writer::Writer; diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs index 8c3b4ad12d..82ea0fc5b0 100644 --- a/crates/eps/src/ai_editing/tests.rs +++ b/crates/eps/src/ai_editing/tests.rs @@ -6521,12 +6521,12 @@ fn instances_the_data_cant_hold_are_written_as_their_art() { } /// Symbols whose art paints with a pattern, directly, through a nested symbol, in an opacity mask -/// and through an inline graphic: their definitions hold the pattern fills as tiles cut to the shape (the reader keeps no -/// symbol whose art paints with a pattern), and their instances are written as their art, whose +/// and through an inline graphic: their definitions retain native pattern resources, and their +/// instances are written as their art, whose /// pattern fills keep the document's placement as the canvas draws them, each with a warning. An /// instance of a symbol without pattern paint stays an instance. #[test] -fn symbols_with_pattern_fills_are_defined_with_tiles_and_placed_as_art() { +fn symbols_with_pattern_fills_keep_resources_and_place_as_art() { let mut doc = Document::new(200.0, 100.0); // Tiles that cover the shape, so its tiles cut to it draw its box. let dot = Arc::new(square(&mut doc, Rect::new(0.0, 0.0, 8.0, 8.0), Color::BLACK)); @@ -6561,12 +6561,17 @@ fn symbols_with_pattern_fills_are_defined_with_tiles_and_placed_as_art() { let filled = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(150.0, 10.0, 182.0, 42.0)), fill()); doc.insert(Some(layer), usize::MAX, filled).unwrap(); let out = export_ai_editing(&doc, &opts()).unwrap(); - assert!(out.warnings.iter().any(|w| w == writer::SYMBOL_ART) && out.warnings.iter().any(|w| w == writer::PATTERNS), "{:?}", out.warnings); + assert!(out.warnings.iter().any(|w| w == writer::SYMBOL_ART), "{:?}", out.warnings); + assert!(!out.warnings.iter().any(|w| w == writer::PATTERNS), "grid resources must not become tiles: {:?}", out.warnings); let back = read_back(&doc); let names: Vec<&str> = back.symbols.iter().map(|s| s.name.as_str()).collect(); assert_eq!(names, ["Patch", "Outer", "Masked", "Plain", "Typed"]); let patch = &back.symbols[0].art; - assert!(matches!(patch.kind, NodeKind::Group { .. }), "the symbol's art is its tiles: {:?}", patch.kind); + assert!( + matches!(patch.kind, NodeKind::Path { .. }) && vectorcraft_doc::pattern::uses_pattern(patch, Some("Dots")), + "the symbol must retain its original pattern-filled path: {:?}", + patch.kind + ); assert_eq!(instances(&back.symbols[1].art), 0, "the nested instance is its art"); let kids = back.layers[0].children().unwrap(); let kinds: Vec = kids.iter().map(|n| matches!(n.kind, NodeKind::SymbolInstance { .. })).collect(); @@ -6596,8 +6601,164 @@ fn symbols_with_pattern_fills_are_defined_with_tiles_and_placed_as_art() { same_lines(&boxes(&back), &boxes(&doc)); } +/// Original ruled tile shared by symbol art and an ordinary canvas object. The symbol's pattern +/// and geometry are scaled together, as editing its art with Transform Pattern Tiles does. +fn ruled_pattern_symbol(strokes: bool, tile_type: vectorcraft_doc::TileType, extent: f64) -> Document { + let mut doc = Document::new(240.0, 140.0); + let line = + Node::path(doc.alloc_id(), shapes::line((1.0, 5.0).into(), (9.0, 5.0).into()), Appearance::basic(Paint::None, solid(Color::BLACK), 2.0)); + let mut tile = vectorcraft_doc::PatternDef::new("Rules", vec![Arc::new(line)]); + tile.tile = Rect::new(0.0, 0.0, 10.0, 10.0); + tile.tile_type = tile_type; + doc.patterns.push(tile); + let fill = || Appearance::basic(Paint::Pattern { pattern: "Rules".into(), xf: Affine::IDENTITY }, Paint::None, 0.0); + let mut art = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(0.0, 0.0, extent, extent)), fill()); + art.transform(Affine::scale(0.2), vectorcraft_doc::Scaling { strokes, patterns: true, ..Default::default() }); + doc.symbols.push(Symbol { name: "Scaled".into(), art: Arc::new(art), dynamic: false }); + let layer = doc.layers[0].id; + let one = instance(&mut doc, "Scaled", Affine::translate((20.0, 20.0))); + doc.insert(Some(layer), usize::MAX, one).unwrap(); + let shared = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(125.0, 5.0, 225.0, 105.0)), fill()); + doc.insert(Some(layer), usize::MAX, shared).unwrap(); + doc +} + +#[test] +fn scaled_pattern_symbol_keeps_native_pattern_resources_in_editing_data() { + let small = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 100.0); + let large = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 200.0); + let (a, b) = (program(&small), program(&large)); + eprintln!("pattern symbol editing bytes: {} -> {} for four times the tile area", a.len(), b.len()); + let back = read_back(&small); + let art = &back.symbols.iter().find(|s| s.name == "Scaled").unwrap().art; + assert!(vectorcraft_doc::pattern::uses_pattern(art, Some("Rules")), "the symbol must retain pattern paint rather than one object per tile"); + assert_eq!(a.matches("%AI3_BeginPattern: (Rules)").count(), 1); + assert!(b.len() < a.len() * 2, "editing data must not grow with every covered tile: {} -> {}", a.len(), b.len()); + let tile = back.pattern("Rules").unwrap(); + assert_eq!(tile.tile, small.patterns[0].tile); + assert_eq!(tile.art[0].geometric_bounds().unwrap().width(), 8.0); + let strokes: Vec<_> = + tile.art[0].appearance.items.iter().filter_map(|i| if let AppearanceItem::Stroke(stroke) = i { Some(stroke.width) } else { None }).collect(); + assert_eq!(strokes, [2.0], "the shared tile keeps its original stroke"); +} + +// Four editing-stream round trips and native raster probes cover the flag and fallback cases. +#[test] +fn scaled_pattern_symbol_new_instances_match_native_tile_stroke_weight() { + for strokes in [true, false] { + for tile_type in [vectorcraft_doc::TileType::Grid, vectorcraft_doc::TileType::BrickByRow { offset: 0.5 }] { + let doc = ruled_pattern_symbol(strokes, tile_type, 100.0); + // Native rendering scales a 2pt pattern stroke to 0.4pt with its pattern affine, + // under either flag. The flag controls the selected object's own stroke separately. + let native = vectorcraft_testkit::raster::render_region(&doc, Rect::new(20.0, 20.0, 22.0, 22.0), 20.0); + let native_weight = (0..native.height).filter(|y| native.pixel(20, *y)[0] < 64).count(); + assert!((6..=10).contains(&native_weight), "native weight={native_weight}, strokes={strokes}, {tile_type:?}"); + let mut back = read_back(&doc); + // Place afresh from the editing stream's symbol definition, rather than measuring + // the already-expanded canvas instance or the file's native payload. + back.layers.clear(); + let layer = back.add_layer(Some("New instance")); + let one = instance(&mut back, "Scaled", Affine::translate((20.0, 20.0))); + back.insert(Some(layer), usize::MAX, one).unwrap(); + let placed = vectorcraft_testkit::raster::render_region(&back, Rect::new(20.0, 20.0, 22.0, 22.0), 20.0); + let weight = (0..placed.height).filter(|y| placed.pixel(20, *y)[0] < 64).count(); + assert!((6..=10).contains(&weight), "editing symbol weight={weight}, native={native_weight}, strokes={strokes}, {tile_type:?}"); + } + } +} + +// Each case goes through the real editing stream and renderer: the mask stroke has to be +// transformed as geometry even when writing its dictionary temporarily clears the tile clip. +#[test] +fn pattern_tile_fallback_preserves_affine_mask_stroke_weight() { + for matrix in + [Affine::scale(0.2), Affine::scale_non_uniform(0.2, 0.4), Affine::new([0.2, 0.0, 0.1, 0.2, 0.0, 0.0]), Affine::scale_non_uniform(-0.2, 0.2)] + { + let mut doc = ruled_pattern_symbol(true, vectorcraft_doc::TileType::BrickByRow { offset: 0.5 }, 100.0); + let white_line = + Node::path(doc.alloc_id(), shapes::line((1.0, 5.0).into(), (9.0, 5.0).into()), Appearance::basic(Paint::None, solid(Color::WHITE), 2.0)); + let mut tile = square(&mut doc, Rect::new(0.0, 0.0, 10.0, 10.0), Color::BLACK); + tile.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(white_line), clip: true, invert: false, disabled: false, linked: true })); + doc.patterns[0].art = vec![Arc::new(tile)]; + Arc::make_mut(&mut doc.symbols[0].art) + .transform(matrix * Affine::scale(5.0), vectorcraft_doc::Scaling { patterns: true, ..Default::default() }); + // This fallback bakes the unsupported brick phase. Place on whole super-tile periods + // so the probe isolates stroke geometry, rather than that existing placement limitation. + doc.layers.clear(); + let native_layer = doc.add_layer(Some("Native instance")); + let native_one = instance(&mut doc, "Scaled", Affine::translate((60.0, 40.0))); + doc.insert(Some(native_layer), usize::MAX, native_one).unwrap(); + let bounds = doc.symbols[0].art.geometric_bounds().unwrap() + vectorcraft_geom::Vec2::new(60.0, 40.0); + let period_y = 10.0 * matrix.as_coeffs()[3].abs(); + let region = Rect::new(bounds.x0, bounds.y0, bounds.x0 + 2.0, bounds.y0 + period_y); + let native = vectorcraft_testkit::raster::render_region(&doc, region, 20.0); + // Brick rows shift the line horizontally; select a visible native column and compare + // that same column after the editing-stream round trip. + let (column, native_weight) = (0..native.width) + .map(|x| (x, (0..native.height).filter(|y| native.pixel(x, *y)[0] < 64).count())) + .max_by_key(|(_, weight)| *weight) + .unwrap(); + assert!(native_weight > 0 && native_weight < native.height as usize, "native mask stroke: {matrix:?}, {native_weight}"); + let mut back = read_back(&doc); + back.layers.clear(); + let layer = back.add_layer(Some("New instance")); + let one = instance(&mut back, "Scaled", Affine::translate((60.0, 40.0))); + back.insert(Some(layer), usize::MAX, one).unwrap(); + let placed = vectorcraft_testkit::raster::render_region(&back, region, 20.0); + let weight = (0..placed.height).filter(|y| placed.pixel(column, *y)[0] < 64).count(); + assert!(weight.abs_diff(native_weight) <= 2, "mask stroke {matrix:?}: editing={weight}, native={native_weight}"); + } +} + +#[test] +fn pattern_definition_dictionary_is_scoped_away_from_its_symbol() { + let mut doc = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 100.0); + // Definitions can hold freshly generated id-less art. Its dictionary must not consume the + // surrounding symbol's root entries just because these independent art scopes share id 0. + Arc::make_mut(&mut doc.patterns[0].art[0]).id = vectorcraft_doc::NodeId(0); + let art = (*doc.symbols[0].art).clone(); + let other = square(&mut doc, Rect::new(25.0, 0.0, 30.0, 5.0), Color::BLACK); + let mut root = group(&mut doc, vec![art, other], false); + root.id = vectorcraft_doc::NodeId(0); + doc.symbols[0].art = Arc::new(root); + let back = read_back(&doc); + let symbol = back.symbols.iter().find(|s| s.name == "Scaled").expect("pattern art must not steal its symbol's declaration"); + let mut uses = false; + vectorcraft_doc::swatches::walk_with_masks(&symbol.art, &mut |n| uses |= vectorcraft_doc::pattern::uses_pattern(n, Some("Rules"))); + assert!(uses); +} + +#[test] +fn symbol_pattern_matrices_stay_readable_or_use_the_bounded_fallback() { + for scale in [0.00001, 0.0, 1e-9] { + let mut doc = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 100.0); + let art = Arc::make_mut(&mut doc.symbols[0].art); + for item in art.appearance.items.iter_mut() { + if let Paint::Pattern { xf, .. } = item.paint_mut() { + *xf = Affine::scale(scale); + } + } + let out = export_ai_editing(&doc, &opts()).unwrap(); + let back = read_back(&doc); + let symbol = back.symbols.iter().find(|s| s.name == "Scaled").expect("a bad paint matrix must not discard its symbol"); + let mut paints = vec![]; + vectorcraft_doc::swatches::walk_with_masks(&symbol.art, &mut |n| { + for item in &n.appearance.items { + if let Paint::Pattern { xf, .. } = item.paint() { + paints.push(*xf); + } + } + }); + if scale == 0.00001 { + assert_eq!(paints, [Affine::scale(scale)], "a small invertible affine must survive serialization"); + } else { + assert!(paints.is_empty() && out.warnings.iter().any(|w| w == writer::PATTERN_PLACEMENT), "{:?}", out.warnings); + } + } +} + /// A symbol whose art paints with a pattern only through a brushed stroke, whose brush's art is -/// filled with a pattern: the definition holds the tiles, and its instance is written as its art. +/// filled with a pattern: the definition keeps that resource, and its instance is written as art. #[test] fn symbols_painting_patterns_through_brush_art_are_placed_as_art() { let mut doc = Document::new(200.0, 100.0); @@ -6625,9 +6786,13 @@ fn symbols_painting_patterns_through_brush_art_are_placed_as_art() { doc.insert(Some(layer), usize::MAX, one).unwrap(); let out = export_ai_editing(&doc, &opts()).unwrap(); assert!(out.warnings.iter().any(|w| w == writer::SYMBOL_ART), "{:?}", out.warnings); + assert!(!out.warnings.iter().any(|w| w == writer::PATTERNS), "{:?}", out.warnings); let back = read_back(&doc); assert_eq!(back.symbols.iter().map(|s| s.name.as_str()).collect::>(), ["Brushed"]); assert_eq!(instances(&back.layers[0]), 0, "the instance is its art"); + let mut pattern = false; + vectorcraft_doc::swatches::walk_with_masks(&back.symbols[0].art, &mut |n| pattern |= vectorcraft_doc::pattern::uses_pattern(n, Some("Dots"))); + assert!(pattern, "indirect brush paint retains its pattern resource in the definition"); } /// A symbol first defined from the drawn look of a group with a style, through a member's scatter diff --git a/crates/eps/src/ai_editing/writer.rs b/crates/eps/src/ai_editing/writer.rs index b8ea88a1fd..52f5147d9a 100644 --- a/crates/eps/src/ai_editing/writer.rs +++ b/crates/eps/src/ai_editing/writer.rs @@ -48,7 +48,7 @@ pub(super) use paints::{ GRADIENT_COMPARISONS, GRADIENT_DITHER, GRADIENT_HUE, GRADIENT_PERCEPTUAL, GRADIENT_SHAPES, GRADIENTS, SCANNED_DEFINITIONS, STOP_LINKS, SWATCH_PLACEMENT, free_gradient_name, }; -pub(crate) use symbols::{DYNAMIC_KEY, OVERRIDES_KEY, hex_decode}; +pub(crate) use symbols::{DYNAMIC_KEY, OVERRIDES_KEY, PATTERN_SPACE_KEY, hex_decode}; #[cfg(test)] pub(super) use symbols::{MISSING_SYMBOL, SYMBOL_ART, SYMBOL_CHANGES, SYMBOL_COUNT, SYMBOL_OPTIONS}; #[cfg(test)] @@ -62,8 +62,10 @@ pub(super) use variables::{ACTIVE, BINDINGS, LIMITS, VALUES}; pub(super) const MAX_NEST: u32 = 8; pub(super) const TYPE: &str = "type in opacity masks, pattern tiles, symbols and art cut to a clipping object, mirrored type, area type and type on a path that is turned or unevenly scaled or whose frame or path has several parts, area type in an open frame, type on an open path whose ends meet, area type whose text wrap cannot be preserved from the saved objects, type of only white space, threads of type on a path, threads whose frames differ in orientation or hold a frame written as outlines, type of sizes past what the reader reads, stories past what the reader reads (1,048,576 bytes a story, 16,777,216 bytes in all, and the size of text document it reads), and type with inline graphics, ruby, gradient or pattern paint, or fills, strokes, effects or an opacity mask of the object's own, is written as its outlines in the editing data for other apps"; -pub(super) const PATTERNS: &str = "pattern fills whose tiles aren't a grid or whose art reaches past the tile, pattern fills in another pattern's tile or in a symbol, and pattern fills nested more than 8 deep are written as their tiles cut to the shape in the editing data for other apps"; +pub(super) const PATTERNS: &str = "pattern fills whose tiles aren't a grid or whose art reaches past the tile, pattern fills in another pattern's tile or in a large canvas's symbol, and pattern fills nested more than 8 deep are written as their tiles cut to the shape in the editing data for other apps"; pub(super) const PATTERN_TILES: &str = "pattern fills with more tiles than a fill places are written filled gray in the editing data for other apps"; +pub(super) const PATTERN_PLACEMENT: &str = + "pattern fills and strokes whose placement cannot be read are written gray in the editing data for other apps"; pub(super) const CLIPPING: &str = "clipping groups and clipping layers whose clipping object isn't a path, and the clipping groups inside them, are written as their art cut to that object in the editing data for other apps"; pub(super) const CLIP_PAINT: &str = "the fills and strokes of clipping paths that a plain fill and line can't draw are written as paths of their own inside the clipping (fills under the clipped art, strokes over it) in the editing data for other apps"; pub(super) const CLIP_PAINT_MASKS: &str = "the opacity masks of clipping paths whose fills and strokes are written as paths of their own stay on the clipping path, not on those paths, in the editing data for other apps"; @@ -269,10 +271,10 @@ pub(super) struct Writer<'a> { /// Whether each symbol's art paints with a pattern, nested symbols included /// ([`Self::symbol_paints_pattern`]). patterned_symbols: HashMap, - /// Pattern tiles were written in the art being written ([`Self::define_symbol`] starts it over + /// Pattern references or tiles were written in the art ([`Self::define_symbol`] starts it over /// for each symbol's art). wrote_pattern: bool, - /// The symbols whose definitions hold pattern tiles: a brushed stroke's brush art or a live + /// The symbols whose definitions write pattern paint: a brushed stroke's brush art or a live /// object's art can paint with a pattern that the symbol's own objects don't name. pattern_written: HashSet, /// Art that draws as it should only where it is was written in the art being written @@ -1031,6 +1033,7 @@ impl<'a> Writer<'a> { mask = None; mask_written = false; } + let symbol_root = self.root_entries.as_ref().is_some_and(|(id, _)| *id == n.id); let entries = match &self.root_entries { Some((id, _)) if *id == n.id => self.root_entries.take().map(|(_, e)| e), _ => None, @@ -1081,6 +1084,10 @@ impl<'a> Writer<'a> { } mask_written = false; } + // A pattern may first be written by the root's mask, so declare its space afterwards. + if symbol_root && self.in_symbol && self.symbols_live && self.wrote_pattern { + let _ = writeln!(self.body, "%_1 /Int ({PATTERN_SPACE_KEY}) ,"); + } self.body.push_str("%_;\n%_\n"); mask_written } @@ -1480,7 +1487,8 @@ impl<'a> Writer<'a> { let flat = FillLayer { paint: Paint::solid(Color::gray(0.5)), ..f.clone() }; return self.path_object(path, rule, Some(&flat), None, xy); }; - let tiles = def.instances_in(*xf, path.to_bezpath().bounding_box()); + let inverse = xf.inverse(); + let tiles = def.instances_in(Affine::IDENTITY, inverse.transform_rect_bbox(path.to_bezpath().bounding_box())); // More tiles than a fill places come back as none: the shape is filled gray, as a // pattern that isn't found is. if tiles.is_empty() && !def.art.is_empty() { @@ -1494,8 +1502,26 @@ impl<'a> Writer<'a> { } self.wrote_pattern = true; let outer = self.clip.clone(); - let region = self.cut(path, rule); + let mut region = self.cut(path, rule); + region.transform(inverse); self.clip = Some(region); + let shown = std::mem::take(&mut self.shown); + self.shown = shown + .iter() + .map(|p| { + let mut p = p.clone(); + p.apply_affine(inverse); + p + }) + .collect(); + // Outline and clip strokes in pattern space before applying its affine. Moving + // just their centerlines first kept 2pt strokes at 2pt under a 20% pattern scale; + // scaling by one mean factor would still distort nonuniform/sheared patterns. + let spaces = (self.to_art, self.grad_space, self.canvas, self.instance_space); + self.to_art *= *xf; + self.grad_space *= *xf; + self.canvas *= *xf; + self.instance_space *= *xf; self.nest += 1; self.drawn += 1; for t in &tiles { @@ -1508,6 +1534,8 @@ impl<'a> Writer<'a> { self.end_group("U", xy); self.nest -= 1; self.clip = outer; + self.shown = shown; + (self.to_art, self.grad_space, self.canvas, self.instance_space) = spaces; } Paint::None => {} } diff --git a/crates/eps/src/ai_editing/writer/images.rs b/crates/eps/src/ai_editing/writer/images.rs index 408827663f..7731eb0e9e 100644 --- a/crates/eps/src/ai_editing/writer/images.rs +++ b/crates/eps/src/ai_editing/writer/images.rs @@ -430,7 +430,7 @@ impl Writer<'_> { } /// `[a b c d tx ty]`, each number to ten decimals ([`ps::num`] writes four). -fn matrix(m: Affine) -> String { +pub(super) fn matrix(m: Affine) -> String { let n: Vec = m.as_coeffs().iter().map(|v| precise(*v)).collect(); format!("[{}]", n.join(" ")) } diff --git a/crates/eps/src/ai_editing/writer/paints.rs b/crates/eps/src/ai_editing/writer/paints.rs index f1573c39ba..d65224042b 100644 --- a/crates/eps/src/ai_editing/writer/paints.rs +++ b/crates/eps/src/ai_editing/writer/paints.rs @@ -367,7 +367,12 @@ impl Writer<'_> { /// Does a plain line of `s`'s paint draw it ([`Self::direct`], and the line style operators can /// write it)? pub(super) fn direct_stroke(&self, s: &StrokeLayer) -> bool { - self.direct(&s.paint) && stroke::is_plain(s) + let [a, b, c, d, ..] = self.to_art.as_coeffs(); + // Operators receive transformed path coordinates, but their width is in art units. + // A non-isometric map needs the stroke's outline transformed too (including in masks, + // whose dictionary temporarily clears the clipping region of a pattern fallback). + let isometry = (a * a + b * b - 1.0).abs() < 1e-9 && (c * c + d * d - 1.0).abs() < 1e-9 && (a * c + b * d).abs() < 1e-9; + isometry && self.direct(&s.paint) && stroke::is_plain(s) } /// `n`'s paint `items` as one path object paints: no paint, a fill, a plain line, or both, the @@ -576,10 +581,10 @@ impl Writer<'_> { /// Can pattern `name` be written as a definition and painted with from here: the document has /// it, its tiles make a grid, its art is within its tile and holds something, and it isn't used - /// in another pattern's tile or a symbol's art (the reader keeps no symbol whose art paints with - /// a pattern) or nested more than [`MAX_NEST`] deep? + /// in another pattern's tile or nested more than [`MAX_NEST`] deep? A large canvas's symbol + /// art uses the original document, whose same-name tiles can differ from the reduced page's. pub(super) fn pattern_writable(&self, name: &str) -> bool { - if !self.defining.is_empty() || self.nest >= MAX_NEST || self.in_symbol { + if !self.defining.is_empty() || self.nest >= MAX_NEST || (self.in_symbol && !self.symbols_live) { return false; } if self.patterns.find(name).is_some() { @@ -605,7 +610,14 @@ impl Writer<'_> { let doc = self.doc; // The tile's box is an object of the definition ([`Self::take_objects`]). let (before, bound) = (self.charges(), self.bound.len()); - let Some(def) = doc.pattern(name).filter(|_| self.take_objects(1)) else { return false }; + let Some(def) = doc.pattern(name) else { return false }; + // A pattern is a separate global resource, even when first discovered in symbol art. + // Charge its objects outside the symbol-art budget and isolate parent dictionaries. + let in_symbol = std::mem::take(&mut self.in_symbol); + if !self.take_objects(1) { + self.in_symbol = in_symbol; + return false; + } self.defining.push(name.to_string()); // The art is written in the pattern's space, y up, from the state a definition starts in. let saved = ( @@ -617,6 +629,7 @@ impl Writer<'_> { self.block_end, // The tile's masks' objects are written with their art styles, those of no other art. (std::mem::replace(&mut self.styled, self.pattern_styled.get(name).cloned().unwrap_or_default()), self.mask_level.take()), + (in_symbol, self.root_entries.take(), self.instance_entries.take(), self.block_start), ); // `Bg` places a gradient in a pattern's tile as on the canvas, mirrored top to bottom: its // placement is worked out in the tile's space turned y up. @@ -647,6 +660,7 @@ impl Writer<'_> { (self.clip, self.shown), self.block_end, (self.styled, self.mask_level), + (self.in_symbol, self.root_entries, self.instance_entries, self.block_start), ) = saved; let art = std::mem::replace(&mut self.body, art); self.defining.pop(); @@ -679,7 +693,18 @@ impl Writer<'_> { return self.plain_color(Color::gray(0.5), stroke); }; let m = self.to_art * xf * Affine::translate((0.0, h)) * Affine::FLIP_Y; - let _ = writeln!(self.body, "{} 0 0 1 1 0 0 0 0 0 {} {}", ps::bytes(name.as_bytes()), ps::matrix(m), if stroke { 'P' } else { 'p' }); + let written = Affine::new(m.as_coeffs().map(|v| (v * 1e10).round() / 1e10)); + // Keep a definition's reference readable after serialization; a singular or rounded-flat + // paint must not make the reader discard the entire symbol that contains it. + if !written.as_coeffs().iter().all(|v| v.is_finite()) || !written.determinant().is_finite() || written.determinant().abs() < 1e-12 { + self.warn(super::PATTERN_PLACEMENT); + return self.plain_color(Color::gray(0.5), stroke); + } + // Indirect pattern paint (for example in brush art) also prevents a live symbol + // instance: the canvas keeps its pattern phase fixed when placing that instance. + self.wrote_pattern = true; + let _ = + writeln!(self.body, "{} 0 0 1 1 0 0 0 0 0 {} {}", ps::bytes(name.as_bytes()), super::images::matrix(m), if stroke { 'P' } else { 'p' }); } /// The definitions, in the setup before the palette: the gradients the art uses (`n Bn`, then diff --git a/crates/eps/src/ai_editing/writer/symbols.rs b/crates/eps/src/ai_editing/writer/symbols.rs index a616d748d1..815268d39c 100644 --- a/crates/eps/src/ai_editing/writer/symbols.rs +++ b/crates/eps/src/ai_editing/writer/symbols.rs @@ -19,6 +19,9 @@ pub(in crate::ai_editing) const SYMBOL_CHANGES: &str = "the changes of dynamic symbol instances are kept in dictionary entries of their own, which other apps leave out"; pub(crate) const DYNAMIC_KEY: &str = "VectorCraftDynamicSymbol"; pub(crate) const OVERRIDES_KEY: &str = "VectorCraftSymbolOverrides"; +/// Version 1 declares that pattern matrices in this definition use its art coordinates. +/// Foreign definitions without that declaration retain the reader's conservative fallback. +pub(crate) const PATTERN_SPACE_KEY: &str = "VectorCraftSymbolPatternSpace"; const MAX_OVERRIDES_BYTES: usize = 1 << 20; pub(crate) fn hex_decode(s: &str) -> Option> { @@ -311,6 +314,9 @@ impl Writer<'_> { if wrap { self.line("u"); self.node(root); + if self.symbols_live && self.wrote_pattern { + let _ = writeln!(entries, "%_1 /Int ({PATTERN_SPACE_KEY}) ,"); + } let _ = write!(self.body, "U\n%_/ArtDictionary :\n{entries}%_;\n%_\n9 () XW\n"); } else { // A group always writes its dictionary ([`Self::dictionary`]), which takes the entries. diff --git a/crates/eps/src/import/ai/read/directives.rs b/crates/eps/src/import/ai/read/directives.rs index 4c5b48c04d..67c6a47db2 100644 --- a/crates/eps/src/import/ai/read/directives.rs +++ b/crates/eps/src/import/ai/read/directives.rs @@ -631,8 +631,12 @@ impl<'a> Reader<'a> { let measured = read.is_ok() && !open && sub.unsupported.is_empty() && sub.unknown.is_empty() && sub.frames.len() == 1; let Some(frame) = sub.frames.pop().filter(|_| measured) else { return }; let mut kids = frame.children; - // Where a symbol's art puts a pattern's tiles isn't known. - let whole = !head.left_out && sub.unread.is_empty() && sub.hidden_unread.is_empty() && !kids.iter().any(|n| paints_pattern(n, 0)); + // Unmarked foreign symbols do not declare the coordinate convention of their patterns. + // Our writer explicitly declares symbol-art space, so those definitions can retain paint. + let whole = !head.left_out + && sub.unread.is_empty() + && sub.hidden_unread.is_empty() + && (head.pattern_space || !kids.iter().any(|n| paints_pattern(n, 0))); if !whole { let boxes = self.doc.symbol_boxes(); let bounds = kids.iter().fold(None, |acc, n| vectorcraft_geom::union_opt(acc, n.visual_bounds_with(&boxes))); diff --git a/crates/eps/src/import/ai/read/document.rs b/crates/eps/src/import/ai/read/document.rs index 20102b29c4..35dd700e6c 100644 --- a/crates/eps/src/import/ai/read/document.rs +++ b/crates/eps/src/import/ai/read/document.rs @@ -805,6 +805,12 @@ impl<'a> Reader<'a> { { head.dynamic = true; } + if self.frames.len() == 1 + && let Some(head) = self.symbol.as_mut() + && o.nums(crate::ai_editing::PATTERN_SPACE_KEY).first().copied() == Some(1.0) + { + head.pattern_space = true; + } if let Some(text) = o.text(crate::ai_editing::OVERRIDES_KEY) && let Some(bytes) = crate::ai_editing::hex_decode(&text) && let Ok(list) = serde_json::from_slice::>(&bytes) diff --git a/crates/eps/src/import/ai/read/types.rs b/crates/eps/src/import/ai/read/types.rs index 27eb8a8576..2e4d19bff7 100644 --- a/crates/eps/src/import/ai/read/types.rs +++ b/crates/eps/src/import/ai/read/types.rs @@ -245,6 +245,8 @@ pub(super) struct SymbolHead { /// `AI13PatternRegistrationType` in the dictionary after the art. pub(super) registration: Option, pub(super) dynamic: bool, + /// The writer declares its pattern matrices to be in symbol-art coordinates (version 1). + pub(super) pattern_space: bool, /// Art the reader left out (type, a placed file, non-native art, an image it can't read or /// place, a gradient it can't read): the symbol isn't kept, and its instances come in as the /// page draws them, within the box of the rest. diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 75f47d7a1c..f5d5642861 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -137,8 +137,12 @@ private editing data. VectorCraft: symbols with 9-slice guides or pattern paint, instances in pattern tiles or in art cut to a clipping object, instances scaled almost flat, instances that turn, mirror or scale symbols holding type, live objects, instances written as their art, shapes with rounded live corners or strokes written as outlines or brush art, - instances that scale their symbol more than 100 times and instances on the layers of a large canvas are written as their art, pattern fills in a - symbol's art are written as their tiles cut to the shape, symbols past 4,096 are written only as their + instances that scale their symbol more than 100 times and instances on the layers of a large canvas are written as their art. Pattern fills in + large-canvas symbol art are written as their tiles cut to the shape. On normal canvases, supported pattern + fills in symbol definitions retain the shared pattern resource and their affine; VectorCraft declares that + coordinate convention in its own dictionary entry, while unmarked foreign symbol patterns keep the reader's + conservative fallback. Tile fallback transforms stroke outlines with the full pattern affine, including + strokes in opacity masks. Symbols past 4,096 are written only as their instances' art, and symbols' 9-slice guides and export types are left out, each with a warning. A dynamic symbol instance whose only changes of its own are its parts' changes is not written as its art when it otherwise qualifies: it stays a live instance. The symbol's dynamic type and the instance's changes From 613bab46c5dd853ec33da92d647ab830c4c0700c Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Wed, 2 Dec 2026 22:45:34 +0530 Subject: [PATCH 002/115] Locale: numeric and unit fields read Devanagari, Gujarati and other Unicode digits `vectorcraft_doc::units` writes every Unicode decimal digit as ASCII before its unit and arithmetic parser, on craft-i18n's digit data (storytold/craft-libs#198 track 5). One number mixing digit sets is refused, as craft-i18n's parse_number refuses it. ASCII input and display are unchanged. --- Cargo.lock | 1 + Cargo.toml | 2 + crates/doc/Cargo.toml | 2 + crates/doc/src/tests/units.rs | 40 +++++++++++++++++++ crates/doc/src/units.rs | 72 +++++++++++++++++++++++++++++++---- docs/localization-parity.md | 11 +++++- docs/mcp.md | 1 + 7 files changed, 120 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0216e2962..b5a19158fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8660,6 +8660,7 @@ name = "vectorcraft-doc" version = "0.25.1" dependencies = [ "chrono", + "craft-i18n", "craft-image-codecs", "craft-stream-codecs", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 843f9cbb53..0077aa577d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,8 @@ craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ec # SVG parsing, limits, SVGZ and writer (craft-libs#778). craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] } craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +# Digits typed in any script in numeric fields (`vectorcraft_doc::units`). +craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). diff --git a/crates/doc/Cargo.toml b/crates/doc/Cargo.toml index 10adb09199..29ba57adf4 100644 --- a/crates/doc/Cargo.toml +++ b/crates/doc/Cargo.toml @@ -32,6 +32,8 @@ serde_json = { workspace = true } sha2 = { version = "0.10", default-features = false } thiserror = { workspace = true } chrono = { workspace = true } +# Field text in Devanagari, Gujarati and other Unicode digits (`units`). +craft-i18n = { workspace = true } [dev-dependencies] flate2 = { workspace = true } diff --git a/crates/doc/src/tests/units.rs b/crates/doc/src/tests/units.rs index 0258179979..b024bf9008 100644 --- a/crates/doc/src/tests/units.rs +++ b/crates/doc/src/tests/units.rs @@ -303,3 +303,43 @@ fn format_area_formats_and_trims_cleanly() { assert_eq!(Unit::Points.format_area(f64::NAN), "0 pt²"); assert_eq!(Unit::Points.format_area(f64::INFINITY), "0 pt²"); } + +/// Typed in Devanagari or Gujarati digits, a field value reads as its ASCII spelling does: +/// plain numbers, units, picas, arithmetic, percentages and a decimal comma. +#[test] +fn hindi_and_gujarati_digits_read_as_ascii_digits_do() { + let ascii = ["12", "12.5 mm", "-3in", "2p6", "45*2", "10x2 mm", "100pt+25%", "1080/2 px", "13q"]; + let hindi = ["१२", "१२.५ mm", "-३in", "२p६", "४५*२", "१०x२ mm", "१००pt+२५%", "१०८०/२ px", "१३q"]; + let gujarati = ["૧૨", "૧૨.૫ mm", "-૩in", "૨p૬", "૪૫*૨", "૧૦x૨ mm", "૧૦૦pt+૨૫%", "૧૦૮૦/૨ px", "૧૩q"]; + for ((a, h), g) in ascii.iter().zip(hindi).zip(gujarati) { + let want = Unit::Millimeters.parse(a); + assert!(want.is_some(), "`{a}` should read"); + assert_eq!(Unit::Millimeters.parse(h), want, "`{h}` vs `{a}`"); + assert_eq!(Unit::Millimeters.parse(g), want, "`{g}` vs `{a}`"); + } + assert_eq!(crate::parse_number("४५*२"), crate::parse_number("45*2")); + assert_eq!(crate::parse_number("૪૫x૨"), crate::parse_number("45x2")); + assert_eq!(Unit::Millimeters.parse_with_decimal_comma("०,५ mm"), Unit::Millimeters.parse("0.5 mm")); + assert_eq!(Unit::Millimeters.parse_with_decimal_comma("૦,૫"), Unit::Millimeters.parse("0.5")); +} + +/// A grouped thousand is refused in any digits, as `1,000` is, rather than read as 1. +#[test] +fn a_native_digit_thousand_is_refused_like_an_ascii_one() { + assert_eq!(Unit::Millimeters.parse_with_decimal_comma("1,000 mm"), None); + assert_eq!(Unit::Millimeters.parse_with_decimal_comma("१,००० mm"), None); + assert_eq!(Unit::Millimeters.parse_with_decimal_comma("૧,૦૦૦"), None); + assert_eq!(crate::decimal_point("१,०००"), crate::decimal_point("1,000")); +} + +/// One number mixing digit sets is refused, as craft-i18n's `parse_number` refuses it; separate +/// numbers of a sum may each use their own. +#[test] +fn a_number_mixing_digit_sets_reads_as_nothing() { + for text in ["1२", "૧२", "१.5", "૧२.૫ mm", "1,२"] { + assert_eq!(Unit::Points.parse(text), None, "`{text}`"); + assert_eq!(Unit::Points.parse_with_decimal_comma(text), None, "`{text}`"); + assert_eq!(crate::parse_number(text), None, "`{text}`"); + } + assert_eq!(Unit::Points.parse("१२+3"), Unit::Points.parse("12+3")); +} diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index d62c367f25..6241882d01 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -1,3 +1,6 @@ +use std::borrow::Cow; +use std::sync::OnceLock; + use super::{Deserialize, Serialize}; /// Measurement units (display only; the model is always in points). @@ -203,20 +206,24 @@ impl Unit { /// /// Text with more than 128 `+ - * /` signs ([`arithmetic_signs`], a multiplication sign counted /// as `*`) reads as nothing. + /// + /// Digits may be in any script ([`ascii_digits`]): `१२ mm` is `12 mm`, `૪૫*૨` is `45*2`. pub fn parse(self, s: &str) -> Option { if arithmetic_signs(s) > MAX_MEASURE_OPERATORS { return None; } - parse_measure(×_as_asterisks(s), self).filter(|v| v.is_finite()) + let s = ascii_digits(s)?; + parse_measure(×_as_asterisks(&s), self).filter(|v| v.is_finite()) } /// Parse a measurement with decimal points or commas and no input locale. Refuse a /// number that looks like a grouped integer, even when it is part of an expression. pub fn parse_with_decimal_comma(self, text: &str) -> Option { - if text.contains(',') && times_as_asterisks(text).split(['+', '-', '*', '/']).any(thousands_operand) { + let text = ascii_digits(text)?; + if text.contains(',') && times_as_asterisks(&text).split(['+', '-', '*', '/']).any(thousands_operand) { return None; } - self.parse(&decimal_point(text)) + self.parse(&decimal_point(&text)) } /// The value naming this unit in the Units preferences (`points`, `millimeters`, /// `feetInches`). @@ -414,9 +421,57 @@ fn percent(s: &str) -> Option { /// (#3837), and each number of a sum reads its own separator, so `100.5 mm-0,5` (a comma typed /// after the value the field shows) is 100 mm (#5684). A number written with both separators has /// two points once read, so `1,000.5` and `1.234,5` are refused rather than guessed at; so is a -/// number that reads as thousands ([`thousands`]). -pub fn decimal_point(text: &str) -> std::borrow::Cow<'_, str> { - if text.contains(',') && !thousands(text) { text.replace(',', ".").into() } else { text.into() } +/// number that reads as thousands ([`thousands`]). Digits in other scripts come back as ASCII +/// ([`ascii_digits`]), so `१,०००` is refused as `1,000` is; text mixing digit sets in one number +/// comes back as it is, for the parser to refuse. +pub fn decimal_point(text: &str) -> Cow<'_, str> { + let Some(text) = ascii_digits(text) else { return text.into() }; + if text.contains(',') && !thousands(&text) { text.replace(',', ".").into() } else { text } +} + +/// `text` with every Unicode decimal digit (Devanagari `०-९`, Gujarati `૦-૯`, Bengali, +/// Arabic-Indic, full-width, …) written as its ASCII digit, so `१२.५ mm` reads as `12.5 mm`. ASCII +/// text is not copied. Each number (a run of digits, `.` and `,`) must use one digit set, as +/// `craft_i18n::parse_number` requires: `1२` and `૧२` are `None`. Operators, unit suffixes and +/// other characters are left as they are. +fn ascii_digits(text: &str) -> Option> { + if text.is_ascii() { + return Some(text.into()); + } + let mut out = String::with_capacity(text.len()); + // The zero of the digit set of the number being read. + let mut set = None; + for c in text.chars() { + if let Some((zero, value)) = decimal_digit(c) { + if *set.get_or_insert(zero) != zero { + return None; + } + out.push(char::from(b'0' + value)); + } else { + if !matches!(c, '.' | ',') { + set = None; + } + out.push(c); + } + } + Some(out.into()) +} + +/// `c`'s digit set (the code point of its zero) and value, when it is a Unicode decimal digit. +/// Other than ASCII, read through craft-i18n, which knows every set (general category Nd). +fn decimal_digit(c: char) -> Option<(u32, u8)> { + if c.is_ascii_digit() { + return Some((u32::from('0'), (c as u8) - b'0')); + } + if c.is_ascii() { + return None; + } + // A lone character reads as a number only when it is a digit; the format's marks don't matter. + static FORMAT: OnceLock = OnceLock::new(); + let format = FORMAT.get_or_init(|| craft_i18n::Format::from_tag("und")); + let read = format.parse(c.encode_utf8(&mut [0; 4])).ok()?; + let value = (0..10u8).find(|&d| f64::from(d) == read)?; + Some((u32::from(c).checked_sub(u32::from(value))?, value)) } /// Does the operand contain a thousands comma? Check both parts of a compact pica value and @@ -455,9 +510,10 @@ pub fn finite_in_every_unit(pt: f64) -> bool { } /// A unitless field value (percent, degrees, counts) with the same `+ - * /` arithmetic as -/// [`Unit::parse`] (`45*2`, `45x2`, `100/3`); text other than digits, `.` and operators reads as -/// nothing. +/// [`Unit::parse`] (`45*2`, `45x2`, `100/3`, `४५*२`); text other than digits, `.` and operators +/// reads as nothing. pub fn parse_number(s: &str) -> Option { + let s = ascii_digits(s)?; if !s.chars().all(|c| c.is_ascii_digit() || " .+-*/xX×".contains(c)) { return None; } diff --git a/docs/localization-parity.md b/docs/localization-parity.md index fe10d21a97..cbaca7ac56 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-25 · **Change:** patch (Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-02 · **Change:** minor (numeric and unit fields in dialogs and commands read Devanagari, Gujarati and other Unicode digits; previously patch: Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) Per-language status of VectorCraft's interface. How the catalogs work and how to add a language: [`development.md` › Localisation](development.md#localisation). Part of @@ -92,6 +92,14 @@ other mark style; the untranslated report lists a catalog that lacks one of them Native review is still needed, and catalog coverage does not prove that every variable in the UI is translated. +## Number input + +Dialog number and unit fields, and command parameters given as text (MCP, the control channel), read digits in any +script (Devanagari `१२ mm`, Gujarati `૪૫*૨`, Bengali, Arabic-Indic, full-width), with the same units, arithmetic and +decimal comma as ASCII digits (`vectorcraft_doc::units`, on craft-i18n's digit data; storytold/craft-libs#198 +track 5). One number mixing digit sets (`1२`) is refused. The panels' number fields read through the shared craft +reader, which reads Devanagari but not yet Gujarati or Bengali digits: that is a craft-libs change. + ## Not done in any language Locale-aware number and date formats, a right-to-left interface, translated help, and a Traditional Chinese UI @@ -101,6 +109,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| +| 2026-12-02 | minor | Number input: dialog and command number and unit fields read Devanagari, Gujarati and other Unicode digits; a number mixing digit sets is refused (storytold/craft-libs#198 track 5); panel number fields still need the shared craft reader to learn Gujarati and Bengali digits; scores and estimates unchanged | | 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | | 2026-11-12 | minor | Gujarati (`gu`): reviewed by a native speaker; zero/one singular plurals (CLDR); Gujarati craft-fonts faces join the UI fonts; strings added on main since branching translated (4,286 rows) | diff --git a/docs/mcp.md b/docs/mcp.md index 27ec011196..a00f923aa1 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -18485,6 +18485,7 @@ Converter and in its panel (`window.panel {panel: "unitConverter"}`). Neither co `addon.units.convert {value, unit?}` accepts a number, or text with a unit suffix and `+ - * /` arithmetic, where `x`, `X` and `×` multiply as `*` does (`"10mm"`, `"1in/2"`, `"2p6"`, `"1080/2 px"`, `"3cm*50%"`, `"2x3 mm"`, `"13q"`). The command reads an unambiguous decimal comma as a point (`"0,5 mm"`). +Digits may be in any script, one set per number (`"१२ mm"`, `"૪૫*૨"`); `"1२"` is refused. It refuses numbers that look like grouped integers, whether alone (`"1,000 mm"`) or in arithmetic (`"1,500+2"`). Text may contain at most 1024 bytes and 128 `+ - * /` signs (each multiplication sign counts). A number without a suffix is in `unit` (a unit's name, suffix or key: `points`, `picas`, `inches`, `millimeters`, From d998409b075cecc71f626f683273c8233feb23b1 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Thu, 3 Dec 2026 08:35:34 +0530 Subject: [PATCH 003/115] Docs: limit native-digit input to the fields VectorCraft parses itself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fields on the shared craft number field (panels, Character Style Options › Tsume) read through craft's own reader, which lacks Gujarati and Bengali digits until storytold/craft-libs#4872 and a revision bump. --- docs/localization-parity.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/localization-parity.md b/docs/localization-parity.md index cbaca7ac56..88e5219dd0 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-02 · **Change:** minor (numeric and unit fields in dialogs and commands read Devanagari, Gujarati and other Unicode digits; previously patch: Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-02 · **Change:** minor (command parameters and the dialog fields VectorCraft parses itself read Devanagari, Gujarati and other Unicode digits; shared craft number fields (panels, some dialog rows) still lack Gujarati and Bengali; previously patch: Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) Per-language status of VectorCraft's interface. How the catalogs work and how to add a language: [`development.md` › Localisation](development.md#localisation). Part of @@ -94,11 +94,15 @@ translated. ## Number input -Dialog number and unit fields, and command parameters given as text (MCP, the control channel), read digits in any -script (Devanagari `१२ mm`, Gujarati `૪૫*૨`, Bengali, Arabic-Indic, full-width), with the same units, arithmetic and -decimal comma as ASCII digits (`vectorcraft_doc::units`, on craft-i18n's digit data; storytold/craft-libs#198 -track 5). One number mixing digit sets (`1२`) is refused. The panels' number fields read through the shared craft -reader, which reads Devanagari but not yet Gujarati or Bengali digits: that is a craft-libs change. +Command parameters given as text (MCP, the control channel, `addon.units.convert`) and the dialog fields whose text +VectorCraft reads itself through `vectorcraft_doc::units` read digits in any script (Devanagari `१२ mm`, Gujarati +`૪૫*૨`, Bengali, Arabic-Indic, full-width). Units, arithmetic and the decimal comma work as they do with ASCII digits +(on craft-i18n's digit data; storytold/craft-libs#198 track 5). One number mixing digit sets (`1२`) is refused. + +Number fields built on the shared craft number field read through its own reader, which at the pinned craft-libs +revision reads Devanagari but not Gujarati or Bengali digits. That covers the panels and some dialog rows, such as +Character Style Options › Tsume, so `૫` is refused there while `5` works. storytold/craft-libs#4872 widens that +reader; VectorCraft picks it up with a craft-libs revision bump. ## Not done in any language @@ -109,7 +113,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| -| 2026-12-02 | minor | Number input: dialog and command number and unit fields read Devanagari, Gujarati and other Unicode digits; a number mixing digit sets is refused (storytold/craft-libs#198 track 5); panel number fields still need the shared craft reader to learn Gujarati and Bengali digits; scores and estimates unchanged | +| 2026-12-02 | minor | Number input: command parameters given as text and the dialog fields VectorCraft parses itself (`vectorcraft_doc::units`) read Devanagari, Gujarati and other Unicode digits; a number mixing digit sets is refused (storytold/craft-libs#198 track 5); fields on the shared craft number field (panels, some dialog rows such as Character Style Options › Tsume) need storytold/craft-libs#4872 and a revision bump for Gujarati and Bengali; scores and estimates unchanged | | 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | | 2026-11-12 | minor | Gujarati (`gu`): reviewed by a native speaker; zero/one singular plurals (CLDR); Gujarati craft-fonts faces join the UI fonts; strings added on main since branching translated (4,286 rows) | From 940b869f2d21f2277e47b15c066c8e3dd5fa483e Mon Sep 17 00:00:00 2001 From: yoriswind Date: Fri, 4 Dec 2026 00:35:05 -0800 Subject: [PATCH 004/115] Gradients: sample a color into a freeform point --- crates/engine/src/lib.rs | 2 + crates/engine/src/session/documents.rs | 1 + crates/engine/src/tooling.rs | 38 +++++++- crates/tools/src/xform/eyedropper.rs | 51 ++++++++-- crates/ui-egui/src/dialogs/gradient_stop.rs | 101 ++++++++++++++++++-- crates/ui-egui/src/panels/gradient.rs | 10 +- docs/control-protocol.md | 4 +- 7 files changed, 188 insertions(+), 19 deletions(-) diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 31cfe000de..eea2fc6238 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -97,6 +97,8 @@ pub struct Session { /// ([`Session::painting_tool`]); None for a stop of the selection's paint. A pick armed for /// such a stop samples only into a stop selected on that gradient, and otherwise ends. pub(crate) stop_pick: Option, + /// The point and document revision the Eyedropper was armed for. + freeform_point_pick: Option, /// Pointer and key input that came while the tool computed an edit on another thread, each with /// its number and view, made in order once the edit is applied. held_input: std::collections::VecDeque<(u64, tooling::HeldInput, ViewInfo)>, diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rs index 367334a008..031d4567d3 100644 --- a/crates/engine/src/session/documents.rs +++ b/crates/engine/src/session/documents.rs @@ -63,6 +63,7 @@ impl Session { lender: None, back_to_painter: None, stop_pick: None, + freeform_point_pick: None, held_input: Default::default(), input_count: 0, edit_started_by: None, diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 05dde4c156..486564df80 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -10,6 +10,11 @@ use vectorcraft_tools::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind use crate::{EngineError, Prefs, Result, Session}; +pub(crate) struct FreeformPointPick { + document: (u64, u64, u64), + index: usize, +} + /// What a hover's lend decision holds for ([`Session::hover_tool_at`]). #[derive(Clone, Copy, PartialEq)] pub(crate) struct HoverKey { @@ -228,6 +233,7 @@ impl Session { self.tool = self.make_tool(id); // A pick is armed for a stop after its tool is chosen (`note_stop_pick`). self.stop_pick = None; + self.freeform_point_pick = None; if let Some(selection) = text_selection { self.tool.set_option("textSelection", &selection); } @@ -628,7 +634,7 @@ impl Session { appearance_item: self.appearance_item(), constrain_angle: self.prefs.constrain_angle, keyboard_increment: self.prefs.keyboard_increment, - freeform_point: self.selected_freeform_point(), + freeform_point: if self.tool.id() == "eyedropper" { self.pick_freeform_point() } else { self.selected_freeform_point() }, raster_sample: self.prefs.eyedropper.sample_size, preview_bounds: self.prefs.use_preview_bounds, scale_strokes: self.prefs.scale_strokes, @@ -1543,6 +1549,9 @@ impl Session { let sets_pressed = self.press_taken_by(self.tool.id()); self.tool.set_option(key, v); self.note_stop_pick(key, self.tool.id() == "eyedropper"); + if key == "freeformPoint" && self.tool.id() == "eyedropper" { + self.note_freeform_point_pick(v); + } self.tool_set_since_reset = true; self.keep_tool_settings(); self.keep_press_set(before_press, |k| sets_pressed && k == key, sets_pressed); @@ -1639,9 +1648,14 @@ impl Session { }; self.keep_press_set(before_press, |k| values.contains_key(k) && (sets_pressed || shared.contains(&k)), sets_pressed); // The Eyedropper waiting for a Cmd-drag it lent a selection tool to is armed as the active one. - if (active || lender) && values.contains_key("stop") { + if active || lender { let eyedropper = id.unwrap_or(self.tool.id()) == "eyedropper"; - self.note_stop_pick("stop", eyedropper); + if values.contains_key("stop") { + self.note_stop_pick("stop", eyedropper); + } + if eyedropper && let Some(v) = values.get("freeformPoint") { + self.note_freeform_point_pick(v); + } } out } @@ -1667,6 +1681,24 @@ impl Session { } } + fn note_freeform_point_pick(&mut self, option: &Value) { + self.freeform_point_pick = None; + if option.is_string() + && let Some(doc) = self.active() + && let Some(index) = self.selected_freeform_point() + && self.proxy_freeform(!self.fill_active).is_some_and(|(f, _)| index < f.points.len()) + { + self.freeform_point_pick = Some(FreeformPointPick { document: (doc.uid, doc.revision, doc.reverts), index }); + } + } + + /// An index can outlive its point after a deletion or another paint is applied. + fn pick_freeform_point(&self) -> Option { + let pick = self.freeform_point_pick.as_ref()?; + let doc = self.active()?; + self.selected_freeform_point().filter(|&index| index == pick.index && pick.document == (doc.uid, doc.revision, doc.reverts)) + } + /// The tool that took the press under way: the active tool, or the tool that lent a selection /// tool for it (a Cmd-drag), which the dropped press gives its options back to. fn pressed_tool(&self) -> Option<&dyn Tool> { diff --git a/crates/tools/src/xform/eyedropper.rs b/crates/tools/src/xform/eyedropper.rs index 6ef02bfd11..528578d8b7 100644 --- a/crates/tools/src/xform/eyedropper.rs +++ b/crates/tools/src/xform/eyedropper.rs @@ -56,6 +56,8 @@ use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, Tool pub struct EyedropperTool { /// Sampling for the selected gradient stop: the tool to switch back to afterwards. stop: Option, + /// Sampling for the selected freeform point: the tool to switch back to afterwards. + point: Option, /// The Type tool's highlighted range while sampling, including its selection overlay. text_selection: crate::text::TypeTool, /// Brush Options › Key Color (Hue Shift): sample into the dialog, then [`Self::stop`]. @@ -567,8 +569,14 @@ impl Tool for EyedropperTool { } Click::Back(back) => { self.stop = None; + self.point = None; vec![Action::SwitchTool(back)] } + Click::SamplePoint(color, _, index, back) => { + self.point = None; + let params = json!({ "index": index, "stroke": !cx.fill_active, "color": color_json(&color), "keepModel": true }); + vec![Action::Exec("paint.freeform.setPoint".into(), params), Action::SwitchTool(back)] + } Click::MeshPoints(id, points, color) => { let params = json!({ "id": id.0, "points": points, "color": color_json(&color), "keepModel": true }); vec![Action::Exec("object.mesh.setPointColor".into(), params)] @@ -605,6 +613,9 @@ impl Tool for EyedropperTool { let mut options = if selected.get("editing").is_some_and(|v| !v.is_null()) { selected } else { json!({}) }; if let Some(o) = options.as_object_mut() { o.insert("stop".into(), json!(self.stop)); + if let Some(back) = &self.point { + o.insert("freeformPoint".into(), json!(back)); + } o.insert("brushKeyColor".into(), json!(self.brush_key_color)); if let Some(binding) = &self.image_trace_ignore_color { o.insert("imageTraceIgnoreColor".into(), binding.clone()); @@ -621,7 +632,18 @@ impl Tool for EyedropperTool { /// Type tool or a tool that picks mesh points. fn set_option(&mut self, key: &str, value: &Value) { match key { - "stop" => self.stop = value.as_str().map(str::to_string), + "stop" => { + self.stop = value.as_str().map(str::to_string); + if self.stop.is_some() { + self.point = None; + } + } + "freeformPoint" => { + self.point = value.as_str().map(str::to_string); + if self.point.is_some() { + self.stop = None; + } + } "brushKeyColor" => self.brush_key_color = value.as_bool().unwrap_or(false), "imageTraceIgnoreColor" => self.image_trace_ignore_color = (!value.is_null()).then(|| value.clone()), "meshPoints" => self.mesh_points = crate::meshedit::points_of(value), @@ -633,7 +655,7 @@ impl Tool for EyedropperTool { fn check_option(&self, key: &str, value: &Value) -> Result<(), String> { use crate::option_check as c; match key { - "stop" => c::string_or_null(key, value), + "stop" | "freeformPoint" => c::string_or_null(key, value), "brushKeyColor" => c::boolean(key, value), "textSelection" => self.text_selection.check_option(key, value), _ => Err(c::unknown(key)), @@ -663,6 +685,9 @@ impl Tool for EyedropperTool { if key != ToolKey::Escape || !self.picking() { return vec![]; } + if let Some(back) = self.point.take() { + return vec![Action::SwitchTool(back)]; + } if let Some(binding) = self.image_trace_ignore_color.take() { let back = self.stop.take().unwrap_or_else(|| "selection".to_string()); return vec![Action::Dialog("imageTraceIgnoreColor".into(), json!({ "binding": binding, "cancel": true })), Action::SwitchTool(back)]; @@ -678,7 +703,7 @@ impl Tool for EyedropperTool { } fn returns_to(&self) -> Option<&str> { - self.stop.as_deref().filter(|_| !self.brush_key_color && self.image_trace_ignore_color.is_none()) + self.point.as_deref().or_else(|| self.stop.as_deref().filter(|_| !self.brush_key_color && self.image_trace_ignore_color.is_none())) } /// Escape is the tool's while a pick is armed, so it switches back and ends nothing else. @@ -697,9 +722,10 @@ enum Click { ImageTrace(Value), /// Brush Options › Key Color: this color, sampled from this object. BrushKeyColor(Color, NodeId), - /// A pick for a stop of the gradient a tool paints with (the Live Paint Bucket's, the Shape - /// Builder's fill) that is no longer selected switches back to that tool unsampled. + /// The pick's target is no longer valid. Return to the previous tool without sampling. Back(String), + /// This color, sampled from this object, goes to the armed freeform point. + SamplePoint(Color, NodeId, usize, String), /// The fill color goes to these points of this selected gradient mesh. MeshPoints(NodeId, Vec, Color), /// `appearance.copyFrom` this source, with `reverse` or `append` or neither. @@ -715,19 +741,28 @@ impl Click { fn object(&self) -> Option { match self { Click::ImageTrace(_) | Click::Back(_) => None, - Click::BrushKeyColor(_, id) | Click::MeshPoints(id, ..) | Click::CopyFrom(id, _) | Click::Sample { source: id, .. } => Some(*id), + Click::BrushKeyColor(_, id) + | Click::SamplePoint(_, id, ..) + | Click::MeshPoints(id, ..) + | Click::CopyFrom(id, _) + | Click::Sample { source: id, .. } => Some(*id), } } } impl EyedropperTool { - /// Is a gradient stop, Brush Key Color or Image Trace Ignore Color pick armed? + /// Is a gradient stop, freeform point, Brush Key Color or Image Trace Ignore Color pick armed? fn picking(&self) -> bool { - self.stop.is_some() || self.brush_key_color || self.image_trace_ignore_color.is_some() + self.stop.is_some() || self.point.is_some() || self.brush_key_color || self.image_trace_ignore_color.is_some() } /// What a click at `p` with `mods` does, or None when it does nothing. fn click(&self, cx: &ToolContext, p: Point, mods: Mods) -> Option { + if let Some(back) = &self.point { + let Some(index) = cx.freeform_point else { return Some(Click::Back(back.clone())) }; + let (color, source) = sample_at(cx, p)?; + return Some(Click::SamplePoint(color, source, index, back.clone())); + } if let Some(binding) = &self.image_trace_ignore_color { return Some(Click::ImageTrace(binding.clone())); } diff --git a/crates/ui-egui/src/dialogs/gradient_stop.rs b/crates/ui-egui/src/dialogs/gradient_stop.rs index 2ed369d2da..80476fcd1a 100644 --- a/crates/ui-egui/src/dialogs/gradient_stop.rs +++ b/crates/ui-egui/src/dialogs/gradient_stop.rs @@ -510,11 +510,12 @@ fn body(ui: &mut Ui, feed: &Feed, tab: &mut Tab, panel: &mut ColorPanelState, fi Entry::new(Tab::Swatches, tl!("Swatches").to_owned()).icon(IconId::new("swatch-book")), ]; Segmented::new("View", Bind::bound(&mut *tab), &tabs).show(ui); - // A stop's colour can come from the art, as from the Gradient panel's eyedropper. - if !feed.point { - let tip = tl!("Eyedropper: click the art to sample the stop's colour").to_owned(); - filed.eyedropper |= DropperButton::new(tip, Bind::given(false)).show(ui).edit.value() == Some(&true); - } + let tip = if feed.point { + tl!("Eyedropper: click the art to sample the point's colour") + } else { + tl!("Eyedropper: click the art to sample the stop's colour") + }; + filed.eyedropper |= DropperButton::new(tip.to_owned(), Bind::given(false)).show(ui).edit.value() == Some(&true); if *tab == Tab::Color { let (closed, picked) = mode_menu(ui, &feed.shown, panel.mode); outside |= closed; @@ -834,7 +835,10 @@ pub(crate) fn pump(app: &mut VectorcraftApp, ctx: &egui::Context) { } if filed.eyedropper { dialogs.with(|host| host.cancel_by_id(ctx, id)); - crate::panels::gradient::stop_eyedropper(app); + match target { + Target::Stop(..) => crate::panels::gradient::stop_eyedropper(app), + Target::Point(..) => crate::panels::gradient::point_eyedropper(app), + } return; } let updated = selected(app).filter(|target| owner.key.matches(app, target)).zip(app.session.gradient_edit_paints(!owner.key.fill).ok()); @@ -1722,6 +1726,91 @@ mod tests { assert!(!is_open(&app)); } + fn point_sampling_panel() -> (crate::tests::panel_harness::Panel, NodeId, NodeId, usize) { + let mut app = app(); + let target = app.session.active().unwrap().selection.objects[0]; + app.run("file.documentColorMode", json!({"mode": "cmyk"})).unwrap(); + app.run("paint.editGradient", json!({"kind": "freeform"})).unwrap(); + app.run("paint.freeform.addPoint", json!({"at": [150, 150], "color": "#0000ff"})).unwrap(); + let index = app.session.selected_freeform_point().unwrap(); + let source = app.run("shape.rectangle", json!({"x": 230, "y": 80, "width": 60, "height": 80})).unwrap()["id"].as_u64().unwrap(); + app.run("paint.setFill", json!({"color": "#00aa5a", "keepModel": true})).unwrap(); + app.run("select.set", json!({"ids": [target.0]})).unwrap(); + app.run("paint.freeform.selectPoint", json!({"index": index})).unwrap(); + let panel = crate::tests::panel_harness::Panel::new(app, |app, ui| { + app.dialogs().unwrap().with(|host| host.run(ui)); + host::pump(app, ui.ctx()); + }); + (panel, target, NodeId(source), index) + } + + fn arm_point_sample(panel: &mut crate::tests::panel_harness::Panel, index: usize) { + open_at(&mut panel.app(), index, Anchor::Screen(egui::pos2(200.0, 200.0))); + panel.frame(); + panel.click("Eyedropper: click the art to sample the point's colour"); + assert!(!is_open(&panel.app())); + assert_eq!(panel.app().session.tool_id(), "eyedropper"); + } + + fn click_sample_source(app: &mut VectorcraftApp) { + use vectorcraft_tools::{PointerEvent, PointerKind}; + let view = app.view_info(); + for kind in [PointerKind::Down, PointerKind::Up] { + let requests = app.session.pointer(&PointerEvent::new(kind, 250.0, 115.0), view).unwrap(); + crate::canvas::apply_requests(app, Ok(requests)); + } + } + + fn node_fill(app: &VectorcraftApp, id: NodeId) -> Paint { + app.session.active().unwrap().doc.node(id).unwrap().appearance.fill_paint() + } + + #[test] + fn freeform_point_eyedropper_preserves_the_sample_model_and_undoes_once() { + let (mut panel, target, source, index) = point_sampling_panel(); + let initial = node_fill(&panel.app(), target); + let source_fill = node_fill(&panel.app(), source); + let color = source_fill.color().unwrap(); + assert!(matches!(color, Color::Rgb { .. }), "the source stores RGB in a CMYK document"); + let points = |app: &VectorcraftApp| app.session.proxy_freeform(false).unwrap().0.points; + let mut expected = points(&panel.app()); + assert_ne!(expected[index].color, color); + + arm_point_sample(&mut panel, index); + click_sample_source(&mut panel.app()); + assert_eq!(panel.app().session.tool_id(), "gradient"); + expected[index].color = color; + assert_eq!(points(&panel.app()), expected, "only the point's color changes"); + assert_eq!(node_fill(&panel.app(), source), source_fill); + panel.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(node_fill(&panel.app(), target), initial); + } + + #[test] + fn freeform_point_eyedropper_cancels_and_skips_a_replaced_point() { + let (mut panel, target, source, index) = point_sampling_panel(); + let initial = node_fill(&panel.app(), target); + let source_fill = node_fill(&panel.app(), source); + + arm_point_sample(&mut panel, index); + let escape = egui::Event::Key { key: Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }; + let ctx = ctx(&panel.app()); + crate::tests::synthetic::key_frame(&mut panel.app(), &ctx, vec![escape]); + assert_eq!(panel.app().session.tool_id(), "gradient"); + assert_eq!(node_fill(&panel.app(), target), initial); + + arm_point_sample(&mut panel, index); + panel.app().run("paint.freeform.deletePoint", json!({"index": index})).unwrap(); + let replacement = panel.app().run("paint.freeform.addPoint", json!({"at": [155, 150], "color": "#ffa000"})).unwrap(); + assert_eq!(replacement["index"].as_u64(), Some(index as u64), "the replacement uses the old index"); + let before_pick = node_fill(&panel.app(), target); + assert_eq!(panel.app().session.tool_id(), "eyedropper"); + click_sample_source(&mut panel.app()); + assert_eq!(panel.app().session.tool_id(), "gradient"); + assert_eq!(node_fill(&panel.app(), target), before_pick); + assert_eq!(node_fill(&panel.app(), source), source_fill); + } + #[test] fn the_popover_closes_when_its_stop_goes_away() { let mut app = app(); diff --git a/crates/ui-egui/src/panels/gradient.rs b/crates/ui-egui/src/panels/gradient.rs index 9d6088cbd3..08025b0731 100644 --- a/crates/ui-egui/src/panels/gradient.rs +++ b/crates/ui-egui/src/panels/gradient.rs @@ -915,10 +915,18 @@ fn stops_editor(app: &mut VectorcraftApp, ui: &mut Ui, g: &GradientPaint, is_gra /// selected stop, then hands back to the current tool (or, while a pick is already armed, to the /// tool that armed it). pub(crate) fn stop_eyedropper(app: &mut VectorcraftApp) { + gradient_eyedropper(app, "stop"); +} + +pub(crate) fn point_eyedropper(app: &mut VectorcraftApp) { + gradient_eyedropper(app, "freeformPoint"); +} + +fn gradient_eyedropper(app: &mut VectorcraftApp, option: &str) { let tool = app.session.tool_id(); let back = (tool == "eyedropper").then(|| app.session.tool_returns_to()).flatten().unwrap_or_else(|| tool.to_string()); app.select_tool("eyedropper"); - app.session.set_tool_option("stop", &json!(back)); + app.session.set_tool_option(option, &json!(back)); } /// Open the stop popover for stop `i` at screen position `at`, the stop selected first. diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 71e3d0fae9..5fe0d3ab01 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -187,7 +187,9 @@ or point selected, it paints the inactive Fill or Stroke. Freeform gradients: double-clicking a point with the Gradient tool opens the same `gradientStop` popover on the selected point (`paint.freeform.selectPoint`); its fields are `color` (hex), `opacity` and `spread` (percentages), applied by -`ui.dialog.confirm` through `paint.freeform.setPoint`. `ui.key` Escape ends the line Lines mode is drawing. +`ui.dialog.confirm` through `paint.freeform.setPoint`. Its eyedropper chooses the Eyedropper tool and sets the +`freeformPoint` option to the tool to return to. The next click on art samples its color into the same point if it +is still current. Escape cancels a pick and switches back. When drawing a line, `ui.key` Escape ends that line. Tool options: double-clicking a tool button runs `tool.options {tool}`. For `gradient` it opens the Gradient panel; for `eyedropper` it opens Eyedropper Options, an `eyedropperOptions` dialog (fields `sampleSize` 1/3/5, `pickUp` and From 68e41fd516c07881e739d6e375224fdd80bd6cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20William=20Concei=C3=A7=C3=A3o?= Date: Wed, 11 Nov 2026 18:12:08 +0000 Subject: [PATCH 005/115] G5: built-in Impact Bursts brush library --- crates/engine/src/cmd/brushlib.rs | 66 +++++++++++++++++++ crates/engine/src/tests/brushlib.rs | 8 +++ crates/ui-egui/src/i18n/bg.tsv | 7 ++ crates/ui-egui/src/i18n/bs.tsv | 7 ++ crates/ui-egui/src/i18n/ca.tsv | 7 ++ crates/ui-egui/src/i18n/cs.tsv | 7 ++ crates/ui-egui/src/i18n/da.tsv | 7 ++ crates/ui-egui/src/i18n/de.tsv | 7 ++ crates/ui-egui/src/i18n/el.tsv | 7 ++ crates/ui-egui/src/i18n/es.tsv | 7 ++ crates/ui-egui/src/i18n/fi.tsv | 7 ++ crates/ui-egui/src/i18n/fr.tsv | 8 +++ crates/ui-egui/src/i18n/hi.tsv | 7 ++ crates/ui-egui/src/i18n/hu.tsv | 7 ++ crates/ui-egui/src/i18n/id.tsv | 7 ++ crates/ui-egui/src/i18n/it.tsv | 7 ++ crates/ui-egui/src/i18n/ja.tsv | 7 ++ crates/ui-egui/src/i18n/ka.tsv | 7 ++ crates/ui-egui/src/i18n/ko.tsv | 7 ++ crates/ui-egui/src/i18n/nl.tsv | 7 ++ crates/ui-egui/src/i18n/pl.tsv | 7 ++ crates/ui-egui/src/i18n/pt-br.tsv | 7 ++ crates/ui-egui/src/i18n/ru.tsv | 7 ++ crates/ui-egui/src/i18n/sv.tsv | 7 ++ crates/ui-egui/src/i18n/tr.tsv | 7 ++ crates/ui-egui/src/i18n/uk.tsv | 7 ++ crates/ui-egui/src/i18n/vi.tsv | 7 ++ crates/ui-egui/src/i18n/zh-hans.tsv | 7 ++ crates/ui-egui/src/i18n/zh-hant.tsv | 7 ++ .../src/panels/tests_brush_libraries.rs | 1 + docs/gaps.md | 2 +- docs/mcp.md | 2 +- docs/roadmap.md | 2 +- docs/target-app-parity.md | 2 +- 34 files changed, 269 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/brushlib.rs b/crates/engine/src/cmd/brushlib.rs index d777e31a45..7c61945a63 100644 --- a/crates/engine/src/cmd/brushlib.rs +++ b/crates/engine/src/cmd/brushlib.rs @@ -184,6 +184,7 @@ pub const BUILTIN: &[BuiltinBrushLibrary] = &[ BuiltinBrushLibrary { id: "game-trails", name: "Game Trails", make: game_trails }, BuiltinBrushLibrary { id: "energy-beams", name: "Energy Beams", make: energy_beams }, BuiltinBrushLibrary { id: "dry-media", name: "Dry Media", make: dry_media }, + BuiltinBrushLibrary { id: "impact-bursts", name: "Impact Bursts", make: impact_bursts }, BuiltinBrushLibrary { id: "tech-circuit", name: "Tech Circuit", make: tech_circuit }, BuiltinBrushLibrary { id: "engraving", name: "Engraving", make: engraving }, BuiltinBrushLibrary { id: "arrows", name: "Arrows", make: arrows }, @@ -1218,6 +1219,71 @@ pub(crate) fn dry_media() -> BrushLibrary { // ---------- commands ---------- + +/// Impact Bursts: art brushes for hit sparks, shocks and crack strokes (original game VFX art). +fn impact_bursts() -> BrushLibrary { + let star = group(vec![ + black(polygon(&[(0.0, 0.0), (100.0, -8.0), (88.0, 0.0), (100.0, 8.0)])), + black(polygon(&[(12.0, 0.0), (70.0, -14.0), (62.0, 0.0), (70.0, 14.0)])), + black(polygon(&[(20.0, 0.0), (48.0, -18.0), (42.0, 0.0), (48.0, 18.0)])), + black(polygon(&[(28.0, 0.0), (40.0, -10.0), (36.0, 0.0), (40.0, 10.0)])), + ]); + let ring_shock = + group(vec![ring(Point::new(50.0, 0.0), 18.0, 14.0), ring(Point::new(50.0, 0.0), 28.0, 25.0), ring(Point::new(50.0, 0.0), 38.0, 36.0)]); + let slash = { + let n = 40; + let half = |x: f64| { + let t = x / 100.0; + let arch = 10.0 * (t * std::f64::consts::PI).sin(); + 1.4 + 2.2 * (1.0 - (t - 0.5).abs() * 2.0).max(0.0) + arch * 0.05 + }; + let mid = |x: f64| 8.0 * ((x / 100.0) * std::f64::consts::PI).sin() - 4.0; + let xs = |i: usize| 100.0 * i as f64 / n as f64; + let mut pts: Vec = (0..=n).map(xs).map(|x| Point::new(x, mid(x) - half(x))).collect(); + pts.extend((0..n).rev().map(xs).map(|x| Point::new(x, mid(x) + half(x)))); + PathData::single(SubPath::polyline(&pts, true)) + }; + let spark_fan = group(vec![ + black(polygon(&[(0.0, 0.0), (55.0, -16.0), (48.0, -12.0)])), + black(polygon(&[(0.0, 0.0), (70.0, -6.0), (62.0, -2.0)])), + black(polygon(&[(0.0, 0.0), (100.0, 0.0), (90.0, 2.0)])), + black(polygon(&[(0.0, 0.0), (70.0, 6.0), (62.0, 2.0)])), + black(polygon(&[(0.0, 0.0), (55.0, 16.0), (48.0, 12.0)])), + black(polygon(&[(0.0, 0.0), (35.0, -10.0), (30.0, -6.0)])), + black(polygon(&[(0.0, 0.0), (35.0, 10.0), (30.0, 6.0)])), + ]); + let debris = group(vec![ + black(shapes::rectangle(Rect::new(4.0, -3.0, 12.0, 1.0))), + black(polygon(&[(18.0, 2.0), (28.0, -2.0), (30.0, 4.0)])), + black(shapes::rectangle(Rect::new(36.0, -4.0, 44.0, -1.0))), + black(polygon(&[(50.0, 1.0), (58.0, 5.0), (62.0, -2.0)])), + black(shapes::rectangle(Rect::new(68.0, -2.0, 78.0, 2.0))), + black(polygon(&[(82.0, -4.0), (90.0, -1.0), (88.0, 3.0)])), + black(shapes::rectangle(Rect::new(92.0, 0.0, 100.0, 3.0))), + ]); + let crack = band(100.0, 1.4, 48, |x| { + let t = (x / 8.0).floor(); + let local = (x / 8.0) - t; + let amp = if (t as i32) % 3 == 0 { + 5.0 + } else if (t as i32) % 3 == 1 { + -3.5 + } else { + 2.0 + }; + if (t as i32) % 2 == 0 { amp * local } else { amp * (1.0 - local) } + }); + let brushes = vec![ + art("Star Burst", star, Colorization::Tints), + art("Ring Shock", ring_shock, Colorization::Tints), + art("Slash Arc", black(slash), Colorization::Tints), + art("Spark Fan", spark_fan, Colorization::Tints), + art("Debris Spray", debris, Colorization::Tints), + art("Crack Line", black(crack), Colorization::Tints), + ]; + built("Impact Bursts", Document::new(100.0, 100.0), brushes) +} + fn builtin_info(b: &BuiltinBrushLibrary) -> LibraryInfo { LibraryInfo { id: b.id.into(), name: b.name.into(), category: "builtIn" } } diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs index 2e809eaed9..a7e649fc9e 100644 --- a/crates/engine/src/tests/brushlib.rs +++ b/crates/engine/src/tests/brushlib.rs @@ -204,6 +204,7 @@ fn every_builtin_library_brush_has_its_kind_and_draws() { ("game-trails", "art"), ("energy-beams", "art"), ("dry-media", "art"), + ("impact-bursts", "art"), ("arrows", "art"), ("image-brush", "scatter"), ("artistic", "art"), @@ -1319,3 +1320,10 @@ fn a_library_file_that_repeats_a_brush_name_loads_with_the_later_one_numbered() let size = |b: Brush| if let BrushKind::Calligraphic(c) = b.kind { c.size } else { 0.0 }; assert_eq!(size(brush(&s, "Nib 2")), 2.0); } + + let impact = run(&mut s, "brush.library", json!({"library": "impact-bursts"})); + assert_eq!( + impact["brushes"].as_array().unwrap().iter().map(|b| b["name"].as_str().unwrap()).collect::>(), + ["Star Burst", "Ring Shock", "Slash Arc", "Spark Fan", "Debris Spray", "Crack Line"] + ); + assert_eq!((libs[14]["name"].as_str(), libs[14]["count"].as_u64()), (Some("Impact Bursts"), Some(6))); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index f4f97b728c..d6afe61141 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7575,6 +7575,13 @@ axis Y Axis Y ос Plasma Arc Плазмена дъга Charge Wave Вълна на заряд Spark Trail Следа от искри + Impact Bursts Ударни избухвания + Star Burst Звезден взрив + Ring Shock Пръстенов шок + Slash Arc Дъгова резка + Spark Fan Ветрило от искри + Debris Spray Пръскане отломки + Crack Line Линия на пукнатина Calligraphic Nibs Калиграфски писци Bristle Brushes Четки с косъм Fine Liner Тънък контур diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index b125e378f5..abd219d97b 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6959,6 +6959,13 @@ axis Y Axis Y osa Plasma Arc Plazma luk Charge Wave Talas naboja Spark Trail Trag iskri + Impact Bursts Udarne eksplozije + Star Burst Zvjezdani prasak + Ring Shock Prstenasti šok + Slash Arc Luk reza + Spark Fan Lepeza iskri + Debris Spray Prskanje krhotina + Crack Line Linija pukotine Calligraphic Nibs Kaligrafski vrhovi Bristle Brushes Četkice s čekinjama Fine Liner Tanka linija diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index ac6c435613..364b1292fa 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -391,6 +391,13 @@ antiAlias Sharp Nítid Plasma Arc Arc de plasma Charge Wave Ona de càrrega Spark Trail Estela d'espurnes + Impact Bursts Explosions d’impacte + Star Burst Explosió estel·lar + Ring Shock Xoc anular + Slash Arc Arc de tall + Spark Fan Ventall d’espurnes + Debris Spray Ruixat de runa + Crack Line Línia d’esquerda Art using a deleted global swatch keeps its colour. L’art que utilitza una mostra global suprimida conserva el seu color. Artboard Tauler Artboard Options Opcions del tauler diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index e2ad7a7d71..b51550748a 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7828,6 +7828,13 @@ axis Y Axis osa Y Plasma Arc Plazmový oblouk Charge Wave Nabíjecí vlna Spark Trail Jiskrová stopa + Impact Bursts Rázové výbuchy + Star Burst Hvězdný výbuch + Ring Shock Prstencový šok + Slash Arc Oblouk seku + Spark Fan Vějíř jisker + Debris Spray Sprška úlomků + Crack Line Linie trhliny Calligraphic Nibs Kaligrafická pera Bristle Brushes Štětinové štětce Fine Liner Jemná linka diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 88948a328d..6ee94687d3 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9936,6 +9936,13 @@ axis Y Axis Y-akse Plasma Arc Plasmabue Charge Wave Opladningsbølge Spark Trail Gnistsvær + Impact Bursts Stødudbrud + Star Burst Stjerneudbrud + Ring Shock Ringchok + Slash Arc Hugbue + Spark Fan Gnistvifte + Debris Spray Debris-sprøjt + Crack Line Revnelinje Calligraphic Nibs Kalligrafiske penne Bristle Brushes Børstepensler Fine Liner Fin streg diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 2999862096..ad2c2e393d 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7409,6 +7409,13 @@ axis Y Axis Y-Achse Plasma Arc Plasmabogen Charge Wave Ladewelle Spark Trail Funkenspur + Impact Bursts Aufprall-Bursts + Star Burst Sternburst + Ring Shock Ringschock + Slash Arc Slash-Bogen + Spark Fan Funkenfächer + Debris Spray Trümmerspray + Crack Line Risslinie Calligraphic Nibs Kalligrafie-Federn Bristle Brushes Borstenpinsel-Set Fine Liner Feiner Liner diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 3396a06dab..eeb8fcdb85 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7822,6 +7822,13 @@ axis Y Axis Άξονας Y Plasma Arc Τόξο πλάσματος Charge Wave Κύμα φόρτισης Spark Trail Ίχνος σπινθήρων + Impact Bursts Εκρήξεις κρούσης + Star Burst Αστρική έκρηξη + Ring Shock Δακτυλιοειδές σοκ + Slash Arc Τόξο κοπής + Spark Fan Βεντάλια σπινθήρων + Debris Spray Ψεκασμός συντριμμιών + Crack Line Γραμμή ρωγμής Calligraphic Nibs Καλλιγραφικές πένες Bristle Brushes Πινέλα με τρίχες Fine Liner Λεπτή γραμμή diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 55e2ae101d..9ee4ff3349 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7808,6 +7808,13 @@ axis Y Axis Eje Y Plasma Arc Arco de plasma Charge Wave Onda de carga Spark Trail Estela de chispas + Impact Bursts Estallidos de impacto + Star Burst Estallido estelar + Ring Shock Choque anular + Slash Arc Arco de tajo + Spark Fan Abanico de chispas + Debris Spray Rocío de escombros + Crack Line Línea de grieta Calligraphic Nibs Plumillas caligráficas Bristle Brushes Pinceles de cerdas Fine Liner Delineador fino diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 1116fcc5c6..0ee8a35fa4 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7899,6 +7899,13 @@ axis Y Axis Y-akseli Plasma Arc Plasma-kaari Charge Wave Latausaalto Spark Trail Kipinävanne + Impact Bursts Iskupurkaukset + Star Burst Tähtipurkaus + Ring Shock Rengasshokki + Slash Arc Viiltokaari + Spark Fan Kipinäviuhka + Debris Spray Romusuihku + Crack Line Halkeamaviiva Calligraphic Nibs Kalligrafiakärjet Bristle Brushes Harjassiveltimet Fine Liner Ohut viiva diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ef77114ade..d2d8adebde 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7824,6 +7824,14 @@ axis Y Axis Axe Y Plasma Arc Arc de plasma Charge Wave Vague de charge Spark Trail Traînée d’étincelles + Spark Trail Traînée d'étincelles + Impact Bursts Éclatements d’impact + Star Burst Éclat d’étoile + Ring Shock Choc annulaire + Slash Arc Arc de taille + Spark Fan Éventail d’étincelles + Debris Spray Gerbe de débris + Crack Line Ligne de fissure Calligraphic Nibs Plumes calligraphiques Bristle Brushes Pinceaux à soies Fine Liner Traceur fin diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 14094a4a60..7dcfb8bfcf 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -736,6 +736,13 @@ antiAlias Sharp शार्प Pause ठहराएँ Skip Next अगला Shuffle क्रमहीन + Impact Bursts प्रभाव विस्फोट + Star Burst तारा विस्फोट + Ring Shock वलय झटका + Slash Arc स्लैश चाप + Spark Fan चिंगारी पंखा + Debris Spray मलबा छिड़काव + Crack Line दरार रेखा Art using a deleted global swatch keeps its colour. हटाए गए ग्लोबल स्वॉच वाला आर्टवर्क अपना रंग बनाए रखता है। Artboard आर्टबोर्ड Artboard {n} of {total} {total} में से आर्टबोर्ड {n} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0bcb97fb7f..9f515d7a4c 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7813,6 +7813,13 @@ axis Y Axis Y tengely Plasma Arc Plazmaív Charge Wave Töltéshullám Spark Trail Szikracsík + Impact Bursts Ütésrobbanások + Star Burst Csillagrobbanás + Ring Shock Gyűrűs sokk + Slash Arc Vágásív + Spark Fan Szikralegyező + Debris Spray Törmelékspriccelés + Crack Line Repedésvonal Calligraphic Nibs Kalligrafikus tollhegyek Bristle Brushes Sörteecsetek Fine Liner Finom kontúr diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index f831b57517..18e830f6c2 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -7718,6 +7718,13 @@ axis Y Axis Sumbu Y Plasma Arc Busur Plasma Charge Wave Gelombang Muatan Spark Trail Jejak Percikan + Impact Bursts Ledakan Benturan + Star Burst Ledakan Bintang + Ring Shock Syok Cincin + Slash Arc Busur Tebasan + Spark Fan Kipas Percikan + Debris Spray Semprotan Puing + Crack Line Garis Retak Calligraphic Nibs Pena kaligrafi Bristle Brushes Kuas-kuas bristle Fine Liner Garis halus diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 32e5cd85d7..2832c51144 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7448,6 +7448,13 @@ axis Y Axis Asse Y Plasma Arc Arco al plasma Charge Wave Onda di carica Spark Trail Scia di scintille + Impact Bursts Scoppi d’impatto + Star Burst Scoppio stellare + Ring Shock Shock anulare + Slash Arc Arco di fendente + Spark Fan Ventaglio di scintille + Debris Spray Spruzzo di detriti + Crack Line Linea di crepa Calligraphic Nibs Pennini calligrafici Bristle Brushes Pennelli a setole Fine Liner Tratto fine diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 04289a09a4..047b6b8f85 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9344,6 +9344,13 @@ axis Y Axis Y 軸 Plasma Arc プラズマアーク Charge Wave チャージウェーブ Spark Trail スパークトレイル + Impact Bursts インパクトバースト + Star Burst スターバースト + Ring Shock リングショック + Slash Arc スラッシュアーク + Spark Fan スパークファン + Debris Spray デブリススプレー + Crack Line クラックライン Calligraphic Nibs カリグラフィペン先 Bristle Brushes 剛毛ブラシ集 Fine Liner 細線ライナー diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 0b034bdcf9..3da1ed4cd1 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9935,6 +9935,13 @@ axis Y Axis Y ღერძი Plasma Arc პლაზმის რკალი Charge Wave მუხტის ტალღა Spark Trail ნაპერწკლის კვალი + Impact Bursts დარტყმის აფეთქებები + Star Burst ვარსკვლავური აფეთქება + Ring Shock რგოლის შოკი + Slash Arc დარტყმის რკალი + Spark Fan ნაპერწკლის მარაო + Debris Spray ნამსხვრევების შპრიცი + Crack Line ბზარის ხაზი Calligraphic Nibs კალიგრაფიული წვერები Bristle Brushes ჯაგრის ფუნჯები Fine Liner წვრილი ხაზი diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 9ed6977dfb..9ac45229bc 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7420,6 +7420,13 @@ axis Y Axis Y축 Plasma Arc 플라즈마 아크 Charge Wave 차지 웨이브 Spark Trail 스파크 트레일 + Impact Bursts 충격 버스트 + Star Burst 스타 버스트 + Ring Shock 링 쇼크 + Slash Arc 슬래시 아크 + Spark Fan 스파크 팬 + Debris Spray 파편 스프레이 + Crack Line 크랙 라인 Calligraphic Nibs 서예 펜촉 Bristle Brushes 강모 브러시 모음 Fine Liner 가는 라이너 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 0ef7948d89..0fd17d8d41 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9780,6 +9780,13 @@ axis Y Axis Y-as Plasma Arc Plasmaboog Charge Wave Laadgolf Spark Trail Vonkenspoor + Impact Bursts Impactbursts + Star Burst Sterburst + Ring Shock Ringshock + Slash Arc Slashboog + Spark Fan Vonkwaaier + Debris Spray Puinspuit + Crack Line Scheurlijn Calligraphic Nibs Kalligrafische penpunten Bristle Brushes Borstelpenselen Fine Liner Fijne liner diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 9eb552d7a4..23303b1f7b 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7681,6 +7681,13 @@ axis Y Axis Oś Y Plasma Arc Łuk plazmowy Charge Wave Fala ładunku Spark Trail Ślad iskier + Impact Bursts Wybuchy uderzenia + Star Burst Rozbłysk gwiazdy + Ring Shock Szok pierścieniowy + Slash Arc Łuk cięcia + Spark Fan Wachlarz iskier + Debris Spray Rozprysk odłamków + Crack Line Linia pęknięcia Calligraphic Nibs Stalówki kaligraficzne Bristle Brushes Pędzle włosiankowe Fine Liner Cienka linia diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index b9f399e3d8..d2ac30dd4b 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7727,6 +7727,13 @@ axis Y Axis Eixo Y Plasma Arc Arco de plasma Charge Wave Onda de carga Spark Trail Rastro de faíscas + Impact Bursts Estouros de impacto + Star Burst Estouro estelar + Ring Shock Choque anelar + Slash Arc Arco de corte + Spark Fan Leque de faíscas + Debris Spray Spray de destroços + Crack Line Linha de rachadura Calligraphic Nibs Penas Caligráficas Bristle Brushes Pincéis de Cerdas Fine Liner Traço Fino diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index b3648d114c..fb46850027 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7452,6 +7452,13 @@ axis Y Axis Ось Y Plasma Arc Плазменная дуга Charge Wave Волна заряда Spark Trail Искра-след + Impact Bursts Ударные вспышки + Star Burst Звёздный взрыв + Ring Shock Кольцевой шок + Slash Arc Дуга удара + Spark Fan Веер искр + Debris Spray Разлёт обломков + Crack Line Линия трещины Calligraphic Nibs Каллиграфические перья Bristle Brushes Щетинные кисти Fine Liner Тонкий лайнер diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index c1b66a1ad0..4201b1187d 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7812,6 +7812,13 @@ axis Y Axis Y-axel Plasma Arc Plasmabåge Charge Wave Laddningsvåg Spark Trail Gnistsvår + Impact Bursts Stötutbrott + Star Burst Stjärnutbrott + Ring Shock Ringchock + Slash Arc Huggbåge + Spark Fan Gnistfjäder + Debris Spray Skräpspray + Crack Line Spricklinje Calligraphic Nibs Kalligrafiska pennspetsar Bristle Brushes Borstpenslar Fine Liner Fin linje diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f037a841b3..b5a97cbed1 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9724,6 +9724,13 @@ axis Y Axis Y ekseni Plasma Arc Plazma Yayı Charge Wave Şarj Dalgası Spark Trail Kıvılcım İzi + Impact Bursts Darbe Patlamaları + Star Burst Yıldız Patlaması + Ring Shock Halka Şoku + Slash Arc Kesik Yay + Spark Fan Kıvılcım Yelpazesi + Debris Spray Enkaz Spreyi + Crack Line Çatlak Çizgisi Calligraphic Nibs Kaligrafi Uçları Bristle Brushes Kıl Fırçalar Fine Liner İnce Çizgi diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 6e3a291eae..8cc635f710 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7430,6 +7430,13 @@ axis Y Axis Вісь Y Plasma Arc Плазмова дуга Charge Wave Хвиля заряду Spark Trail Слід іскор + Impact Bursts Ударні спалахи + Star Burst Зоряний вибух + Ring Shock Кільцевий шок + Slash Arc Дуга удару + Spark Fan Віяло іскор + Debris Spray Розліт уламків + Crack Line Лінія тріщини Calligraphic Nibs Каліграфічні пера Bristle Brushes Щетинні пензлі Fine Liner Тонкий лайнер diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 7da1aa1c06..0f6ed2dddf 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7481,6 +7481,13 @@ axis Y Axis Trục Y Plasma Arc Cung plasma Charge Wave Sóng nạp Spark Trail Vệt tia lửa + Impact Bursts Nổ va chạm + Star Burst Nổ sao + Ring Shock Sốc vòng + Slash Arc Cung chém + Spark Fan Quạt tia lửa + Debris Spray Phun mảnh vụn + Crack Line Đường nứt Calligraphic Nibs Ngòi bút thư pháp Bristle Brushes Bộ cọ lông Fine Liner Nét mảnh diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 7631ba753a..436aec7d2a 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7660,6 +7660,13 @@ axis Y Axis Y 轴 Plasma Arc 等离子弧 Charge Wave 充能波 Spark Trail 火花尾迹 + Impact Bursts 冲击爆发 + Star Burst 星爆 + Ring Shock 环震 + Slash Arc 斩弧 + Spark Fan 火花扇 + Debris Spray 碎片喷溅 + Crack Line 裂纹 Calligraphic Nibs 书法笔尖 Bristle Brushes 鬃毛画笔集 Fine Liner 细勾线笔 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index bd3c03e59d..593bb085e1 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7479,6 +7479,13 @@ axis Y Axis Y 軸 Plasma Arc 電漿弧 Charge Wave 充能波 Spark Trail 火花尾跡 + Impact Bursts 衝擊爆發 + Star Burst 星爆 + Ring Shock 環震 + Slash Arc 斬弧 + Spark Fan 火花扇 + Debris Spray 碎片噴濺 + Crack Line 裂紋 Calligraphic Nibs 書法筆尖 Bristle Brushes 鬃毛筆刷集 Fine Liner 細勾線筆 diff --git a/crates/ui-egui/src/panels/tests_brush_libraries.rs b/crates/ui-egui/src/panels/tests_brush_libraries.rs index 06458f8e4a..5d6a9fef2c 100644 --- a/crates/ui-egui/src/panels/tests_brush_libraries.rs +++ b/crates/ui-egui/src/panels/tests_brush_libraries.rs @@ -139,6 +139,7 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() { json!("game-trails"), json!("energy-beams"), json!("dry-media"), + json!("impact-bursts"), json!("tech-circuit"), json!("engraving"), json!("arrows"), diff --git a/docs/gaps.md b/docs/gaps.md index 6f6dd5f11c..d14d5702d9 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,7 +1,7 @@ # Gaps > Status-bar snapping quick access (#8687, #8779): the bottom right offers Smart Guides, Snap to Point and Snap to Grid toggles plus the same live Snapping menu as the Control bar. Both use existing commands. Framework fit ranks omit the direct group first, then the dropdown, before the existing readouts or core status content narrow. The native buttons expose their current selected state. Scores and estimates are unchanged. -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-02 · **Change:** minor (G12: Retype panel font rows have an item context menu (Apply Font, sample sizes, Reset Retype Panel); scores and estimates unchanged; previously: G12: SVG Interactivity event rows have an item menu (Remove Event, Clear Events, Link JavaScript Files…); scores and estimates unchanged; previously: G12: History row menus adapted to shared Craft list/menu controls after rebase (#8845); scores and estimates unchanged; previously: G12: Document Info panel menu Selection Only (`ui.docInfo.selectionOnly`) counts the selection, and with no artwork selected it shows (No artwork selected) and artboards the Artboard tool has selected still show; scores and estimates unchanged; previously: G12: OpenType panel feature rows have an item context menu (Turn On / Turn Off, Reset OpenType Features); scores and estimates unchanged; previously: G3 lists shadows from the first light and graphics as done and drops angular cut caps, which Revolve's Cap closes, #8312; scores and estimates unchanged; previously: G12/M14: History row context menus, pending-edit snapshot targeting, keyboard access and document-switch dismissal (#8845); scores and estimates unchanged; previously: G3 lists shadows from the first light and graphics as done and drops angular cut caps, which Revolve's Cap closes, #8312; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: G12: Properties panel Quick Actions include contextual text actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged; Gradient stop editor: native Color-tab menu offers the five Color panel modes (#7918); validation pending; scores and estimates unchanged; Layers: hollow diamond and state tooltip distinguish own appearance from targeting and selection (#8710), retaining #8757's ring visibility; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-02 · **Change:** minor (G5: built-in Impact Bursts brush library; previously minor: G12: Retype panel font rows have an item context menu (Apply Font, sample sizes, Reset Retype Panel); scores and estimates unchanged; previously: G12: SVG Interactivity event rows have an item menu (Remove Event, Clear Events, Link JavaScript Files…); scores and estimates unchanged; previously: G12: History row menus adapted to shared Craft list/menu controls after rebase (#8845); scores and estimates unchanged; previously: G12: Document Info panel menu Selection Only (`ui.docInfo.selectionOnly`) counts the selection, and with no artwork selected it shows (No artwork selected) and artboards the Artboard tool has selected still show; scores and estimates unchanged; previously: G12: OpenType panel feature rows have an item context menu (Turn On / Turn Off, Reset OpenType Features); scores and estimates unchanged; previously: G3 lists shadows from the first light and graphics as done and drops angular cut caps, which Revolve's Cap closes, #8312; scores and estimates unchanged; previously: G12/M14: History row context menus, pending-edit snapshot targeting, keyboard access and document-switch dismissal (#8845); scores and estimates unchanged; previously: G3 lists shadows from the first light and graphics as done and drops angular cut caps, which Revolve's Cap closes, #8312; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: G12: Properties panel Quick Actions include contextual text actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged; Gradient stop editor: native Color-tab menu offers the five Color panel modes (#7918); validation pending; scores and estimates unchanged; Layers: hollow diamond and state tooltip distinguish own appearance from targeting and selection (#8710), retaining #8757's ring visibility; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > Panel readout copy (#8432, #8826): Info values and paint names, Links information, and named Document Info rows with no separate value follow the guarded immediate-copy policy landed in #9353. A plain first click copies the full value and reports "Copied the value"; accessible activation copies it too. Selectable readouts retain word selection on double-click, Shift/drag selection and keyboard Copy/Cut. Links Location retains #9521's path fitting and full-path tooltip as static text, with the same full-value primary/accessible copy and a native Copy Location button for keyboard use. Scores and estimates are unchanged. diff --git a/docs/mcp.md b/docs/mcp.md index 85e35043df..e9c227498f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8089,7 +8089,7 @@ error. ## Brush libraries Brush libraries are read-only sets of brushes: fifteen generated in code (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive with Flex Ribbon, Pulse Stroke, Round Flow and Chisel Flow, Bristle -Brushes with one bristle brush for each tip shape, Pattern Borders, Decorative with Leaf Vine, Blossom Chain, Pennant Garland and Lantern String, Scatter Shapes, Stipple with Fine, Dense, Soft and Bold dot textures, Game Trails, Energy Beams, and Dry Media with the Chalk Grain, Graphite Pencil, Wax Crayon and +Brushes with one bristle brush for each tip shape, Pattern Borders, Decorative with Leaf Vine, Blossom Chain, Pennant Garland and Lantern String, Scatter Shapes, Stipple with Fine, Dense, Soft and Bold dot textures, Game Trails, Energy Beams, and Dry Media, Impact Bursts with the Chalk Grain, Graphite Pencil, Wax Crayon and Charcoal Dust art brushes, id `dry-media`, Tech Circuit with Circuit Trace (art), Bus Lines and Terminal Nodes (pattern), id `tech-circuit`, Engraving with Fine Hatching, Dense Hatching, Tapered Hatching and Broken Hatching art brushes, id `engraving`, and Arrows with Solid, Open, Double, Chevron and Dashed Arrow art brushes, id `arrows`), the `.vectorcraft` files in the user library folder of the desktop app (User Defined) and the brushes of any document loaded with `brush.loadLibrary` (a document without brushes of its own has the default ones). `brush.libraries` lists them (`id`, `name`, `category`: `builtIn`, `user` or `loaded`, `count`) and diff --git a/docs/roadmap.md b/docs/roadmap.md index 6c3a02cd1c..adbaa779c1 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,7 +1,7 @@ # Roadmap: milestones and what's next > Status-bar snapping quick access (#8687, #8779): the bottom right offers Smart Guides, Snap to Point and Snap to Grid toggles plus the same live Snapping menu as the Control bar. Both use existing commands. Framework fit ranks omit the direct group first, then the dropdown, before the existing readouts or core status content narrow. The native buttons expose their current selected state. Scores and estimates are unchanged. -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-29 · **Change:** minor (M2: Smart Guides: in a document with more than 20,000 anchors, the snap targets are gathered topmost first, so the objects in front, the newest, keep their anchors, edges and centre as targets for ruler guides, moves, scaling and drawing (#8531); scores and estimates unchanged; previously: M4: `.ai` import: type whose font record keeps no version is set in the installed copy of its font that sets the characters at the widths the file's PDF part gives them (its first 512 characters; without those widths, or with no copy that sets them all, the pick is the one before), #8087; scores and estimates unchanged; previously: G12: History row menus adapted to shared Craft list/menu controls after rebase (#8845); scores and estimates unchanged; previously: G12/M14: History row context menus, pending-edit snapshot targeting, keyboard access and document-switch dismissal (#8845); scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel row context menus, #8809; previously: M1: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: M11: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: M5: In the web build, an edit while the view of a heavy document moves (a tool drag held at an edge of the canvas, #8551, or a wheel scroll during a drag) draws only the part it changed into the last frame, which stays drawn moved with the view, instead of rendering the whole canvas each frame (an edit that changes more than half of the frame, or a change of more than the view and the document, still renders it whole at once), and edits that go on once the view is still don't put off its render (#8688); scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); M11: a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: M4: PDF import: type filled and stroked after a page of type filled only comes in filled and stroked, #8549 follow-up; scores and estimates unchanged; previously: selected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: M4: `.ai` and EPS import: an Art brush in Tints of a swatch-linked stroke color comes in brushed, #8200; scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: M4: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, #8128; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged; Gradient stop editor: native Color-tab menu offers the five Color panel modes (#7918); validation pending; scores and estimates unchanged; Layers: hollow diamond and state tooltip distinguish own appearance from targeting and selection (#8710), retaining #8757's ring visibility; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-29 · **Change:** minor (G5: built-in Impact Bursts brush library; previously minor: M2: Smart Guides: in a document with more than 20,000 anchors, the snap targets are gathered topmost first, so the objects in front, the newest, keep their anchors, edges and centre as targets for ruler guides, moves, scaling and drawing (#8531); scores and estimates unchanged; previously: M4: `.ai` import: type whose font record keeps no version is set in the installed copy of its font that sets the characters at the widths the file's PDF part gives them (its first 512 characters; without those widths, or with no copy that sets them all, the pick is the one before), #8087; scores and estimates unchanged; previously: G12: History row menus adapted to shared Craft list/menu controls after rebase (#8845); scores and estimates unchanged; previously: G12/M14: History row context menus, pending-edit snapshot targeting, keyboard access and document-switch dismissal (#8845); scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel row context menus, #8809; previously: M1: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: M11: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: M5: In the web build, an edit while the view of a heavy document moves (a tool drag held at an edge of the canvas, #8551, or a wheel scroll during a drag) draws only the part it changed into the last frame, which stays drawn moved with the view, instead of rendering the whole canvas each frame (an edit that changes more than half of the frame, or a change of more than the view and the document, still renders it whole at once), and edits that go on once the view is still don't put off its render (#8688); scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); M11: a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: M4: PDF import: type filled and stroked after a page of type filled only comes in filled and stroked, #8549 follow-up; scores and estimates unchanged; previously: selected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: M4: `.ai` and EPS import: an Art brush in Tints of a swatch-linked stroke color comes in brushed, #8200; scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: M4: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, #8128; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged; Gradient stop editor: native Color-tab menu offers the five Color panel modes (#7918); validation pending; scores and estimates unchanged; Layers: hollow diamond and state tooltip distinguish own appearance from targeting and selection (#8710), retaining #8757's ring visibility; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > Panel readout copy (#8432, #8826): Info values and paint names, Links information, and named Document Info rows with no separate value follow the guarded immediate-copy policy landed in #9353. A plain first click copies the full value and reports "Copied the value"; accessible activation copies it too. Selectable readouts retain word selection on double-click, Shift/drag selection and keyboard Copy/Cut. Links Location retains #9521's path fitting and full-path tooltip as static text, with the same full-value primary/accessible copy and a native Copy Location button for keyboard use. Scores and estimates are unchanged. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 95dcc2c098..6191bfbc33 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -3,7 +3,7 @@ Native saves on Unix flush the destination directory after writing or replacing a file. If the directory cannot be flushed, the save returns an error stating that the file was written. > Status-bar snapping quick access (#8687, #8779): the bottom right offers Smart Guides, Snap to Point and Snap to Grid toggles plus the same live Snapping menu as the Control bar. Both use existing commands. Framework fit ranks omit the direct group first, then the dropdown, before the existing readouts or core status content narrow. The native buttons expose their current selected state. Scores and estimates are unchanged. -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-29 · **Change:** minor (Smart Guides: in a document with more than 20,000 anchors, the snap targets are gathered topmost first, so the objects in front, the newest, keep their anchors, edges and centre as targets for ruler guides, moves, scaling and drawing (#8531); scores and estimates unchanged; previously: `.ai` import: type whose font record keeps no version is set in the installed copy of its font that sets the characters at the widths the file's PDF part gives them (its first 512 characters; without those widths, or with no copy that sets them all, the pick is the one before), follows #6983; scores and estimates unchanged; previously: Essentials readiness row: Shape Builder item names its remaining depth, #937's fix unconfirmed on the reporter's file, #8314; scores and estimates unchanged; previously: G12: History row context menus use shared Craft controls, snapshot targeting, keyboard access and document-switch dismissal (#8845); scores and estimates unchanged; previously: G12: Document Info Selection Only counts the selection, and with no artwork selected it shows (No artwork selected) and artboards the Artboard tool has selected still show; scores and estimates unchanged; previously: Pencil Edit Selected Paths follows lifted strokes, carves, loops, closes and redraws compound paths; Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: Text styles panel: right-click item context menus for Character Styles and Paragraph Styles with Options, Duplicate, Delete, Redefine, Clear Overrides; scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: In the web build, an edit while the view of a heavy document moves (a tool drag held at an edge of the canvas, #8551, or a wheel scroll during a drag) draws only the part it changed into the last frame, which stays drawn moved with the view, instead of rendering the whole canvas each frame, and edits that go on once the view is still don't put off its render (#8688); scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: PDF import: type filled and stroked after a page of type filled only comes in filled and stroked, #8549 follow-up; scores and estimates unchanged; previously: selected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: #8200: `.ai` and EPS import: an Art brush in Tints of a swatch-linked stroke color comes in brushed, its tints linked to the swatch; scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side columns; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged; Gradient stop editor: native Color-tab menu offers the five Color panel modes (#7918); validation pending; scores and estimates unchanged; Layers: hollow diamond and state tooltip distinguish own appearance from targeting and selection (#8710), retaining #8757's ring visibility; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-29 · **Change:** minor (G5: built-in Impact Bursts brush library; previously minor: Smart Guides: in a document with more than 20,000 anchors, the snap targets are gathered topmost first, so the objects in front, the newest, keep their anchors, edges and centre as targets for ruler guides, moves, scaling and drawing (#8531); scores and estimates unchanged; previously: `.ai` import: type whose font record keeps no version is set in the installed copy of its font that sets the characters at the widths the file's PDF part gives them (its first 512 characters; without those widths, or with no copy that sets them all, the pick is the one before), follows #6983; scores and estimates unchanged; previously: Essentials readiness row: Shape Builder item names its remaining depth, #937's fix unconfirmed on the reporter's file, #8314; scores and estimates unchanged; previously: G12: History row context menus use shared Craft controls, snapshot targeting, keyboard access and document-switch dismissal (#8845); scores and estimates unchanged; previously: G12: Document Info Selection Only counts the selection, and with no artwork selected it shows (No artwork selected) and artboards the Artboard tool has selected still show; scores and estimates unchanged; previously: Pencil Edit Selected Paths follows lifted strokes, carves, loops, closes and redraws compound paths; Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: Text styles panel: right-click item context menus for Character Styles and Paragraph Styles with Options, Duplicate, Delete, Redefine, Clear Overrides; scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: In the web build, an edit while the view of a heavy document moves (a tool drag held at an edge of the canvas, #8551, or a wheel scroll during a drag) draws only the part it changed into the last frame, which stays drawn moved with the view, instead of rendering the whole canvas each frame, and edits that go on once the view is still don't put off its render (#8688); scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: PDF import: type filled and stroked after a page of type filled only comes in filled and stroked, #8549 follow-up; scores and estimates unchanged; previously: selected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: #8200: `.ai` and EPS import: an Art brush in Tints of a swatch-linked stroke color comes in brushed, its tints linked to the swatch; scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side columns; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged; Gradient stop editor: native Color-tab menu offers the five Color panel modes (#7918); validation pending; scores and estimates unchanged; Layers: hollow diamond and state tooltip distinguish own appearance from targeting and selection (#8710), retaining #8757's ring visibility; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > Panel readout copy (#8432, #8826): Info values and paint names, Links information, and named Document Info rows with no separate value follow the guarded immediate-copy policy landed in #9353. A plain first click copies the full value and reports "Copied the value"; accessible activation copies it too. Selectable readouts retain word selection on double-click, Shift/drag selection and keyboard Copy/Cut. Links Location retains #9521's path fitting and full-path tooltip as static text, with the same full-value primary/accessible copy and a native Copy Location button for keyboard use. Scores and estimates are unchanged. > From 77de863947a5da9f8dc1fa62367fed17f0c7f5bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20William=20Concei=C3=A7=C3=A3o?= Date: Sat, 21 Nov 2026 07:45:50 +0000 Subject: [PATCH 006/115] tests: expect Impact Bursts in built-in brush library ids --- crates/engine/src/tests/brushlib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs index a7e649fc9e..dd91c02ac7 100644 --- a/crates/engine/src/tests/brushlib.rs +++ b/crates/engine/src/tests/brushlib.rs @@ -121,6 +121,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { "game-trails", "energy-beams", "dry-media", + "impact-bursts", "tech-circuit", "engraving", "arrows", From 77a8a0137561eb5c00e493632fdbcfbcccc2895c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 13:04:02 -0800 Subject: [PATCH 007/115] 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 2d0f5f97260abc9b0450e12f7c46af80854837aa Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 14:45:10 -0800 Subject: [PATCH 008/115] DXF Import: a failed DWG Replace keeps the user's selection Placing a DWG drawing with Replace selects the object it swaps again at OK. When the drawing was then not placed (an error while it was read, or Cancel), that object stayed selected and the selection the user made since Place started was lost. - The user's selection comes back with select.set, with its anchors and symbol part, when the read fails or is canceled, unless the document changed since OK (a selection made since then is kept). - Cancel restores the selection of the document the drawing was placed in without switching documents, and not after File > Revert. - The current layer stays current. --- crates/engine/src/session/edit.rs | 16 +++++- crates/ui-egui/src/dialogs/dxf_import.rs | 68 +++++++++++++++++++++++- crates/ui-egui/src/placing.rs | 55 +++++++++++++++++++ 3 files changed, 137 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index 12f8cbe879..1f47de5f91 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -240,8 +240,22 @@ impl Session { fn select_unwatched(&mut self, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> { self.active_appearance_item = None; + let uid = self.doc()?.uid; + self.select_document_unwatched(uid, f) + } + + /// Change the selection in an open document without switching the active document. + pub fn select_in_document(&mut self, uid: u64, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> { + if self.active().is_some_and(|st| st.uid == uid) { + return self.select(f); + } + self.select_document_unwatched(uid, f) + } + + /// Apply the selection filters and update the editing state of document `uid`. + fn select_document_unwatched(&mut self, uid: u64, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> { let menu = self.menu.clone(); - let st = self.doc_mut()?; + let st = self.document_mut(uid).ok_or(EngineError::NoDocument)?; let before = st.selection.objects.clone(); let new_art = st.selection.new_art.clone(); let record = if st.selection_record().is_some() { st.selection_record.take() } else { None }; diff --git a/crates/ui-egui/src/dialogs/dxf_import.rs b/crates/ui-egui/src/dialogs/dxf_import.rs index a01076a838..d7e4390bc7 100644 --- a/crates/ui-egui/src/dialogs/dxf_import.rs +++ b/crates/ui-egui/src/dialogs/dxf_import.rs @@ -504,14 +504,19 @@ fn confirm(app: &mut VectorcraftApp, source: &Source, choices: &DxfChoices) -> R // Where new art goes now is taken before Replace selects the object it swaps again. let current = placement.and_then(|_| crate::placing::Insertion::of(app)); // A drawing converted off the UI thread replaces the object selected when Place - // started, selected again, unless it changed meanwhile. + // started, selected again, unless it changed meanwhile. When the drawing is not placed, + // the user's selection comes back. + let mut user_selection = None; if let Some((old, node)) = placement.and_then(|pl| pl.replaced.as_ref()) { let st = app.session.doc().map_err(|e| e.to_string())?; if st.doc.node(*old) != Some(node) { return Err("replace: the object to replace was changed or deleted".into()); } if st.selection.objects != [*old] || st.selection.symbol_part.is_some() { + let user = st.selection.clone(); app.session.execute("select.set", &json!({ "ids": [old.0] })).map_err(|e| e.to_string())?; + let st = app.session.doc().map_err(|e| e.to_string())?; + user_selection = Some(crate::placing::Reselect { doc: st.uid, revision: st.revision, user }); } } // It goes where new art went when Place started, and what the user changed since is @@ -524,11 +529,18 @@ fn confirm(app: &mut VectorcraftApp, source: &Source, choices: &DxfChoices) -> R if let Some(converted) = &source.converted { app.placing.keep_next = Some(Box::new(converted.held.clone())); } + app.placing.select_on_failure = user_selection.clone(); let r = crate::place::run_for_user(app, &p).map(|_| ()); app.placing.keep_next = None; + app.placing.select_on_failure = None; if let (Some(current), Some(insertion)) = (current, restore) { current.restore_changed(&insertion, app); } + if r.is_err() + && let Some(back) = &user_selection + { + crate::placing::reselect(app, back); + } r } None => { @@ -1003,6 +1015,60 @@ mod tests { crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap(); assert!(app.opening.converting.is_empty()); assert!(app.ui.status.contains("select the one object to replace"), "{}", app.ui.status); + // A Replace that fails keeps the selection the user made since Place started. + let replaced = rect(&mut app, 90.0); + crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap(); + let selected_since = rect(&mut app, 130.0); + finish_conversions(&mut app); + set(&app, "layout", json!("No such layout")); + let undo = undo_steps(&app, first); + let _ = host::confirm(&mut app, KIND); + placed(&mut app); + assert!(app.ui.status.contains("no layout"), "{}", app.ui.status); + let st = app.session.doc().unwrap(); + assert!(st.doc.node(replaced).is_some(), "the object is not replaced"); + assert_eq!(st.selection.objects, vec![selected_since], "the selection made since Place started is kept"); + assert_eq!(undo_steps(&app, first), undo); + host::cancel(&app, KIND); + // A selection made while the drawing is read is kept too. + crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap(); + rect(&mut app, 170.0); + finish_conversions(&mut app); + set(&app, "layout", json!("No such layout")); + let _ = host::confirm(&mut app, KIND); + app.run("select.set", json!({ "ids": [replaced.0] })).unwrap(); + placed(&mut app); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![replaced], "the selection made since OK is kept"); + host::cancel(&app, KIND); + // Selecting the replacement target again after OK keeps that selection on failure. + crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap(); + rect(&mut app, 210.0); + finish_conversions(&mut app); + set(&app, "layout", json!("No such layout")); + let _ = host::confirm(&mut app, KIND); + app.run("select.set", json!({ "ids": [replaced.0] })).unwrap(); + placed(&mut app); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![replaced], "the target selected again since OK is kept"); + host::cancel(&app, KIND); + // Cancel restores the source document's selection while another document stays active. + crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap(); + let selected_since = rect(&mut app, 250.0); + finish_conversions(&mut app); + set(&app, "layout", json!("No such layout")); + let _ = host::confirm(&mut app, KIND); + let other_index = app.session.documents().iter().position(|st| st.uid == other).unwrap(); + let undo = undo_steps(&app, first); + app.session.set_active(other_index); + let other_selection = app.session.doc().unwrap().selection.clone(); + assert_eq!(crate::placing::cancel_all(&mut app)["cancelled"], 1); + assert_eq!(app.session.doc().unwrap().uid, other); + assert_eq!(app.session.doc().unwrap().selection, other_selection); + let st = app.session.documents().iter().find(|st| st.uid == first).unwrap(); + assert_eq!(st.selection.objects, vec![selected_since], "Cancel restores the background document's selection"); + assert_eq!(st.history.undo.len(), undo); + host::cancel(&app, KIND); + let first_index = app.session.documents().iter().position(|st| st.uid == first).unwrap(); + app.session.set_active(first_index); // Closed meanwhile. crate::place::run_for_user(&mut app, &json!({ "path": plan })).unwrap(); app.session.execute("file.close", &json!({})).unwrap(); diff --git a/crates/ui-egui/src/placing.rs b/crates/ui-egui/src/placing.rs index a1eeb20879..a3ee2d62a9 100644 --- a/crates/ui-egui/src/placing.rs +++ b/crates/ui-egui/src/placing.rs @@ -184,6 +184,19 @@ pub struct Pending { pub(crate) started: f64, /// What stays alive until this entry is removed ([`Placing::keep_next`]). _keep: Option>, + /// The selection its document gets back when the file is not placed ([`Placing::select_on_failure`]). + select_on_failure: Option, +} + +/// The user's selection, which a Replace swapped for the object it replaces ([`Placing::select_on_failure`]). +#[derive(Clone)] +pub(crate) struct Reselect { + /// The document whose selection Replace changed. + pub(crate) doc: u64, + /// The document's revision after Replace selected its object. + pub(crate) revision: u64, + /// The user's selection before it. + pub(crate) user: vectorcraft_doc::Selection, } #[cfg(test)] @@ -202,6 +215,10 @@ pub struct Placing { /// dropped: the conversion of a DWG drawing placed through its import options, which the read /// then finds without converting the drawing again. pub(crate) keep_next: Option>, + /// The selection the next read started ([`spawn_labeled`]) gives its document back when its + /// file is not placed: the user's selection before a DWG drawing's Replace selected the object + /// it swaps again. + pub(crate) select_on_failure: Option, /// A deferred paste awaiting its own Swatch Conflict dialog. swatch_paste: Option, /// Set by unit tests whose app reads the files the user places off the UI thread. @@ -432,6 +449,7 @@ fn spawn_labeled( app.placing.lane.push(&*jobs, "vectorcraft-place", job); let started = crate::export_progress::now(app); let keep = app.placing.keep_next.take(); + let select_on_failure = app.placing.select_on_failure.take(); app.placing.pending.push(Pending { name, label: label.clone(), @@ -446,6 +464,7 @@ fn spawn_labeled( hidden: false, started, _keep: keep, + select_on_failure, }); let status = format!("{label}…"); app.status(status.clone()); @@ -559,6 +578,11 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result) { Ok(Read::Paste(paste)) => return finish_paste(app, *paste), Err(e) => Err(e), }; + if r.is_err() + && let Some(back) = &p.select_on_failure + { + reselect(app, back); + } app.sync_views(); let name = &p.name; match r { @@ -568,6 +592,32 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result) { } } +/// Restore the user's selection while the document's revision is unchanged and its objects still exist. +/// The selection filters apply, and the current layer and active document stay current. +pub(crate) fn reselect(app: &mut VectorcraftApp, back: &Reselect) { + let Some(st) = app.session.documents().iter().find(|st| st.uid == back.doc) else { return }; + if st.revision != back.revision || !back.user.objects.iter().all(|id| st.doc.node(*id).is_some()) { + return; + } + let layer = st.active_layer; + let r = if app.session.active().is_some_and(|st| st.uid == back.doc) { + let ids: Vec = back.user.objects.iter().map(|id| id.0).collect(); + app.session.execute("select.set", &json!({ "ids": ids })).map(|_| ()) + } else { + app.session.select_in_document(back.doc, |_, sel| sel.set(back.user.objects.iter().copied())) + }; + if let Err(e) = r { + app.status(e.to_string()); + return; + } + if let Some(st) = app.session.document_mut(back.doc) { + if st.selection.objects == back.user.objects { + st.selection = back.user.clone(); + } + st.active_layer = layer; + } +} + /// Run a paste whose bitmap was decoded off the UI thread, in its document, which is the active one: /// the image replaces the internal clipboard, the objects selected when the paste started are /// selected again, and the paste command runs as it runs at once ([`VectorcraftApp::run`]), into @@ -846,6 +896,11 @@ pub fn cancel_all(app: &mut VectorcraftApp) -> Value { if !app.placing.pending[i].paste { let p = app.placing.pending.remove(i); p.token.cancel(); + if let Some(back) = &p.select_on_failure + && app.session.documents().iter().any(|st| st.uid == p.doc && st.reverts == p.reverts) + { + reselect(app, back); + } if app.ui.status == format!("{}…", p.label) { app.ui.status.clear(); } From 308e672673669c94c5ab6b66149999c05f3e672a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 15:28:47 -0800 Subject: [PATCH 009/115] DXF Import: a restored selection goes through the selection filters When a DWG Replace fails or is canceled, the user's whole selection now goes back through the selection filters as they are at that moment: ruler guides locked since are left out, hidden or locked slices stay out, and new art on a locked artboard is selected again as new art. Before, only the object ids went through the filters and the guides and slices were copied back, while new art on a locked artboard was dropped. Session::restore_selection gives a document back a saved selection through those filters. The dxf_import test that covers a selection made after OK now selects a different object instead of the Replace target. --- crates/engine/src/session/edit.rs | 10 +++++++ crates/ui-egui/src/dialogs/dxf_import.rs | 4 +-- crates/ui-egui/src/placing.rs | 14 ++------- crates/ui-egui/src/placing/tests.rs | 37 ++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index 1f47de5f91..c299347654 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -252,6 +252,16 @@ impl Session { self.select_document_unwatched(uid, f) } + /// Give document `uid` back a selection it had, new art included, through the selection + /// filters as they are now: guides locked since, hidden or locked slices and art on a locked + /// artboard that is not new art are left out. + pub fn restore_selection(&mut self, uid: u64, selection: Selection) -> Result<()> { + let st = self.document_mut(uid).ok_or(EngineError::NoDocument)?; + st.selection_record = None; + st.selection = selection; + self.select_in_document(uid, |_, _| {}) + } + /// Apply the selection filters and update the editing state of document `uid`. fn select_document_unwatched(&mut self, uid: u64, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> { let menu = self.menu.clone(); diff --git a/crates/ui-egui/src/dialogs/dxf_import.rs b/crates/ui-egui/src/dialogs/dxf_import.rs index d7e4390bc7..737623f09e 100644 --- a/crates/ui-egui/src/dialogs/dxf_import.rs +++ b/crates/ui-egui/src/dialogs/dxf_import.rs @@ -1036,9 +1036,9 @@ mod tests { finish_conversions(&mut app); set(&app, "layout", json!("No such layout")); let _ = host::confirm(&mut app, KIND); - app.run("select.set", json!({ "ids": [replaced.0] })).unwrap(); + app.run("select.set", json!({ "ids": [selected_since.0] })).unwrap(); placed(&mut app); - assert_eq!(app.session.doc().unwrap().selection.objects, vec![replaced], "the selection made since OK is kept"); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![selected_since], "the selection made since OK is kept"); host::cancel(&app, KIND); // Selecting the replacement target again after OK keeps that selection on failure. crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap(); diff --git a/crates/ui-egui/src/placing.rs b/crates/ui-egui/src/placing.rs index a3ee2d62a9..8bb2d58cce 100644 --- a/crates/ui-egui/src/placing.rs +++ b/crates/ui-egui/src/placing.rs @@ -593,27 +593,19 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result) { } /// Restore the user's selection while the document's revision is unchanged and its objects still exist. -/// The selection filters apply, and the current layer and active document stay current. +/// The whole selection, guides, slices and new art included, goes through the selection filters as +/// they are now, and the current layer and active document stay current. pub(crate) fn reselect(app: &mut VectorcraftApp, back: &Reselect) { let Some(st) = app.session.documents().iter().find(|st| st.uid == back.doc) else { return }; if st.revision != back.revision || !back.user.objects.iter().all(|id| st.doc.node(*id).is_some()) { return; } let layer = st.active_layer; - let r = if app.session.active().is_some_and(|st| st.uid == back.doc) { - let ids: Vec = back.user.objects.iter().map(|id| id.0).collect(); - app.session.execute("select.set", &json!({ "ids": ids })).map(|_| ()) - } else { - app.session.select_in_document(back.doc, |_, sel| sel.set(back.user.objects.iter().copied())) - }; - if let Err(e) = r { + if let Err(e) = app.session.restore_selection(back.doc, back.user.clone()) { app.status(e.to_string()); return; } if let Some(st) = app.session.document_mut(back.doc) { - if st.selection.objects == back.user.objects { - st.selection = back.user.clone(); - } st.active_layer = layer; } } diff --git a/crates/ui-egui/src/placing/tests.rs b/crates/ui-egui/src/placing/tests.rs index dc6a19e0fc..434f47e51e 100644 --- a/crates/ui-egui/src/placing/tests.rs +++ b/crates/ui-egui/src/placing/tests.rs @@ -2060,3 +2060,40 @@ fn cancelling_a_place_places_nothing() { assert_eq!(names(&app), initial_names, "no document nodes mutated or added"); assert_eq!(app.session.doc().unwrap().history.undo.len(), 0, "no undo step added"); } + +/// The selection a failed Replace gives back, after the object it swaps was selected in its place. +fn swapped_out(app: &mut VectorcraftApp, other: NodeId) -> Reselect { + let user = app.session.doc().unwrap().selection.clone(); + app.run("select.set", json!({"ids": [other.0]})).unwrap(); + let st = app.session.doc().unwrap(); + Reselect { doc: st.uid, revision: st.revision, user } +} + +#[test] +fn a_restored_selection_leaves_out_guides_locked_since() { + let mut app = app(false); + let other = NodeId(app.run("shape.rectangle", json!({"x": 60, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap()); + app.run("guide.add", json!({"vertical": true, "pos": 40})).unwrap(); + app.run("select.set", json!({"ids": []})).unwrap(); + app.run("guide.select", json!({"indexes": [0]})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.guides.len(), 1, "the ruler guide is selected"); + let mut back = swapped_out(&mut app, other); + app.run("view.guides.lock", json!({"locked": true})).unwrap(); + back.revision = app.session.doc().unwrap().revision; + reselect(&mut app, &back); + assert!(app.session.doc().unwrap().selection.guides.is_empty(), "the locked guide is not selected again"); +} + +#[test] +fn a_restored_selection_keeps_new_art_on_a_locked_artboard() { + let mut app = app(false); + app.run("artboard.setProps", json!({"index": 0, "locked": true})).unwrap(); + let mut rect = |x| NodeId(app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap()); + let (other, drawn) = (rect(60.0), rect(10.0)); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![drawn], "new art is selected"); + let back = swapped_out(&mut app, other); + reselect(&mut app, &back); + let st = app.session.doc().unwrap(); + assert_eq!(st.selection.objects, vec![drawn], "the new art is selected again"); + assert!(st.selection.new_art.contains(&drawn), "it is still new art"); +} From ce0055d8ba079e90ccd039b87bbc314c623fdf7c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 18:48:48 -0800 Subject: [PATCH 010/115] 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 011/115] 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 d9b705640eaa36e59bc3327a6f2b34be06635ac7 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Sat, 5 Dec 2026 10:27:49 +0530 Subject: [PATCH 012/115] Locale: read native digits through craft-i18n's shared helper vectorcraft_doc::units drops its private digit table lookup and uses craft_i18n::ascii_digits (storytold/craft-libs#4872), keeping its own grammar: a number is a run of digits, '.' and ','. Behaviour and tests are unchanged. --- crates/doc/src/units.rs | 46 ++++------------------------------------- 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index 6241882d01..2e4b4e5c1b 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -1,5 +1,4 @@ use std::borrow::Cow; -use std::sync::OnceLock; use super::{Deserialize, Serialize}; @@ -430,48 +429,11 @@ pub fn decimal_point(text: &str) -> Cow<'_, str> { } /// `text` with every Unicode decimal digit (Devanagari `०-९`, Gujarati `૦-૯`, Bengali, -/// Arabic-Indic, full-width, …) written as its ASCII digit, so `१२.५ mm` reads as `12.5 mm`. ASCII -/// text is not copied. Each number (a run of digits, `.` and `,`) must use one digit set, as -/// `craft_i18n::parse_number` requires: `1२` and `૧२` are `None`. Operators, unit suffixes and -/// other characters are left as they are. +/// Arabic-Indic, full-width, …) written as its ASCII digit, so `१२.५ mm` reads as `12.5 mm`. A +/// number here is a run of digits, `.` and `,`, and must use one digit set: `1२` and `૧२` are +/// `None`. Operators, unit suffixes and other characters are left as they are. fn ascii_digits(text: &str) -> Option> { - if text.is_ascii() { - return Some(text.into()); - } - let mut out = String::with_capacity(text.len()); - // The zero of the digit set of the number being read. - let mut set = None; - for c in text.chars() { - if let Some((zero, value)) = decimal_digit(c) { - if *set.get_or_insert(zero) != zero { - return None; - } - out.push(char::from(b'0' + value)); - } else { - if !matches!(c, '.' | ',') { - set = None; - } - out.push(c); - } - } - Some(out.into()) -} - -/// `c`'s digit set (the code point of its zero) and value, when it is a Unicode decimal digit. -/// Other than ASCII, read through craft-i18n, which knows every set (general category Nd). -fn decimal_digit(c: char) -> Option<(u32, u8)> { - if c.is_ascii_digit() { - return Some((u32::from('0'), (c as u8) - b'0')); - } - if c.is_ascii() { - return None; - } - // A lone character reads as a number only when it is a digit; the format's marks don't matter. - static FORMAT: OnceLock = OnceLock::new(); - let format = FORMAT.get_or_init(|| craft_i18n::Format::from_tag("und")); - let read = format.parse(c.encode_utf8(&mut [0; 4])).ok()?; - let value = (0..10u8).find(|&d| f64::from(d) == read)?; - Some((u32::from(c).checked_sub(u32::from(value))?, value)) + craft_i18n::ascii_digits(text, |c| matches!(c, '.' | ',')).ok() } /// Does the operand contain a thousands comma? Check both parts of a compact pica value and From 4faf2fe671a85c17171116c12674edcdd7f4ecf6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 20:57:50 -0800 Subject: [PATCH 013/115] 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 014/115] 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 015/115] 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 016/115] 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 9d8ecd1341de0afde2ff1d12dbcd625324d6932e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 22:35:37 -0800 Subject: [PATCH 017/115] DXF Import: a failed Replace restores the selection after unrelated edits The user's selection came back only while the document revision was unchanged, so a Replace whose rollback raised the revision, or any edit that left the selection alone, kept the swapped object selected. DocState now counts selection changes (`selections`): every Session::select, Undo and Redo, leaving isolation, and any command or batch step that leaves another selection. A failed command that selected its ids first puts the count back with the selection. The selection comes back when the count, the selection, the isolation and the user's objects are unchanged; a symbol part needs the art unchanged. --- crates/engine/src/cmd/edit.rs | 2 + crates/engine/src/cmd/object/arrange.rs | 2 + crates/engine/src/doc_state.rs | 4 + crates/engine/src/session/edit.rs | 1 + crates/engine/src/session/execute.rs | 29 +++- crates/engine/src/session/undo.rs | 2 + crates/ui-egui/src/dialogs/dxf_import.rs | 9 +- crates/ui-egui/src/placing.rs | 26 +++- crates/ui-egui/src/placing/tests.rs | 164 ++++++++++++++++++++++- 9 files changed, 228 insertions(+), 11 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 55726c31c9..52330c1dde 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -835,6 +835,7 @@ fn undo(s: &mut Session, _: &Value) -> Result { let doc = std::mem::replace(&mut st.doc, e.doc); keep_unrecorded(&doc, &e.unrecorded, &mut st.doc); let selection = std::mem::replace(&mut st.selection, Arc::unwrap_or_clone(e.selection)); + st.selections = st.selections.wrapping_add(1); let selection = shared_selection(selection, st.history.redo.last()); let mut turned = crate::HistoryEntry::turned(e.label, doc, selection, &st.doc, costs); turned.named = e.named; @@ -873,6 +874,7 @@ fn redo(s: &mut Session, _: &Value) -> Result { let doc = std::mem::replace(&mut st.doc, e.doc); keep_unrecorded(&doc, &e.unrecorded, &mut st.doc); let selection = std::mem::replace(&mut st.selection, Arc::unwrap_or_clone(e.selection)); + st.selections = st.selections.wrapping_add(1); let selection = shared_selection(selection, st.history.undo.last()); let mut turned = crate::HistoryEntry::turned(e.label, doc, selection, &st.doc, costs); turned.named = e.named; diff --git a/crates/engine/src/cmd/object/arrange.rs b/crates/engine/src/cmd/object/arrange.rs index 8ed4656295..f234f4f0b9 100644 --- a/crates/engine/src/cmd/object/arrange.rs +++ b/crates/engine/src/cmd/object/arrange.rs @@ -457,6 +457,7 @@ pub(super) fn exit_isolation(s: &mut Session, p: &Value) -> Result { crate::cmd::distortcmds::finish_edit_text(st, inner); st.isolation = Some(layer); st.selection.set([left]); + st.selections = st.selections.wrapping_add(1); st.revision += 1; return ok(); } @@ -494,6 +495,7 @@ pub(super) fn exit_isolation(s: &mut Session, p: &Value) -> Result { crate::cmd::distortcmds::finish_edit_text(st, i); let target = st.doc.parent_of(left).filter(|p| st.doc.node(*p).is_some_and(|n| n.extras().shaper.is_some())).unwrap_or(left); st.selection.set([target]); + st.selections = st.selections.wrapping_add(1); // A guide path isolated while Lock Guides is on isn't selected (#1534). crate::deselect_hidden(&menu, &st.doc, &mut st.selection); // The art on a locked artboard can't be selected. diff --git a/crates/engine/src/doc_state.rs b/crates/engine/src/doc_state.rs index 501cb6cd53..f31b7f8152 100644 --- a/crates/engine/src/doc_state.rs +++ b/crates/engine/src/doc_state.rs @@ -51,6 +51,9 @@ pub struct DocState { /// Increments on every change (also selection and view-only changes); UIs re-render when it /// moves. Not a dirty flag: see [`DocState::is_dirty`]. pub revision: u64, + /// Increments each time the selection is set through [`crate::Session::select`] and the other + /// selection entries, even when it ends as it was. Not saved, not undoable. + pub selections: u64, /// The document as last saved (or opened). Structural sharing makes "unchanged" a pointer /// comparison, and undoing back to the saved state counts as clean. pub(crate) saved_doc: Arc, @@ -535,6 +538,7 @@ impl DocState { history: History { limit: 500, ..Default::default() }, path, revision: 1, + selections: 0, active_layer, layer_rows: vec![], layers_reveal: None, diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index c299347654..bcb09c0b66 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -306,6 +306,7 @@ impl Session { st.layer_rows.clear(); } st.revision += 1; + st.selections = st.selections.wrapping_add(1); // Puppet Warp pins belong to the art they were placed on: another selection starts afresh. if st.doc.puppet.as_ref().is_some_and(|p| p.ids != st.selection.objects) { cmd::distortcmds::drop_puppet_pins(st); diff --git a/crates/engine/src/session/execute.rs b/crates/engine/src/session/execute.rs index 25a9b278b1..fde26a790d 100644 --- a/crates/engine/src/session/execute.rs +++ b/crates/engine/src/session/execute.rs @@ -24,6 +24,16 @@ fn with_settled_warnings(mut r: Value, settled: &[String]) -> Value { r } +/// What [`Session::execute`] compares to tell that a command changed the selection: the counts of +/// what is selected and the first and last object, guide and slice, read in constant time. +type SelectionSummary = ([usize; 5], [Option; 6], bool); + +fn selection_summary(s: &Selection) -> SelectionSummary { + let counts = [s.objects.len(), s.anchors.len(), s.segments.len(), s.guides.len(), s.slices.len()]; + let ends = [s.objects.first(), s.objects.last(), s.guides.first(), s.guides.last(), s.slices.first(), s.slices.last()].map(|id| id.copied()); + (counts, ends, s.symbol_part.is_some()) +} + impl Session { /// Run a command callback and keep warnings from every preview it settles or restores. pub(crate) fn command_with_settled_warnings(&mut self, f: impl FnOnce(&mut Self) -> Result) -> Result { @@ -72,7 +82,19 @@ impl Session { if self.plugins_loading() && crate::waits_for_plugin_loads(id) { self.finish_plugin_loads(); } - self.revealing(|s| s.execute_unwatched(id, params)) + // A command, a step of a batch included, that leaves the active document with another + // selection counts as a selection change ([`crate::DocState::selections`]), whichever way + // it wrote the selection. The selections are compared by a summary that takes constant time. + let before = self.active().map(|st| (st.uid, st.selections, selection_summary(&st.selection))); + let r = self.revealing(|s| s.execute_unwatched(id, params)); + if let Some((uid, selections, summary)) = before + && let Some(st) = self.document_mut(uid) + && st.selections == selections + && selection_summary(&st.selection) != summary + { + st.selections = st.selections.wrapping_add(1); + } + r } /// Run `f`, a top-level entry that changes the active document's rows, current layer or @@ -230,7 +252,7 @@ impl Session { params.get("ids").filter(|v| !v.is_null()).cloned().or_else(|| given.map(|ids| ids.iter().map(|i| i.0).collect::>().into())) }) .flatten(); - let selected_before = select_first.as_ref().and(self.active()).map(|d| (d.uid, d.selection.clone(), d.active_layer)); + let selected_before = select_first.as_ref().and(self.active()).map(|d| (d.uid, d.selection.clone(), d.active_layer, d.selections)); // Only a selection command that changes the selection loads its paints for new art: other // commands, and clicking what is already selected, keep a sampled paint in the proxies. let selection_was = (id.starts_with("select.") || id == "layer.target").then(|| self.active().map(|d| d.selection.clone())).flatten(); @@ -240,11 +262,12 @@ impl Session { } let r = cmd::run_spec(s, spec, run_params); if r.is_err() - && let Some((uid, selection, layer)) = selected_before + && let Some((uid, selection, layer, selections)) = selected_before && let Some(st) = s.docs.iter_mut().find(|d| d.uid == uid) { st.selection = selection; st.active_layer = layer; + st.selections = selections; st.revision += 1; } r diff --git a/crates/engine/src/session/undo.rs b/crates/engine/src/session/undo.rs index bf7b0bf6f7..946af081fa 100644 --- a/crates/engine/src/session/undo.rs +++ b/crates/engine/src/session/undo.rs @@ -118,6 +118,7 @@ impl Session { } let undone = std::mem::replace(&mut st.doc, e.doc); st.selection = Arc::unwrap_or_clone(e.selection); + st.selections = st.selections.wrapping_add(1); deselect_hidden(&self.menu, &st.doc, &mut st.selection); st.restore_isolation(g.isolation, &undone); st.sync_new_art(); @@ -275,6 +276,7 @@ impl Session { } let undone = std::mem::replace(&mut st.doc, doc); st.selection = selection; + st.selections = st.selections.wrapping_add(1); st.restore_isolation(scope.isolation, &undone); cmd::globaledit::follow_history(st); st.drop_stale_variables_highlight(); diff --git a/crates/ui-egui/src/dialogs/dxf_import.rs b/crates/ui-egui/src/dialogs/dxf_import.rs index 737623f09e..55f35d97ff 100644 --- a/crates/ui-egui/src/dialogs/dxf_import.rs +++ b/crates/ui-egui/src/dialogs/dxf_import.rs @@ -516,7 +516,14 @@ fn confirm(app: &mut VectorcraftApp, source: &Source, choices: &DxfChoices) -> R let user = st.selection.clone(); app.session.execute("select.set", &json!({ "ids": [old.0] })).map_err(|e| e.to_string())?; let st = app.session.doc().map_err(|e| e.to_string())?; - user_selection = Some(crate::placing::Reselect { doc: st.uid, revision: st.revision, user }); + user_selection = Some(crate::placing::Reselect { + doc: st.uid, + swapped: st.selection.clone(), + selections: st.selections, + art: st.doc.clone(), + isolation: st.isolation, + user, + }); } } // It goes where new art went when Place started, and what the user changed since is diff --git a/crates/ui-egui/src/placing.rs b/crates/ui-egui/src/placing.rs index 8bb2d58cce..e27bc07b23 100644 --- a/crates/ui-egui/src/placing.rs +++ b/crates/ui-egui/src/placing.rs @@ -193,8 +193,16 @@ pub struct Pending { pub(crate) struct Reselect { /// The document whose selection Replace changed. pub(crate) doc: u64, - /// The document's revision after Replace selected its object. - pub(crate) revision: u64, + /// The selection Replace made: the object it swaps. + pub(crate) swapped: vectorcraft_doc::Selection, + /// The document's selection count ([`vectorcraft_engine::DocState::selections`]) after it. + /// The user's selection comes back only while neither changed, whatever else was edited. + pub(crate) selections: u64, + /// The art then: the user's selection comes back only while each object it holds is as it + /// was, so that its selected anchors and segments still name the same points. + pub(crate) art: std::sync::Arc, + /// The group or layer isolated then: the user's selection comes back only in the same isolation. + pub(crate) isolation: Option, /// The user's selection before it. pub(crate) user: vectorcraft_doc::Selection, } @@ -592,12 +600,20 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result) { } } -/// Restore the user's selection while the document's revision is unchanged and its objects still exist. -/// The whole selection, guides, slices and new art included, goes through the selection filters as +/// Restore the user's selection while the selection Replace made is unchanged and the user's objects +/// are still there as they were. The whole selection, guides, slices and new art included, goes through the selection filters as /// they are now, and the current layer and active document stay current. pub(crate) fn reselect(app: &mut VectorcraftApp, back: &Reselect) { let Some(st) = app.session.documents().iter().find(|st| st.uid == back.doc) else { return }; - if st.revision != back.revision || !back.user.objects.iter().all(|id| st.doc.node(*id).is_some()) { + let kept = |id: &vectorcraft_doc::NodeId| st.doc.node(*id).is_some_and(|n| back.art.node(*id) == Some(n)); + // A symbol part names a child of the symbol's art, which an edit to the symbol can change. + let part_kept = back.user.symbol_part.is_none() || std::sync::Arc::ptr_eq(&st.doc, &back.art); + if st.selections != back.selections + || st.selection != back.swapped + || st.isolation != back.isolation + || !part_kept + || !back.user.objects.iter().all(kept) + { return; } let layer = st.active_layer; diff --git a/crates/ui-egui/src/placing/tests.rs b/crates/ui-egui/src/placing/tests.rs index 434f47e51e..eef7b0e037 100644 --- a/crates/ui-egui/src/placing/tests.rs +++ b/crates/ui-egui/src/placing/tests.rs @@ -2066,7 +2066,166 @@ fn swapped_out(app: &mut VectorcraftApp, other: NodeId) -> Reselect { let user = app.session.doc().unwrap().selection.clone(); app.run("select.set", json!({"ids": [other.0]})).unwrap(); let st = app.session.doc().unwrap(); - Reselect { doc: st.uid, revision: st.revision, user } + Reselect { doc: st.uid, swapped: st.selection.clone(), selections: st.selections, art: st.doc.clone(), isolation: st.isolation, user } +} + +/// The objects selected before the swap, with two rectangles drawn: the user's and the swapped one. +fn two_rectangles(app: &mut VectorcraftApp) -> (NodeId, NodeId) { + let mut rect = |x| NodeId(app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap()); + let (mine, other) = (rect(10.0), rect(60.0)); + app.run("select.set", json!({"ids": [mine.0]})).unwrap(); + (mine, other) +} + +#[test] +fn a_raised_revision_alone_does_not_block_the_restore() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + let back = swapped_out(&mut app, other); + // The rollback of a failed Replace puts the document back as it was and raises its revision + // (`Session::place_read`), which this does alone. + let uid = app.session.doc().unwrap().uid; + app.session.document_mut(uid).unwrap().revision += 1; + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine], "the user's selection comes back"); +} + +#[test] +fn a_selection_undo_and_redo_gave_back_is_kept() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + app.run("select.set", json!({"ids": [other.0]})).unwrap(); + app.run("artboard.setProps", json!({"index": 0, "name": "Front"})).unwrap(); + app.run("select.set", json!({"ids": [mine.0]})).unwrap(); + let back = swapped_out(&mut app, other); + app.run("edit.undo", json!({})).unwrap(); + app.run("edit.redo", json!({})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "Redo selects the object again"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the selection Redo gave back is kept"); +} + +#[test] +fn a_selection_isolation_gave_back_is_kept() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [mine.0]})).unwrap(); + let back = swapped_out(&mut app, group); + app.run("object.isolate", json!({"id": group.0})).unwrap(); + app.run("object.exitIsolation", json!({})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "leaving isolation selects the group again"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "the selection leaving isolation made is kept"); +} + +#[test] +fn a_selection_a_batch_step_gave_back_is_kept() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [mine.0]})).unwrap(); + let back = swapped_out(&mut app, group); + let steps = json!([{"command": "object.isolate", "params": {"id": group.0}}, {"command": "object.exitIsolation"}]); + app.run("command.batch", json!({"commands": steps})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "leaving isolation selects the group again"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "the selection the batch made is kept"); +} + +#[test] +fn leaving_isolation_onto_the_swapped_group_keeps_it_selected() { + let mut app = app(false); + let (_, other) = two_rectangles(&mut app); + let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap()); + app.run("object.isolate", json!({"id": group.0})).unwrap(); + app.run("select.set", json!({"ids": [other.0]})).unwrap(); + let back = swapped_out(&mut app, group); + app.run("object.exitIsolation", json!({})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "leaving isolation selects the group"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "the selection leaving isolation made is kept"); +} + +#[test] +fn a_selection_a_lock_and_unlock_batch_gave_back_is_kept() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + app.run("select.set", json!({"ids": [mine.0]})).unwrap(); + let back = swapped_out(&mut app, other); + let steps = json!([{"command": "object.lock"}, {"command": "object.unlockAll"}]); + app.run("command.batch", json!({"commands": steps})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "Unlock All selects what it unlocks"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the selection the batch made is kept"); +} + +#[test] +fn a_selection_is_not_restored_into_another_isolation() { + let mut app = app(false); + let (_, other) = two_rectangles(&mut app); + let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": []})).unwrap(); + let mut back = swapped_out(&mut app, group); + app.run("object.isolate", json!({"id": group.0})).unwrap(); + app.run("select.set", json!({"ids": [group.0]})).unwrap(); + let st = app.session.doc().unwrap(); + (back.swapped, back.selections) = (st.selection.clone(), st.selections); + let selected = st.selection.objects.clone(); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, selected, "the selection made in isolation is kept"); +} + +#[test] +fn a_command_that_fails_and_puts_the_selection_back_does_not_block_the_restore() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + let back = swapped_out(&mut app, other); + let far = NodeId(app.run("shape.rectangle", json!({"x": 300, "y": 300, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [other.0]})).unwrap(); + let mut back = back; + let st = app.session.doc().unwrap(); + (back.swapped, back.selections, back.art) = (st.selection.clone(), st.selections, st.doc.clone()); + assert!(app.run("object.pathfinder.intersect", json!({"ids": [other.0, far.0]})).is_err(), "disjoint shapes have no intersection"); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the failed command puts the selection back"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine], "the user's selection comes back"); +} + +#[test] +fn a_symbol_part_is_not_restored_after_an_edit() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + let mut back = swapped_out(&mut app, other); + back.user.symbol_part = Some(vectorcraft_doc::SymbolPart { instance: mine, path: vec![0] }); + app.run("artboard.setProps", json!({"index": 0, "name": "Front"})).unwrap(); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "a part of art that may have changed is not restored"); +} + +#[test] +fn selected_anchors_of_a_reversed_path_are_not_restored() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + app.run("select.anchors", json!({"id": mine.0, "anchors": [[0, 0]], "mode": "set"})).unwrap(); + let back = swapped_out(&mut app, other); + app.run("path.reverse", json!({"ids": [mine.0], "reversed": true})).unwrap(); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the edit keeps the selection"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "anchor numbers of the edited path are not restored"); +} + +#[test] +fn an_edit_that_keeps_the_selection_still_restores_it() { + let mut app = app(false); + let (mine, other) = two_rectangles(&mut app); + let back = swapped_out(&mut app, other); + let revision = app.session.doc().unwrap().revision; + app.run("artboard.setProps", json!({"index": 0, "name": "Front"})).unwrap(); + assert_ne!(app.session.doc().unwrap().revision, revision, "the edit changes the document"); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the edit keeps the selection"); + reselect(&mut app, &back); + assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine], "the user's selection comes back"); } #[test] @@ -2079,7 +2238,8 @@ fn a_restored_selection_leaves_out_guides_locked_since() { assert_eq!(app.session.doc().unwrap().selection.guides.len(), 1, "the ruler guide is selected"); let mut back = swapped_out(&mut app, other); app.run("view.guides.lock", json!({"locked": true})).unwrap(); - back.revision = app.session.doc().unwrap().revision; + let st = app.session.doc().unwrap(); + (back.swapped, back.selections) = (st.selection.clone(), st.selections); reselect(&mut app, &back); assert!(app.session.doc().unwrap().selection.guides.is_empty(), "the locked guide is not selected again"); } From 6d1850e630687a3a42d05d539cafb98d983a5edc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 23:27:33 -0800 Subject: [PATCH 018/115] 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 019/115] 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 020/115] 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 021/115] 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 022/115] 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 52ae4d5dd52f6301b86ee43b8aba839e5bc851eb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 00:51:41 -0800 Subject: [PATCH 023/115] DXF/DWG import: scaled block inserts scale their dashes and polyline widths A named block becomes a symbol whose art is drawn once, at the import's scale, and each insert becomes an instance that carries the insert's scale. Instances leave the strokes in their art unscaled, so a block inserted at scale 10 drew its geometry 10 times larger but kept its linetype dashes and constant-width polylines at scale 1. When a block (or a block it places) draws dashes or wide polylines, its symbol is now made per insert scale, with the art drawn at that scale and the instance taking the rest of the transform. Inserts at one scale share a symbol, and blocks without dashes or wide polylines keep one symbol for every scale. Lineweights are physical widths and stay unscaled. --- crates/cad/src/import/build.rs | 112 ++++++++++++++++++++++++------ crates/cad/src/import/tests.rs | 122 +++++++++++++++++++++++++++++++++ 2 files changed, 213 insertions(+), 21 deletions(-) diff --git a/crates/cad/src/import/build.rs b/crates/cad/src/import/build.rs index 0b3532ca87..870283af2c 100644 --- a/crates/cad/src/import/build.rs +++ b/crates/cad/src/import/build.rs @@ -67,8 +67,12 @@ pub(crate) struct Build<'d, 'a> { blocks: HashMap>>, bounds: HashMap>, sensitive: HashMap, - /// Symbol names by block and what it inherits (`None`: the block has no art). - symbols: HashMap<(String, Inherit), Option>, + /// Symbol names by block, what it inherits and the scale its art is drawn at (the bits of + /// [`symbol_scale`]'s answer; `None`: the block has no art). + symbols: HashMap<(String, Inherit, u64), Option>, + /// Whether a block placed with what it inherits draws dashes or wide polylines, whose + /// lengths and widths follow the insert's scale. + scaled_looks: HashMap<(String, Inherit), bool>, /// Names of the symbols made so far, and the next suffix to try for each label. symbol_names: HashSet, next_suffix: HashMap, @@ -134,6 +138,7 @@ impl<'d, 'a> Build<'d, 'a> { bounds: HashMap::new(), sensitive: HashMap::new(), symbols: HashMap::new(), + scaled_looks: HashMap::new(), symbol_names: HashSet::new(), next_suffix: HashMap::new(), stack: vec![], @@ -597,24 +602,39 @@ impl<'d, 'a> Build<'d, 'a> { let base = self.d.blocks.get(&ins.block).map_or(Point::ZERO, |b| b.base); let unbase = Affine::translate(-base.to_vec2()); let anonymous = ins.block.starts_with('*'); - let symbol = if anonymous { None } else { self.symbol(&ins.block, &child, depth) }; let mut parts = vec![]; + // An array's cells share their scale: the symbol is looked up again only when it changes. + let mut last: Option<(f64, Option<(String, f64)>)> = None; for cell in &ins.cells { - let node = match &symbol { - Some(name) => { - if self.nodes >= MAX_NODES { - self.warn(TOO_MANY); - break; + let node = if anonymous { + self.art(&ins.block, map * *cell * unbase, &child, depth) + } else { + let scale = symbol_scale(map * *cell, self.symbol_map); + let symbol = match &last { + Some((s, symbol)) if s.to_bits() == scale.to_bits() => symbol.clone(), + _ => { + let symbol = self.symbol(&ins.block, &child, scale, depth); + last = Some((scale, symbol.clone())); + symbol } - if !self.charge_text(name.len()) { - break; + }; + match symbol { + Some((name, drawn_at)) => { + if self.nodes >= MAX_NODES { + self.warn(TOO_MANY); + break; + } + if !self.charge_text(name.len()) { + break; + } + // The symbol's art is drawn `drawn_at` times larger than a drawing unit + // at the import's scale; the instance takes the rest of the transform. + let xf = map * *cell * (self.symbol_map * Affine::scale(drawn_at)).inverse(); + self.nodes += 1; + Some(Node::new(self.doc.alloc_id(), NodeKind::SymbolInstance { symbol: name, xf })) } - let xf = map * *cell * self.symbol_map.inverse(); - self.nodes += 1; - Some(Node::new(self.doc.alloc_id(), NodeKind::SymbolInstance { symbol: name.clone(), xf })) + None => None, } - None if anonymous => self.art(&ins.block, map * *cell * unbase, &child, depth), - None => None, }; parts.extend(node); } @@ -664,15 +684,52 @@ impl<'d, 'a> Build<'d, 'a> { } } - /// The symbol for block `name` placed with `inh` (made once per look). - fn symbol(&mut self, name: &str, inh: &Inherit, depth: u32) -> Option { + /// Does block `name` placed with `inh` draw dashes or wide polylines (its own art or that of + /// the blocks it places)? + fn is_scaled_look(&mut self, name: &str, inh: &Inherit, depth: u32) -> bool { + let key = (name.to_string(), inh.clone()); + if let Some(s) = self.scaled_looks.get(&key) { + return *s; + } + let Some(items) = self.block(name) else { return false }; + if !self.enter(name, depth) { + return false; + } + let mut s = false; + for it in items.iter() { + s = match &it.geom { + Geom::Path { fill: true, .. } => false, + Geom::Path { width, .. } => { + *width > 0.0 || self.d.linetypes.get(&self.linetype(&it.props, inh)).is_some_and(|p| p.iter().take(64).any(|v| *v < 0.0)) + } + Geom::Text(_) => false, + Geom::Insert(ins) => { + let child = self.inherit(&it.props, inh); + let child = if self.is_sensitive(&ins.block, depth + 1) { child } else { Inherit::default() }; + self.is_scaled_look(&ins.block, &child, depth + 1) + } + }; + if s { + break; + } + } + self.stack.pop(); + self.scaled_looks.insert(key, s); + s + } + + /// The symbol for block `name` placed with `inh` at `scale` (from [`symbol_scale`]), made + /// once per look, with the scale its art is drawn at: `scale` when the block draws dashes or + /// wide polylines, else 1. + fn symbol(&mut self, name: &str, inh: &Inherit, scale: f64, depth: u32) -> Option<(String, f64)> { let inh = if self.is_sensitive(name, depth) { inh.clone() } else { Inherit::default() }; - let key = (name.to_string(), inh); + let scale = if self.is_scaled_look(name, &inh, depth) { scale } else { 1.0 }; + let key = (name.to_string(), inh, scale.to_bits()); if let Some(s) = self.symbols.get(&key) { - return s.clone(); + return s.clone().map(|s| (s, scale)); } let base = self.d.blocks.get(name).map_or(Point::ZERO, |b| b.base); - let map = self.symbol_map * Affine::translate(-base.to_vec2()); + let map = self.symbol_map * Affine::scale(scale) * Affine::translate(-base.to_vec2()); let art = self.art(name, map, &key.1, depth); let made = art.and_then(|art| { let label = self.d.blocks.get(name).map_or(name, |b| b.name.as_str()); @@ -686,10 +743,23 @@ impl<'d, 'a> Build<'d, 'a> { Some(symbol) }); self.symbols.insert(key, made.clone()); - made + made.map(|s| (s, scale)) } } +/// How much larger than `symbol_map` an insert copy drawn by `placed` is (the square root of the +/// ratio of their areas), rounded to 9 significant digits so that copies at one scale share a +/// symbol; 1 when either is degenerate. +fn symbol_scale(placed: Affine, symbol_map: Affine) -> f64 { + let s = (placed.determinant().abs() / symbol_map.determinant().abs()).sqrt(); + if !(s.is_finite() && s > 0.0) { + return 1.0; + } + let digits = 10f64.powi(8 - s.log10().floor() as i32); + let r = (s * digits).round() / digits; + if r.is_finite() && r > 0.0 { r } else { 1.0 } +} + /// Fit text stretched or squeezed across, aligned text scaled as a whole, to run its span /// (`s`: points per drawing unit), measured in the font it is set in. fn fill_span(obj: &mut TextObject, span: Span, s: f64) { diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index d53694343a..89f6e81ce8 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -858,6 +858,128 @@ fn by_block_colours_make_a_symbol_per_look() { assert_eq!(doc.symbols.len(), 1); } +/// The dash pattern and weight of the stroke of `n` (a path) or its first loop (a compound path). +fn dash_and_weight(n: &Node) -> (Vec, f64) { + let n = match &n.kind { + NodeKind::Path { .. } => n, + _ => n.children().and_then(|c| c.first()).map(|c| &**c).unwrap_or_else(|| panic!("no path: {:?}", n.kind)), + }; + let s = n.appearance.stroke().unwrap_or_else(|| panic!("no stroke: {:?}", n.appearance)); + (s.dash.as_ref().map(|d| d.pattern.clone()).unwrap_or_default(), s.width) +} + +/// The strokes of `inst`'s symbol's art (and of the symbols it places): each path's dash +/// pattern and weight, in paint order. +fn instance_strokes(doc: &Document, inst: &Node) -> Vec<(Vec, f64)> { + let NodeKind::SymbolInstance { symbol, .. } = &inst.kind else { panic!("{:?}", inst.kind) }; + let art = &doc.symbols.iter().find(|s| &s.name == symbol).unwrap().art; + let mut out = vec![]; + let mut walk = vec![art.clone()]; + while let Some(n) = walk.pop() { + match &n.kind { + NodeKind::Path { .. } => out.push(dash_and_weight(&n)), + NodeKind::SymbolInstance { .. } => out.extend(instance_strokes(doc, &n)), + _ => walk.extend(n.children().into_iter().flatten().rev().cloned()), + } + } + out +} + +#[test] +fn scaled_inserts_scale_their_blocks_dashes_and_polyline_widths() { + let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")]; + // "Mark": a dashed line with a 0.5 mm lineweight and a polyline 2 units wide. "Pair" places + // "Mark" at scale 1, so the scale of an insert of "Pair" reaches it. + let blocks = [ + (0, "BLOCK"), + (8, "0"), + (2, "Mark"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "LINE"), + (8, "0"), + (6, "DASHED"), + (370, "50"), + (10, "0"), + (20, "0"), + (11, "100"), + (21, "0"), + (0, "LWPOLYLINE"), + (8, "0"), + (90, "2"), + (70, "0"), + (43, "2"), + (10, "0"), + (20, "10"), + (10, "100"), + (20, "10"), + (0, "ENDBLK"), + (0, "BLOCK"), + (8, "0"), + (2, "Pair"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "INSERT"), + (8, "0"), + (2, "Mark"), + (10, "0"), + (20, "0"), + (0, "ENDBLK"), + ]; + let inserts = [ + (0, "INSERT"), + (2, "Mark"), + (10, "0"), + (20, "0"), + (0, "INSERT"), + (2, "Mark"), + (10, "0"), + (20, "100"), + (41, "10"), + (42, "10"), + (0, "INSERT"), + (2, "Pair"), + (10, "0"), + (20, "300"), + (41, "10"), + (42, "10"), + (0, "INSERT"), + (2, "Mark"), + (10, "0"), + (20, "500"), + (41, "10"), + (42, "10"), + ]; + let doc = open(&drawing(&[], &tables, &blocks, &inserts), &points()).document; + let insts = leaves(&doc); + let [one, ten, nested, ten_again] = &insts[..] else { panic!("{insts:?}") }; + let at_one = instance_strokes(&doc, one); + let [(dash, lw), (no_dash, width)] = &at_one[..] else { panic!("{at_one:?}") }; + assert!(dash.len() >= 2 && no_dash.is_empty() && *width > 0.0, "{at_one:?}"); + // Instances leave the strokes in their art as they are, so the art carries the insert's scale. + let tenfold: Vec = dash.iter().map(|v| v * 10.0).collect(); + for inst in [ten, nested] { + let got = instance_strokes(&doc, inst); + let [(d, w_lw), (_, w)] = &got[..] else { panic!("{got:?}") }; + assert_eq!(d.len(), tenfold.len()); + assert!(d.iter().zip(&tenfold).all(|(a, b)| (a - b).abs() < 1e-9), "dashes {d:?}, want {tenfold:?}"); + assert!((w - width * 10.0).abs() < 1e-9, "polyline width {w}, want {}", width * 10.0); + assert!((w_lw - lw).abs() < 1e-12, "a lineweight is a physical width: {w_lw}, want {lw}"); + } + // The copies still land where their inserts put them. + let NodeKind::SymbolInstance { symbol, xf } = &ten.kind else { panic!() }; + let art = &doc.symbols.iter().find(|s| &s.name == symbol).unwrap().art; + let line = art.children().and_then(|c| c.first()).unwrap(); + let end = *xf * *path_points(line).last().unwrap(); + assert!(end.distance(Point::new(1000.0, height(&doc) - 100.0)) < 1e-6, "{end:?}"); + // Inserts at one scale share a symbol. + let symbol_of = |n: &Node| if let NodeKind::SymbolInstance { symbol, .. } = &n.kind { symbol.clone() } else { panic!() }; + assert_eq!(symbol_of(ten), symbol_of(ten_again)); + assert_ne!(symbol_of(one), symbol_of(ten)); +} + #[test] fn many_by_block_looks_import_in_linear_time() { let by_block: &[(i32, &str)] = &[(0, "LINE"), (8, "0"), (62, "0"), (10, "5"), (20, "5"), (11, "15"), (21, "5")]; From de5582cc836c452188edd85de5bf0f277177788e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 01:49:20 -0800 Subject: [PATCH 024/115] DXF/DWG import: the scale check of blocks skips hidden art and keeps to the work budget The check that decides whether a block's symbol is drawn per insert scale now skips art on hidden layers, which the import does not draw, so a block whose only dashes are hidden keeps one symbol for every scale. The check also counts the items it looks at against the block work budget and stops with the existing warning when the budget runs out. Text in a block drawn at a tiny insert scale is kept: any invertible text transform is accepted, instead of only those above 1e-12 points per unit. --- crates/cad/src/import/build.rs | 26 ++++++- crates/cad/src/import/tests.rs | 126 +++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+), 3 deletions(-) diff --git a/crates/cad/src/import/build.rs b/crates/cad/src/import/build.rs index 870283af2c..02da2f46fc 100644 --- a/crates/cad/src/import/build.rs +++ b/crates/cad/src/import/build.rs @@ -24,7 +24,8 @@ const THINNEST: f64 = 0.25; /// The most objects an import makes. const MAX_NODES: usize = 2_000_000; /// The most block work an import does, whatever it produces: one per insert copy drawn, and one -/// per item of the block looked at for it (art on hidden layers too). +/// per item of the block looked at for it (art on hidden layers too), and the same for each block +/// whose dashes and widths are checked for a symbol's scale. const MAX_VISITS: usize = if cfg!(test) { 1_000_000 } else { 20_000_000 }; /// The most path elements an import makes (blocks drawn as art are copied for every placement). pub(crate) const MAX_ELEMENTS: usize = if cfg!(test) { 1_000_000 } else { 4_000_000 }; @@ -568,7 +569,9 @@ impl<'d, 'a> Build<'d, 'a> { // Text space is y-down points; the item's is y-up drawing units. let m = map * t.xf * Affine::FLIP_Y; let s = m.determinant().abs().sqrt(); - if !(s > 1e-12 && s.is_finite()) { + // Any invertible map will do: a symbol drawn at a tiny insert scale draws its text far + // below a point per unit, and its instances scale it back up. + if !(s > 0.0 && s.is_finite() && s.recip().is_finite()) { return None; } let d = self.d; @@ -691,12 +694,27 @@ impl<'d, 'a> Build<'d, 'a> { if let Some(s) = self.scaled_looks.get(&key) { return *s; } - let Some(items) = self.block(name) else { return false }; + let items = self.block(name); + // Looking at a block's items counts against the block work as placing it does, so the + // scan stops at the same limit as `art`. + self.visits = self.visits.saturating_add(1 + items.as_ref().map_or(0, |i| i.len())); + if self.visits > MAX_VISITS { + self.warn(TOO_MUCH_BLOCK_WORK); + return false; + } + let Some(items) = items else { return false }; if !self.enter(name, depth) { return false; } let mut s = false; for it in items.iter() { + #[cfg(test)] + SCALED_LOOK_ITEMS.with(|n| n.set(n.get().saturating_add(1))); + // Art on a hidden layer is not drawn (see `art`), so it does not make the block's + // look depend on its scale. + if self.d.layer(self.layer_name(&it.props, inh)).is_some_and(|l| l.hidden) && it.props.layer != "0" { + continue; + } s = match &it.geom { Geom::Path { fill: true, .. } => false, Geom::Path { width, .. } => { @@ -782,6 +800,8 @@ fn rgb_color([r, g, b]: [u8; 3]) -> Color { thread_local! { /// How many names [`unique`] tried on this thread (tests). pub(crate) static SYMBOL_NAMES_TRIED: std::cell::Cell = const { std::cell::Cell::new(0) }; + /// How many block items [`Build::is_scaled_look`] looked at on this thread (tests). + pub(crate) static SCALED_LOOK_ITEMS: std::cell::Cell = const { std::cell::Cell::new(0) }; } /// Whether `taken` holds `name`, counted as one name tried (tests). diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index 89f6e81ce8..ae3a86d180 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -980,6 +980,132 @@ fn scaled_inserts_scale_their_blocks_dashes_and_polyline_widths() { assert_ne!(symbol_of(one), symbol_of(ten)); } +#[test] +fn dashes_on_a_hidden_layer_leave_a_block_one_symbol_for_every_scale() { + let tables = [ + (0, "TABLE"), + (2, "LTYPE"), + (0, "LTYPE"), + (2, "DASHED"), + (73, "2"), + (40, "15"), + (49, "10"), + (49, "-5"), + (0, "ENDTAB"), + (0, "TABLE"), + (2, "LAYER"), + (0, "LAYER"), + (2, "Off"), + (70, "0"), + (62, "-1"), + (0, "ENDTAB"), + ]; + // "Mark": a solid line, and a dashed line on a hidden layer, which is not drawn. + let blocks = [ + (0, "BLOCK"), + (8, "0"), + (2, "Mark"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "LINE"), + (8, "0"), + (10, "0"), + (20, "0"), + (11, "100"), + (21, "0"), + (0, "LINE"), + (8, "Off"), + (6, "DASHED"), + (10, "0"), + (20, "10"), + (11, "100"), + (21, "10"), + (0, "ENDBLK"), + ]; + let inserts = [(0, "INSERT"), (2, "Mark"), (10, "0"), (20, "0"), (0, "INSERT"), (2, "Mark"), (10, "0"), (20, "100"), (41, "10"), (42, "10")]; + let doc = open(&drawing(&[], &tables, &blocks, &inserts), &points()).document; + assert_eq!(leaves(&doc).len(), 2); + assert_eq!(doc.symbols.len(), 1, "{:?}", doc.symbols.iter().map(|s| &s.name).collect::>()); +} + +#[test] +fn the_scale_check_of_blocks_stops_at_the_work_budget() { + // "Outer" places "Leaf" 1,100 times, each in its own color, and "Leaf" has 1,000 solid + // lines that take their insert's color: 1,100,000 items to look at, past the 1,000,000 + // tests import with. + let mut blocks: Vec<(i32, &'static str)> = vec![(0, "BLOCK"), (8, "0"), (2, "Leaf"), (70, "0"), (10, "0"), (20, "0")]; + for _ in 0..1000 { + blocks.extend([(0, "LINE"), (8, "0"), (62, "0"), (10, "0"), (20, "0"), (11, "1"), (21, "0")]); + } + blocks.extend([(0, "ENDBLK"), (0, "BLOCK"), (8, "0"), (2, "Outer"), (70, "0"), (10, "0"), (20, "0")]); + for i in 0..1100 { + let color: &'static str = Box::leak((i + 1).to_string().into_boxed_str()); + blocks.extend([(0, "INSERT"), (8, "0"), (2, "Leaf"), (420, color), (10, "0"), (20, "0")]); + } + blocks.push((0, "ENDBLK")); + let top = [(0, "INSERT"), (2, "Outer"), (10, "0"), (20, "0")]; + build::SCALED_LOOK_ITEMS.with(|n| n.set(0)); + let r = open(&drawing(&[], &[], &blocks, &top), &points()); + let looked = build::SCALED_LOOK_ITEMS.with(std::cell::Cell::get); + assert!(looked <= 1_000_000, "{looked} items looked at"); + assert!(r.warnings.iter().any(|w| w.contains("too much work")), "{:?}", r.warnings); +} + +#[test] +fn text_in_a_dashed_block_inserted_at_a_tiny_scale_is_kept() { + let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")]; + // "Inner" draws a dashed line and a label; "Outer" places it at 1e-7, and the drawing places + // "Outer" at 1e-7, so "Inner"'s symbol is drawn at 1e-14. + let blocks = [ + (0, "BLOCK"), + (8, "0"), + (2, "Inner"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "LINE"), + (8, "0"), + (6, "DASHED"), + (10, "0"), + (20, "0"), + (11, "100"), + (21, "0"), + (0, "TEXT"), + (8, "0"), + (10, "0"), + (20, "10"), + (40, "5"), + (1, "Label"), + (0, "ENDBLK"), + (0, "BLOCK"), + (8, "0"), + (2, "Outer"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "INSERT"), + (8, "0"), + (2, "Inner"), + (10, "0"), + (20, "0"), + (41, "1e-7"), + (42, "1e-7"), + (0, "ENDBLK"), + ]; + let top = [(0, "INSERT"), (2, "Outer"), (10, "0"), (20, "0"), (41, "1e-7"), (42, "1e-7")]; + let doc = open(&drawing(&[], &tables, &blocks, &top), &points()).document; + let mut texts = vec![]; + for s in &doc.symbols { + s.art.walk(&mut |n| { + if let NodeKind::Text(t) = &n.kind { + texts.push(t.plain_text()); + } + }); + } + assert_eq!(texts, ["Label"]); +} + #[test] fn many_by_block_looks_import_in_linear_time() { let by_block: &[(i32, &str)] = &[(0, "LINE"), (8, "0"), (62, "0"), (10, "5"), (20, "5"), (11, "15"), (21, "5")]; From 1da36ce346e60c6cf1a6ad90f2a271690992ed5b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 02:45:59 -0800 Subject: [PATCH 025/115] DXF/DWG import: block copies drawn at a tiny scale keep a finite transform An instance's transform inverted the symbol map and the scale its art is drawn at as one product. In a fitted drawing with a tiny points-per-unit scale, a dashed block placed at a tiny nested scale made that product's determinant subnormal, its inverse overflowed, and the instance carried NaN coefficients. The two factors are now inverted apart, and a copy whose transform still is not finite is left out with a warning. --- crates/cad/src/import/build.rs | 13 ++++++-- crates/cad/src/import/tests.rs | 56 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/crates/cad/src/import/build.rs b/crates/cad/src/import/build.rs index 02da2f46fc..2115104bcf 100644 --- a/crates/cad/src/import/build.rs +++ b/crates/cad/src/import/build.rs @@ -46,6 +46,7 @@ const TOO_MANY: &str = "the drawing has more than 2,000,000 objects: the rest ar const TOO_MANY_POINTS: &str = "the drawing has more than 4,000,000 path points: the rest are left out"; const TOO_MUCH_BLOCK_WORK: &str = "the drawing's blocks take too much work to place: the rest are left out"; const TOO_MANY_DASHES: &str = "the drawing has more dashed lines than can be kept: the rest are drawn solid"; +const TOO_SMALL: &str = "block copies drawn too small to place are left out"; const TOO_MUCH_TEXT: &str = "the drawing has more than 64 MB of text and block names: the rest are left out"; /// What a block's art takes from the insert that places it: its colour, lineweight, linetype @@ -627,12 +628,18 @@ impl<'d, 'a> Build<'d, 'a> { self.warn(TOO_MANY); break; } + // The symbol's art is drawn `drawn_at` times larger than a drawing unit + // at the import's scale; the instance takes the rest of the transform. + // The two factors are inverted apart, so a tiny `drawn_at` at a tiny fitted + // scale does not overflow the inverse of their product. + let xf = map * *cell * Affine::scale(drawn_at.recip()) * self.symbol_map.inverse(); + if !xf.as_coeffs().iter().all(|c| c.is_finite()) { + self.warn(TOO_SMALL); + continue; + } if !self.charge_text(name.len()) { break; } - // The symbol's art is drawn `drawn_at` times larger than a drawing unit - // at the import's scale; the instance takes the rest of the transform. - let xf = map * *cell * (self.symbol_map * Affine::scale(drawn_at)).inverse(); self.nodes += 1; Some(Node::new(self.doc.alloc_id(), NodeKind::SymbolInstance { symbol: name, xf })) } diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index ae3a86d180..08f683a65f 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -1106,6 +1106,62 @@ fn text_in_a_dashed_block_inserted_at_a_tiny_scale_is_kept() { assert_eq!(texts, ["Label"]); } +#[test] +fn a_dashed_block_at_a_tiny_scale_in_a_huge_fitted_drawing_keeps_a_finite_instance() { + let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")]; + // "G0" draws a line 1e12 long and "G1" to "G6" each place the one before at 1e12, so the + // drawing spans about 1e96 and fits at about 6e-94 points per unit. "D0" draws a dashed line, + // "D1" places it at 1e-4 and "D2" to "D5" each place the one before at 1e-12, so "D0" is drawn + // at about 6e-158 points per unit: the square of that is below the smallest normal number. + let mut blocks: Vec<(i32, &'static str)> = vec![]; + blocks.extend([(0, "BLOCK"), (8, "0"), (2, "G0"), (70, "0"), (10, "0"), (20, "0")]); + blocks.extend([(0, "LINE"), (8, "0"), (10, "0"), (20, "0"), (11, "1e12"), (21, "1e12"), (0, "ENDBLK")]); + blocks.extend([(0, "BLOCK"), (8, "0"), (2, "D0"), (70, "0"), (10, "0"), (20, "0")]); + blocks.extend([(0, "LINE"), (8, "0"), (6, "DASHED"), (10, "0"), (20, "0"), (11, "100"), (21, "0"), (0, "ENDBLK")]); + let names = |p: &str, i: usize| -> &'static str { Box::leak(format!("{p}{i}").into_boxed_str()) }; + for (p, from, to) in [("G", 1, 6), ("D", 1, 5)] { + for i in from..=to { + let scale = match (p, i) { + ("G", _) => "1e12", + (_, 1) => "1e-4", + _ => "1e-12", + }; + blocks.extend([(0, "BLOCK"), (8, "0"), (2, names(p, i)), (70, "0"), (10, "0"), (20, "0")]); + blocks.extend([(0, "INSERT"), (8, "0"), (2, names(p, i - 1)), (10, "0"), (20, "0"), (41, scale), (42, scale), (0, "ENDBLK")]); + } + } + let top = [ + (0, "INSERT"), + (2, "G6"), + (10, "0"), + (20, "0"), + (41, "1e12"), + (42, "1e12"), + (0, "INSERT"), + (2, "D5"), + (10, "0"), + (20, "0"), + (41, "1e-12"), + (42, "1e-12"), + ]; + let o = ImportOptions { fit: true, center: false, ..ImportOptions::default() }; + let doc = open(&drawing(&[], &tables, &blocks, &top), &o).document; + let mut instances = vec![]; + let mut collect = |n: &Node| { + if let NodeKind::SymbolInstance { symbol, xf } = &n.kind { + instances.push((symbol.clone(), *xf)); + } + }; + doc.walk(&mut collect); + for s in &doc.symbols { + s.art.walk(&mut collect); + } + assert!(instances.iter().any(|(symbol, _)| symbol == "D0"), "{instances:?}"); + for (symbol, xf) in &instances { + assert!(xf.as_coeffs().iter().all(|c| c.is_finite()), "{symbol}: {xf:?}"); + } +} + #[test] fn many_by_block_looks_import_in_linear_time() { let by_block: &[(i32, &str)] = &[(0, "LINE"), (8, "0"), (62, "0"), (10, "5"), (20, "5"), (11, "15"), (21, "5")]; From cda16b5163d4f7d9c05b4ce851f4411b6de8b94b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 04:14:07 -0800 Subject: [PATCH 026/115] Fix #10734: Save asks about a changed file only when its bytes changed Save asked "File changed" on every save of a file in a cloud-sync folder. The save flow counts any new change time or inode as a change by another app, and a sync client sets attributes on the file after uploading it, or puts the same bytes back as a new file. The app now keeps a SHA-256 digest of each document's file as it last read or wrote it, taken on a thread after the open and after each save. When the flow would ask, the file is compared with that digest on a thread; a file that still holds the same bytes becomes the recorded version and is written over without asking. A file whose bytes differ, that changes during the comparison, or that has no digest is asked about as before. Digests of closed documents are dropped. --- Cargo.lock | 1 + crates/ui-egui/Cargo.toml | 3 + crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/io.rs | 2 + crates/ui-egui/src/io/open.rs | 2 +- crates/ui-egui/src/io/save.rs | 181 +++++++++++++++++++++-- crates/ui-egui/src/io/saved_contents.rs | 185 ++++++++++++++++++++++++ crates/ui-egui/src/tests/save.rs | 56 +++++++ 8 files changed, 415 insertions(+), 16 deletions(-) create mode 100644 crates/ui-egui/src/io/saved_contents.rs diff --git a/Cargo.lock b/Cargo.lock index b878d75456..1395815475 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9289,6 +9289,7 @@ dependencies = [ "rustix 1.1.6", "serde", "serde_json", + "sha2 0.10.9", "toml", "vectorcraft-apischema", "vectorcraft-brush", diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index eddc4bf6bd..a94d788e91 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -87,6 +87,9 @@ craft = { workspace = true, features = ["dialogs", "update", "automation-agents" # The local date and time the status bar's Date and Time readout shows (`chrono::Local`). Already in # Cargo.lock with the time-zone crates `clock` uses. chrono = { workspace = true, features = ["clock"] } +# The digest of each open document's file, which Save compares with the file before asking whether to replace it +# (`src/io/saved_contents.rs`). Already in Cargo.lock (the engine's and the plug-ins' digests). +sha2 = { version = "0.10", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] # The status bar's Date and Time readout reads the page's clock with this crate in the web build. It diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index e2b89abff8..b769dac802 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -658,6 +658,7 @@ impl VectorcraftApp { if !self.background.jobs.is_empty() || !self.opening.pending.is_empty() || !self.opening.converting.is_empty() + || io::save::checks_pending(self) || plugin_runs::any_pending(self) || !self.placing.pending.is_empty() || !self.trace_runs.running.is_empty() diff --git a/crates/ui-egui/src/io.rs b/crates/ui-egui/src/io.rs index 8d311212aa..ba7b2d856f 100644 --- a/crates/ui-egui/src/io.rs +++ b/crates/ui-egui/src/io.rs @@ -16,6 +16,8 @@ pub(crate) mod export; mod open; mod read_only_save; pub(crate) mod save; +#[cfg(not(target_arch = "wasm32"))] +mod saved_contents; #[cfg(test)] mod tests_read_only_save; diff --git a/crates/ui-egui/src/io/open.rs b/crates/ui-egui/src/io/open.rs index dce5bac6e5..a536eb1e1c 100644 --- a/crates/ui-egui/src/io/open.rs +++ b/crates/ui-egui/src/io/open.rs @@ -178,7 +178,7 @@ pub(crate) fn opened(app: &mut VectorcraftApp, r: &Value) { if let Some(st) = index.and_then(|i| app.session.documents().get(i)) && let Some(path) = &st.path { - app.saves.watch.known_now(st.uid, Path::new(path)); + app.saves.known_now(st.uid, Path::new(path)); } let notes = open_notes(app, r); crate::dialogs::missing_links::after_open(app, r, notes); diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs index fc42da3c77..c09cbe7106 100644 --- a/crates/ui-egui/src/io/save.rs +++ b/crates/ui-egui/src/io/save.rs @@ -1,14 +1,16 @@ use std::collections::HashMap; -use std::path::PathBuf; -// The save panel's flow is the desktop's (craft-dialogs is native only); the web downloads. +use std::path::{Path, PathBuf}; #[cfg(not(target_arch = "wasm32"))] -use std::path::Path; +use std::sync::mpsc::{Receiver, TryRecvError}; +// The save panel's flow is the desktop's (craft-dialogs is native only); the web downloads. #[cfg(not(target_arch = "wasm32"))] use craft::dialogs::save::{SAVE_IN_PROGRESS, SaveDocument, SaveFlow, SaveStep, SaveTarget}; #[cfg(not(target_arch = "wasm32"))] use craft::host::Files; use craft::host::{FileFilter, PickRequest, Picked, Wake}; +#[cfg(not(target_arch = "wasm32"))] +use craft::platform::watch::FileStamp; use craft::platform::watch::FileWatch; use craft::ui::dialog::DialogId; #[cfg(not(target_arch = "wasm32"))] @@ -48,12 +50,27 @@ struct SaveDone { then: Option, } +/// A save whose flow would ask whether to replace its document's file, waiting for the file to be +/// compared with the bytes the app last read or wrote. +#[cfg(not(target_arch = "wasm32"))] +struct Checking { + path: PathBuf, + /// The file's version when it holds those bytes, else `None`. + answer: Receiver>, +} + /// The saves of the app: one [`SaveFlow`] per document, and what the flows need to ask and write. pub(crate) struct Saves { #[cfg(not(target_arch = "wasm32"))] flows: HashMap>, /// The version of each document's file the app last read or wrote. pub(crate) watch: FileWatch, + /// The digest of the bytes of each document's file, as the app last read or wrote them. + #[cfg(not(target_arch = "wasm32"))] + contents: super::saved_contents::SavedContents, + /// The saves waiting for a comparison of their document's file with those bytes. + #[cfg(not(target_arch = "wasm32"))] + checks: HashMap, /// The files written beside each document's file, which its next save replaces. pub(crate) written_beside: HashMap>, /// The files the OK of the replace question allows the save it runs again to replace. @@ -68,6 +85,10 @@ impl Saves { Self { #[cfg(not(target_arch = "wasm32"))] flows: HashMap::new(), + #[cfg(not(target_arch = "wasm32"))] + contents: super::saved_contents::SavedContents::new(), + #[cfg(not(target_arch = "wasm32"))] + checks: HashMap::new(), watch: FileWatch::new(wake), written_beside: HashMap::new(), replace_files_ok: Vec::new(), @@ -76,12 +97,55 @@ impl Saves { } } + /// The app just read document `uid`'s file at `path`: that version is not a change on disk. + pub(crate) fn known_now(&mut self, uid: u64, path: &Path) { + self.watch.known_now(uid, path); + #[cfg(not(target_arch = "wasm32"))] + self.note_contents(uid, path); + } + + /// Takes the digest of document `uid`'s file at `path`, the version the watcher just recorded. + #[cfg(not(target_arch = "wasm32"))] + fn note_contents(&mut self, uid: u64, path: &Path) { + match FileStamp::at(path) { + // Not differing from the watcher's version: the file has not changed since it was recorded. + Some(stamp) if !self.watch.disk_differs(&uid, path, None) => self.contents.note(uid, path, stamp), + _ => self.contents.forget(uid), + } + } + + /// Stops tracking document `uid`'s file (the document closed). + #[cfg(not(target_arch = "wasm32"))] + fn forget(&mut self, uid: u64) { + self.watch.forget(&uid); + self.contents.forget(uid); + self.checks.remove(&uid); + } + #[cfg(not(target_arch = "wasm32"))] fn start(&mut self, files: &dyn Files, document: SaveDocument, target: SaveTarget) -> SaveStep { let Self { flows, watch, .. } = self; flows.entry(document.key).or_default().start(files, watch, document, target) } + /// The answer of document `uid`'s file comparison, once it has come (with `wait`, once it + /// comes): the file's version when it holds the bytes the app last read or wrote, and the + /// file's path. `None` while there is no answer yet, or no comparison. + #[cfg(not(target_arch = "wasm32"))] + fn answer(&mut self, uid: u64, wait: bool) -> Option<(Option, PathBuf)> { + let check = self.checks.get(&uid)?; + let same = if wait { + check.answer.recv().ok().flatten() + } else { + match check.answer.try_recv() { + Ok(same) => same, + Err(TryRecvError::Empty) => return None, + Err(TryRecvError::Disconnected) => None, + } + }; + self.checks.remove(&uid).map(|c| (same, c.path)) + } + /// Frees the document's flow after a write that wrote nothing. #[cfg(not(target_arch = "wasm32"))] pub(super) fn release(&mut self, uid: u64) { @@ -91,6 +155,18 @@ impl Saves { } } +/// Whether file comparisons need another frame to collect their answers. +#[cfg(not(target_arch = "wasm32"))] +pub(crate) fn checks_pending(app: &VectorcraftApp) -> bool { + !app.saves.checks.is_empty() +} + +/// The web has no file comparisons to collect. +#[cfg(target_arch = "wasm32")] +pub(crate) fn checks_pending(_: &VectorcraftApp) -> bool { + false +} + /// Calls the `then` of the document's save, once. #[cfg(not(target_arch = "wasm32"))] fn terminate(app: &mut VectorcraftApp, uid: u64, r: Result) { @@ -107,7 +183,13 @@ fn finish(app: &mut VectorcraftApp, uid: u64, retargets: bool, out: &Result flow.written(&mut app.saves.watch, uid, Path::new(path)), + Some(path) if flow.is_busy() || retargets => { + flow.written(&mut app.saves.watch, uid, Path::new(path)); + // The document's own file (not a copy's): its digest goes with the version the watcher took. + if app.session.documents().iter().any(|d| d.uid == uid && d.path.as_deref() == Some(path)) { + app.saves.note_contents(uid, Path::new(path)); + } + } _ => flow.failed(&uid), } if !matches!(out, Ok(v) if v.get("pending").is_some()) { @@ -124,10 +206,12 @@ pub(crate) fn allow_replacing(app: &mut VectorcraftApp, files: &[String]) { } } -/// Takes what the flows and their questions have answered since the last pass: the pick, the -/// changed-on-disk question's answer. A save whose document closed is cancelled and forgotten. +/// Takes what the flows and their questions have answered since the last pass: the comparison of +/// a document's file, the pick, the changed-on-disk question's answer. A save whose document +/// closed is cancelled and forgotten. Closed documents' digest state is dropped on every pass. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) { + resume_checked(app, false); let busy: Vec = app.saves.flows.iter().filter(|(_, f)| f.is_busy()).map(|(uid, _)| *uid).collect(); for uid in busy { if !app.session.documents().iter().any(|d| d.uid == uid) { @@ -136,7 +220,7 @@ pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) { if let Some(mut flow) = app.saves.flows.remove(&uid) { flow.cancel(app.host.files()); } - app.saves.watch.forget(&uid); + app.saves.forget(uid); continue; } let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); @@ -152,6 +236,54 @@ pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) { app.status(e); } } + app.saves.contents.retain_open(app.session.documents().iter().map(|d| d.uid)); +} + +/// Goes on with the saves whose file comparison has answered (with `wait`, every one, once it +/// answers): an unchanged file is written over, and a changed one is asked about. +#[cfg(not(target_arch = "wasm32"))] +fn resume_checked(app: &mut VectorcraftApp, wait: bool) { + let checking: Vec = app.saves.checks.keys().copied().collect(); + for uid in checking { + // A closed document's save is cancelled with its flow, in [`pump`]. + if !app.session.documents().iter().any(|d| d.uid == uid) { + continue; + } + let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); + let r = scope.run(|| { + file_asks::as_automated(app, automated, |app| { + let (same, path) = app.saves.answer(uid, wait)?; + // Still that version: a change made since the comparison is asked about. + let Some(stamp) = same.filter(|stamp| FileStamp::at(&path) == Some(*stamp)) else { + let asked = ask_changed_on_disk(app, uid, &path); + return Some(settle(app, uid, asked)); + }; + // The same bytes: the file's version now is the document's, and the flow writes over it. + app.saves.watch.known_as(uid, &path, Some(stamp)); + let step = app.saves.flows.get_mut(&uid).map_or(SaveStep::Busy, SaveFlow::replace); + Some(run_step(app, uid, step)) + }) + }); + if let Some(Err(e)) = r + && e != "cancelled" + { + app.status(e); + } + } +} + +/// Waits for every save's file comparison and goes on with those saves. +#[cfg(all(test, not(target_arch = "wasm32")))] +pub(crate) fn wait_for_checks(app: &mut VectorcraftApp) { + resume_checked(app, true); +} + +/// Waits for the active document's baseline digest and compares it with the file. +#[cfg(all(test, not(target_arch = "wasm32")))] +pub(crate) fn wait_for_contents(app: &VectorcraftApp) -> Option { + let document = app.session.active()?; + let path = Path::new(document.path.as_deref()?); + app.saves.contents.check(document.uid, path)?.recv().ok().flatten() } /// The web has no save flows: nothing answers between passes. @@ -182,6 +314,12 @@ fn next_step(app: &mut VectorcraftApp, uid: u64) -> Option> { /// Runs `step` of the document `uid`'s save; a failure frees the flow and tells the caller. fn run_step(app: &mut VectorcraftApp, uid: u64, step: SaveStep) -> Result { let r = proceed(app, step); + settle(app, uid, r) +} + +#[cfg(not(target_arch = "wasm32"))] +/// The result `r` of a step of document `uid`'s save; a failure frees the flow and tells the caller. +fn settle(app: &mut VectorcraftApp, uid: u64, r: Result) -> Result { if r.is_err() { app.saves.release(uid); terminate(app, uid, r.clone()); @@ -189,19 +327,32 @@ fn run_step(app: &mut VectorcraftApp, uid: u64, step: SaveStep) -> Result Result { + let name = fileio::file_name(&path.to_string_lossy()); + let prompt = StandardPrompt::changed_on_disk(name).instance(("changed-on-disk", key)); + let id = app.dialogs().ok_or("no window to ask in")?.with(|host| host.open(prompt)); + if let Some(done) = app.saves.done.get_mut(&key) { + done.question = Some(id); + } + Ok(json!({ "pending": "changedOnDisk" })) +} + #[cfg(not(target_arch = "wasm32"))] fn proceed(app: &mut VectorcraftApp, step: SaveStep) -> Result { match step { SaveStep::Picking => Ok(json!({ "pending": "fileDialog" })), - SaveStep::AskChangedOnDisk { key, path } => { - let name = fileio::file_name(&path.to_string_lossy()); - let prompt = StandardPrompt::changed_on_disk(name).instance(("changed-on-disk", key)); - let id = app.dialogs().ok_or("no window to ask in")?.with(|host| host.open(prompt)); - if let Some(done) = app.saves.done.get_mut(&key) { - done.question = Some(id); + // Before asking, the file is compared with the bytes the app last read or wrote: a file + // whose metadata alone changed (a cloud-sync folder sets attributes on it, or puts the same + // bytes back as a new file) is written over without asking (#10734). [`pump`] goes on. + SaveStep::AskChangedOnDisk { key, path } => match app.saves.contents.check(key, &path) { + Some(answer) => { + app.saves.checks.insert(key, Checking { path, answer }); + Ok(json!({ "pending": "checkingFile" })) } - Ok(json!({ "pending": "changedOnDisk" })) - } + None => ask_changed_on_disk(app, key, &path), + }, SaveStep::Write { key, path, target, file_type } => write_step(app, key, &path.to_string_lossy(), target, file_type), SaveStep::Cancelled { key } => { terminate(app, key, Err("cancelled".into())); diff --git a/crates/ui-egui/src/io/saved_contents.rs b/crates/ui-egui/src/io/saved_contents.rs new file mode 100644 index 0000000000..3e3ff170b8 --- /dev/null +++ b/crates/ui-egui/src/io/saved_contents.rs @@ -0,0 +1,185 @@ +//! The bytes of each open document's file as the app last read or wrote them, kept as a SHA-256 +//! digest (#10734). Save asks before replacing a file another app changed, and the save flow +//! counts a new change time or a new inode as a change. A cloud-sync folder sets +//! attributes on a file after uploading it, or puts the same bytes back as a new file. When the +//! file on disk still holds the bytes the app wrote, Save writes without asking. +//! +//! Files are read and digested on threads of their own: a file in a cloud folder may have to be +//! downloaded first. + +use std::collections::HashMap; +use std::fs::File; +use std::io::Read; +use std::path::{Path, PathBuf}; +use std::sync::mpsc::{self, Receiver}; +use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; +use std::thread::JoinHandle; + +use craft::platform::watch::FileStamp; +use sha2::{Digest, Sha256}; + +/// A version of a document's file: its path, its stamp when read, and the digest of its bytes. +#[derive(Clone)] +struct Version { + path: PathBuf, + stamp: FileStamp, + digest: [u8; 32], +} + +#[derive(Default)] +struct State { + versions: HashMap, + /// Counts the notes of each document: a digest taken for an older note is dropped. + notes: HashMap, + /// The digest being taken for each document's newest note. + pending: HashMap>, +} + +/// The digests of the open documents' files. +pub(crate) struct SavedContents { + state: Arc>, +} + +fn lock(state: &Mutex) -> MutexGuard<'_, State> { + state.lock().unwrap_or_else(PoisonError::into_inner) +} + +impl SavedContents { + /// No digests yet. + pub(crate) fn new() -> Self { + Self { state: Arc::default() } + } + + /// The app just read or wrote document `key`'s file at `path`, and `stamp` is that version. + /// The file is opened and its digest taken on a thread of its own. Any stamp change + /// before or during the read leaves no digest, so Save asks on a change. + pub(crate) fn note(&self, key: u64, path: &Path, stamp: FileStamp) { + let note = { + let mut state = lock(&self.state); + state.versions.remove(&key); + state.pending.remove(&key); + let note = state.notes.entry(key).or_default(); + *note = note.wrapping_add(1); + *note + }; + let state = Arc::clone(&self.state); + let path = path.to_path_buf(); + let work = move || { + let Ok(file) = File::open(&path) else { return }; + let Some(digest) = digest_of(file, stamp) else { return }; + let mut state = lock(&state); + if state.notes.get(&key) == Some(¬e) { + state.versions.insert(key, Version { path, stamp, digest }); + } + }; + // Without a thread nothing is recorded, and Save asks on any change, as before. + if let Ok(handle) = std::thread::Builder::new().name("vectorcraft-file-digest".into()).spawn(work) { + lock(&self.state).pending.insert(key, handle); + } + } + + /// Starts comparing document `key`'s file at `path` with the version the app last read or + /// wrote, on a thread of its own that first waits for that version's digest. The answer is + /// the file's version now when it holds the same bytes, and `None` when the bytes differ, the + /// file can't be read, or no digest of `path` was taken. `None` here when no thread starts. + pub(crate) fn check(&self, key: u64, path: &Path) -> Option>> { + let pending = lock(&self.state).pending.remove(&key); + let state = Arc::clone(&self.state); + let path = path.to_path_buf(); + let (send, answer) = mpsc::channel(); + let work = move || { + if let Some(handle) = pending { + // A digest thread that panicked recorded nothing. + let _ = handle.join(); + } + // The caller may be gone (its document closed): the answer is dropped. + let _ = send.send(unchanged(&state, key, &path)); + }; + std::thread::Builder::new().name("vectorcraft-file-check".into()).spawn(work).ok().map(|_| answer) + } + + /// Document `key` closed: its digest is dropped, and one still being taken is not recorded. + pub(crate) fn forget(&self, key: u64) { + let mut state = lock(&self.state); + state.versions.remove(&key); + state.pending.remove(&key); + let note = state.notes.entry(key).or_default(); + *note = note.wrapping_add(1); + } + + /// Drops closed documents' versions, pending handles and note counters only when needed. + /// Removing a note counter prevents its digest thread from recording a version later. + pub(crate) fn retain_open(&self, open: impl Iterator + Clone) { + let mut state = lock(&self.state); + let is_open = |key: &u64| open.clone().any(|uid| uid == *key); + if state.notes.keys().any(|key| !is_open(key)) { + state.versions.retain(|key, _| is_open(key)); + state.pending.retain(|key, _| is_open(key)); + state.notes.retain(|key, _| is_open(key)); + } + } +} + +/// [`SavedContents::check`]'s answer, on its thread. +fn unchanged(state: &Mutex, key: u64, path: &Path) -> Option { + let version = lock(state).versions.get(&key).filter(|v| v.path == path).cloned()?; + let now = FileStamp::at(path)?; + if now.len() != version.stamp.len() || digest_of(File::open(path).ok()?, now)? != version.digest || FileStamp::at(path) != Some(now) { + return None; + } + if let Some(v) = lock(state).versions.get_mut(&key).filter(|v| v.digest == version.digest) { + v.stamp = now; + } + Some(now) +} + +/// The digest of `file`, read while its full stamp stays at `stamp`; `None` when the stamp +/// differs or the file can't be read. A Unix change time alone can also signal changed bytes. +fn digest_of(mut file: File, stamp: FileStamp) -> Option<[u8; 32]> { + if !file.metadata().is_ok_and(|m| FileStamp::of(&m) == stamp) { + return None; + } + let mut hasher = Sha256::new(); + let mut buffer = vec![0u8; 64 * 1024]; + loop { + let n = file.read(&mut buffer).ok()?; + if n == 0 { + break; + } + hasher.update(buffer.get(..n)?); + } + file.metadata().is_ok_and(|m| FileStamp::of(&m) == stamp).then(|| hasher.finalize().into()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn retaining_open_documents_drops_closed_documents_state() { + let folder = crate::tests_folder::Folder::new("saved-contents-retain"); + let file = folder.file("document", b"saved contents"); + let path = Path::new(&file); + let stamp = FileStamp::at(path).unwrap(); + let contents = SavedContents::new(); + for uid in [1, 2] { + contents.note(uid, path, stamp); + assert!(contents.check(uid, path).unwrap().recv().unwrap().is_some()); + } + // A third document closes while its digest handle is still retained. + contents.note(3, path, stamp); + contents.retain_open([2].into_iter()); + + { + let state = lock(&contents.state); + for uid in [1, 3] { + assert!(!state.versions.contains_key(&uid)); + assert!(!state.pending.contains_key(&uid)); + assert!(!state.notes.contains_key(&uid)); + } + } + assert!(contents.check(1, path).unwrap().recv().unwrap().is_none()); + assert!(contents.check(3, path).unwrap().recv().unwrap().is_none()); + assert!(contents.check(2, path).unwrap().recv().unwrap().is_some()); + } +} diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index b1fa7cb347..de7728f9e7 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -593,3 +593,59 @@ fn acknowledging_import_loss_does_not_overwrite_the_source_with_another_drawing( assert!(after_switch == saved, "drawing B must never overwrite A's file"); assert!(after_original != saved, "approval in drawing A must still save A"); } + +/// Puts `bytes` at `path` as a new file, as a cloud-sync folder puts a file back after uploading +/// it: the file gets a new inode and new change and modification times. +fn put_back(path: &str, bytes: &[u8]) { + let next = format!("{path}.sync"); + std::fs::write(&next, bytes).unwrap(); + std::fs::rename(&next, path).unwrap(); +} + +/// Once its baseline digest is recorded, Save writes without asking while the file holds the +/// bytes the app last read or wrote (#10734), and asks once they differ, even at the same length. +#[test] +fn save_asks_about_a_changed_file_only_when_its_bytes_changed() { + let d = dir("same-bytes"); + let path = d.join("a.vectorcraft").to_string_lossy().to_string(); + let mut writer = app(); + writer.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + rect(&mut writer); + writer.run("file.saveAs", json!({"path": path})).unwrap(); + crate::background::wait_all(&mut writer); + let mut app = app(); + io::open_path(&mut app, &path).unwrap(); + assert!(io::save::wait_for_contents(&app).is_some(), "the opened file's baseline is recorded before sync"); + + let saved = |app: &VectorcraftApp| vectorcraft_format::load(&std::fs::read(&path).unwrap()).unwrap().node_count() == objects(app); + // File › Save, once the file has been compared: did it ask? + let save = |app: &mut VectorcraftApp| { + rect(app); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + io::save::wait_for_checks(app); + crate::background::wait_all(app); + if !app.any_dialog_open() { + assert!(io::save::wait_for_contents(app).is_some(), "the written file's baseline is recorded before sync"); + } + app.any_dialog_open() + }; + + // Read from the file: the same bytes put back. + put_back(&path, &std::fs::read(&path).unwrap()); + assert!(!save(&mut app)); + assert!(saved(&app)); + + // Written by that save: the same bytes put back. + put_back(&path, &std::fs::read(&path).unwrap()); + assert!(!save(&mut app)); + assert!(saved(&app)); + + // Other bytes of the same length. + let mut other = std::fs::read(&path).unwrap(); + let last = other.last_mut().unwrap(); + *last ^= 0xff; + put_back(&path, &other); + assert!(save(&mut app), "asks whether to replace the file"); + assert_eq!(std::fs::read(&path).unwrap(), other, "nothing is written before the answer"); + let _ = std::fs::remove_dir_all(d); +} From e009722fe8f069a1c67adff8360ffe0db896f6d4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:02:06 -0800 Subject: [PATCH 027/115] Canvas: a drag moves the kept anchor marks mesh instead of tessellating it Each step of a drag moved the kept selection marks, but the anchor marks' mesh was keyed on the marks key, which changes with every revision, so every step tessellated the anchors, handles and outlines again and flattened every outline. With about 2,000 paths selected that was the largest part of each step. The kept mesh now moves with the marks when that gives what a new tessellation gives: the move since the mesh was tessellated is a whole number of physical pixels on screen, so pixel rounding lands the same, and every anchor and handle is inside the canvas and the clip before and after the move, so no mark is left out or culled. Otherwise the next paint tessellates the marks as before. A new revision of the same document and selection also keeps the mesh. --- crates/ui-egui/src/canvas/selection.rs | 68 ++++++++++++++++- crates/ui-egui/src/canvas/selection/tests.rs | 77 ++++++++++++++++++++ 2 files changed, 143 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index 861eda0790..b6421c882b 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -688,6 +688,59 @@ struct MeshKey { pub(crate) struct KeptMesh { key: MeshKey, mesh: Arc, + /// How far the marks moved on screen since they were tessellated, in physical pixels, unrounded + /// ([`KeptMesh::translate`]). The mesh moved by this distance rounded. + moved: [f64; 2], +} + +/// How far from a whole number of physical pixels the marks' move since they were tessellated may be on screen, and +/// still count as whole: rounding noise of the screen position, well under what the tessellator's `f32` positions hold. +const PIXEL_SLACK: f64 = 1e-6; + +impl KeptMesh { + /// Moves the mesh by `by` in the document when tessellating the moved marks would give the same mesh moved, and + /// returns whether it did. `was` is the box of the marks' points before the move ([`knots_box`]). The mesh moves + /// when the marks' whole move since they were tessellated is a whole number of physical pixels on screen, so the + /// tessellator's rounding to pixels lands the same, and when every point is inside the canvas the marks are drawn + /// near and inside the clip both before and after the move, so no anchor, handle or outline is left out or culled + /// on either side. + fn translate(&mut self, by: Vec2, was: Option) -> bool { + let key = &self.key; + let ppp = f64::from(key.pixels_per_point); + let view = key.view.affine(); + let shift = (view * (Point::ZERO + by)) - (view * Point::ZERO); + let moved = [self.moved[0] + shift.x * ppp, self.moved[1] + shift.y * ppp]; + if moved.iter().any(|p| !p.is_finite() || (p - p.round()).abs() > PIXEL_SLACK) { + return false; + } + if let Some(was) = was { + let area = key.rect.expand(key.look.reach).intersect(key.clip); + let inside = |r: vectorcraft_geom::Rect| { + [(r.x0, r.y0), (r.x1, r.y0), (r.x1, r.y1), (r.x0, r.y1)].into_iter().all(|(x, y)| area.contains(key.view.to_screen(Point::new(x, y)))) + }; + if !(inside(was) && inside(was + by)) { + return false; + } + } + let step = |axis: usize| ((moved[axis].round() - self.moved[axis].round()) / ppp) as f32; + let offset = vec2(step(0), step(1)); + self.moved = moved; + Arc::make_mut(&mut self.mesh).translate(offset); + true + } +} + +/// The box of every anchor and direction handle of `anchors`, in document units, or `None` without any. The outlines +/// lie inside it too, as a curve lies inside the hull of its points. +fn knots_box(anchors: &Anchors) -> Option { + anchors + .paths + .iter() + .chain(&anchors.plain) + .flat_map(|p| &p.subpaths) + .flat_map(|sp| &sp.knots) + .flat_map(|knot| [knot.anchor, knot.in_ctrl, knot.out_ctrl]) + .fold(None, |r: Option, p| Some(r.map_or(vectorcraft_geom::Rect::from_points(p, p), |r| r.union_pt(p)))) } /// One set of anchors as `BezierOverlay` took it: the paths, which anchors are selected and how they show. @@ -809,7 +862,7 @@ impl Component for AnchorMarks<'_> { None => { let shapes = shapes(); let mesh = Arc::new(tessellate(shapes, &key)); - *kept = Some(KeptMesh { key, mesh: Arc::clone(&mesh) }); + *kept = Some(KeptMesh { key, mesh: Arc::clone(&mesh), moved: [0.0; 2] }); mesh } }; @@ -1198,12 +1251,23 @@ impl SelectionMarks { self.from = (moved.from.clone(), moved.by); self.doc = moved.to.clone(); } + // The kept mesh shows these marks, so it stays theirs under the new key. + let was = self.key; + if let Some(kept) = self.mesh.get_mut().as_mut().filter(|kept| kept.key.marks == was) { + kept.key.marks = key; + } self.key = key; Some(self) } - /// Moves every mark by `by`. + /// Moves every mark by `by`, and the kept mesh of the anchor marks with them when it can move as it is + /// ([`KeptMesh::translate`]); otherwise the next paint tessellates the marks again. fn translate(&mut self, by: Vec2) { + let was = knots_box(&self.anchors); + let mesh = self.mesh.get_mut(); + if mesh.as_mut().is_some_and(|kept| !kept.translate(by, was)) { + *mesh = None; + } let shift = vectorcraft_geom::Affine::translate(by); for o in &mut self.outlines { o.paths.iter_mut().chain(o.key.as_mut()).for_each(|path| path.apply_affine(shift)); diff --git a/crates/ui-egui/src/canvas/selection/tests.rs b/crates/ui-egui/src/canvas/selection/tests.rs index 65ca87aff3..f23e4087aa 100644 --- a/crates/ui-egui/src/canvas/selection/tests.rs +++ b/crates/ui-egui/src/canvas/selection/tests.rs @@ -1283,3 +1283,80 @@ fn a_move_of_the_selection_moves_its_marks_without_building_them() { assert_eq!(frames(&mut app, 3), 1, "an undo"); assert!(kept_marks_are_current(&app), "after an undo"); } + +/// The mesh of the anchor marks the canvas keeps. +fn kept_mesh(app: &VectorcraftApp) -> Arc { + let marks = app.canvas.selection_marks.as_ref().expect("the canvas drew the selection's marks"); + let kept = marks.mesh.borrow(); + Arc::clone(&kept.as_ref().expect("the canvas kept the anchor marks' mesh").mesh) +} + +// A drag of the selection moves the kept mesh of its anchor marks instead of tessellating them again: steps of whole +// pixels tessellate nothing and leave the mesh a new tessellation gives, a new revision of the same marks keeps it, and +// a step of part of a pixel or one that takes the marks past the canvas's edge tessellates them once. +#[test] +fn a_drag_of_the_selection_moves_the_anchor_marks_mesh_without_tessellating_it() { + let (mut app, curve) = canvas_app(); + app.select_tool("selection"); + app.run("select.set", json!({"ids": [curve.0]})).unwrap(); + let ctx = crate::testing::ui_context(); + let frames = |app: &mut VectorcraftApp, n: usize| { + let before = MESHES_BUILT.with(std::cell::Cell::get); + for _ in 0..n { + canvas_frame(app, &ctx, vec![]); + } + MESHES_BUILT.with(std::cell::Cell::get) - before + }; + assert_eq!(frames(&mut app, 2), 1, "the first frame tessellates the marks"); + // A document distance that is `px` physical pixels across on screen. + let pixels = |app: &VectorcraftApp, px: f64| px / (app.canvas_view().unwrap().zoom * f64::from(ctx.pixels_per_point())); + let step = |app: &mut VectorcraftApp, dx: f64| { + app.session.preview("object.transform", &json!({"matrix": [1, 0, 0, 1, dx, 0], "copy": false})).unwrap(); + }; + + let layer = app.session.active().unwrap().doc.layers[0].id; + app.run("layer.setCurrent", json!({"id": layer.0})).unwrap(); + assert_eq!(frames(&mut app, 2), 0, "a new revision of the same document and selection"); + + // The kept mesh matches the one marks built now tessellate; the kept marks go back afterwards, so the drag + // goes on moving them. + let matches_new = |app: &mut VectorcraftApp, case: &str| { + let moved = kept_mesh(app); + let kept = app.canvas.selection_marks.take(); + canvas_frame(app, &ctx, vec![]); + let fresh = kept_mesh(app); + app.canvas.selection_marks = kept; + assert!(!fresh.vertices.is_empty(), "{case}: the marks drew something"); + assert_eq!(moved.indices, fresh.indices, "{case}: the moved mesh has the triangles of a new one"); + assert_eq!(moved.vertices.len(), fresh.vertices.len(), "{case}"); + for (a, b) in moved.vertices.iter().zip(&fresh.vertices) { + assert_eq!(a.color, b.color, "{case}"); + assert!((a.pos - b.pos).length() < 1e-3, "{case}: a moved vertex at {:?}, a new one at {:?}", a.pos, b.pos); + } + }; + + app.session.begin_interaction("Move").unwrap(); + let built = MARKS_BUILT.with(std::cell::Cell::get); + for px in [3.0, 10.0, -4.0] { + let dx = pixels(&app, px); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 0, "a drag's step to {px} pixels"); + } + assert_eq!(MARKS_BUILT.with(std::cell::Cell::get), built, "the drag moved the kept marks"); + matches_new(&mut app, "after whole pixels"); + + let built = MARKS_BUILT.with(std::cell::Cell::get); + let dx = pixels(&app, -4.5); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 1, "a step to part of a pixel"); + let dx = pixels(&app, -3.5); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 0, "a whole pixel from the marks tessellated at part of one"); + assert_eq!(MARKS_BUILT.with(std::cell::Cell::get), built, "the drag moved the kept marks"); + matches_new(&mut app, "after part of a pixel and a whole one"); + // Whole pixels from the last step. + let dx = pixels(&app, 1996.5); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 1, "a step past the canvas's edge"); + app.session.commit_interaction().unwrap(); +} From 383a5aa87f118b9079916f8ee07e50cd80e73df3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:04:37 -0800 Subject: [PATCH 028/115] 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 029/115] 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 030/115] 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 ca2c567f7433eaa858ed717be0513e616db99269 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:52:10 -0800 Subject: [PATCH 031/115] PICT: Export As writes QuickDraw pictures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File › Export As and document.export {format: "pict"} write a version 2 QuickDraw picture (.pct) of an artboard, or one per artboard with Use Artboards, with the extended header at up to 16 device units a point. - Fills are PaintPoly polygons. A path of several figures is one polygon that runs back along the line between its figures, so the even-odd fill QuickDraw gives polygons keeps its holes. Non-zero fills are first resolved into figures that don't overlap, and art is cut to the picture's frame so every coordinate fits 16 bits. A fill too complex to resolve is written as it is, with a warning. - Strokes are written as their filled outlines (line_outline, with dashes, caps, joins and miter limit). - Images are DirectBitsRect pixel maps in tiles of at most 1,024 pixels, rows packed with PackBits, composited over white. Mirrored and quarter-turned images keep their placement, and an image reaching far past the frame keeps its columns in place. - Clipping masks, gradients, patterns and transparency are written as WMF writes them, with the same warnings. Artboards over 32,767 points on a side are refused. The writer follows the opcode tables of Inside Macintosh: Imaging With QuickDraw, and the tests read every picture back through the PICT reader. --- Cargo.lock | 1 + crates/engine/src/cmd/fileio/action_batch.rs | 1 + crates/engine/src/cmd/fileio/commands.rs | 6 +- crates/engine/src/cmd/fileio/encode.rs | 6 +- crates/engine/src/cmd/fileio/formats.rs | 14 +- crates/engine/src/cmd/fileio/metafile.rs | 6 +- crates/engine/src/cmd/fileio/screens.rs | 2 +- crates/engine/src/cmd/fileio/tests.rs | 6 +- crates/engine/src/cmd/fileio/tests_dxf.rs | 6 +- crates/engine/src/cmd/fileio/tests_pict.rs | 50 +- crates/mcp/src/tests/fileio.rs | 3 +- crates/mcp/src/tools/definitions.rs | 2 +- crates/metafile/Cargo.toml | 3 +- crates/metafile/src/encode.rs | 30 +- crates/metafile/src/import/picture.rs | 10 +- crates/metafile/src/lib.rs | 29 +- crates/metafile/src/pict.rs | 537 +++++++++++++++++++ crates/metafile/src/tests.rs | 1 + crates/metafile/src/tests/pict_export.rs | 394 ++++++++++++++ docs/control-protocol.md | 7 +- docs/file-format-parity.md | 2 +- docs/mcp.md | 36 +- 22 files changed, 1104 insertions(+), 48 deletions(-) create mode 100644 crates/metafile/src/pict.rs create mode 100644 crates/metafile/src/tests/pict_export.rs diff --git a/Cargo.lock b/Cargo.lock index b878d75456..41b199413e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9008,6 +9008,7 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-effects", "vectorcraft-geom 0.25.1", + "vectorcraft-pathops 0.25.1", "vectorcraft-text", ] diff --git a/crates/engine/src/cmd/fileio/action_batch.rs b/crates/engine/src/cmd/fileio/action_batch.rs index 276886d534..a51488a016 100644 --- a/crates/engine/src/cmd/fileio/action_batch.rs +++ b/crates/engine/src/cmd/fileio/action_batch.rs @@ -572,6 +572,7 @@ fn dataset_output_extensions(run: &Run<'_>, doc: &vectorcraft_doc::Document, def | "dxf" | "emf" | "wmf" + | "pict" | "hpgl" | "ai" ) diff --git a/crates/engine/src/cmd/fileio/commands.rs b/crates/engine/src/cmd/fileio/commands.rs index 0d7cfd03c7..c079da9e03 100644 --- a/crates/engine/src/cmd/fileio/commands.rs +++ b/crates/engine/src/cmd/fileio/commands.rs @@ -27,7 +27,7 @@ pub fn specs() -> Vec { "Serialize Document", [], None, - "{format?: vectorcraft (default)|template|svg|svgz|pdf|ai|png|jpg|webp|gif|png8|txt|dxf|eps|emf|wmf|hpgl|tiff|bmp|tga|psd|cmx (ait, a .ait template, is written by file.saveAsTemplate), …the format's options (see document.formats; SVG ones also as svg: {…}), selectedOnly?: false (the selected objects alone, in the layers and groups that hold them; an object of a blend, envelope, repeat or intertwine on its own)} → {text, warnings} for svg (plus dataBase64, the file, when its encoding isn't UTF-8), else {dataBase64, warnings}; an SVG of several artboards also gives files: [{name, text}], linked images linked: [{name, dataBase64}]. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg and svgz, and the files that carry the native document (vectorcraft, template, eps, ai of every artboard with useArtboards not false but a version 7 file, pdf of every artboard with preserveEditing on and useArtboards not false), are refused while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked), or while the file would name a linked image's file outside them (images: link, preserveEditing, or an image whose pixels the document doesn't hold; a URL is not checked)", + "{format?: vectorcraft (default)|template|svg|svgz|pdf|ai|png|jpg|webp|gif|png8|txt|dxf|eps|emf|wmf|pict|hpgl|tiff|bmp|tga|psd|cmx (ait, a .ait template, is written by file.saveAsTemplate), …the format's options (see document.formats; SVG ones also as svg: {…}), selectedOnly?: false (the selected objects alone, in the layers and groups that hold them; an object of a blend, envelope, repeat or intertwine on its own)} → {text, warnings} for svg (plus dataBase64, the file, when its encoding isn't UTF-8), else {dataBase64, warnings}; an SVG of several artboards also gives files: [{name, text}], linked images linked: [{name, dataBase64}]. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg and svgz, and the files that carry the native document (vectorcraft, template, eps, ai of every artboard with useArtboards not false but a version 7 file, pdf of every artboard with preserveEditing on and useArtboards not false), are refused while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked), or while the file would name a linked image's file outside them (images: link, preserveEditing, or an image whose pixels the document doesn't hold; a URL is not checked)", has_doc, export::serialize ), @@ -36,7 +36,7 @@ pub fn specs() -> Vec { "Export Document", [], None, - "{path?, format?: svg|svgz|pdf|ai|png|jpg|webp|gif|png8|txt|dxf|eps|emf|wmf|hpgl|tiff|bmp|tga|psd|cmx|vectorcraft|template (default: from the path's extension, else png; png8 writes an indexed .png; ait, a .ait template, is written by file.saveAsTemplate; an exporter plug-in's format is plugin., which an extension only it lists picks too), params?: {…} (an exporter plug-in's parameters; missing ones take their defaults, see plugin.info), selectedOnly?: false (the selected objects alone, in the layers and groups that hold them; an object of a blend, envelope, repeat or intertwine on its own), includeArtboardFill?: true (raster, PDF, SVG and EPS draw each exported artboard's background color behind its art, a transparent background too; false leaves it out), artboard?: 0, artboards?: [i…], rect?: [x, y, width, height] (raster formats: that area of the page in points, y down, instead of an artboard; not with artboard, artboards, range or useArtboards), range?: \"1-3, 5\" | \"all\" (1-based; PDF and .ai write one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard), useArtboards?: true (raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf/ai: every page) | false (pdf/ai/raster: the bounds of the visible art; pdf/ai: of the layers the file draws, without editing data, with a warning, and ai refuses pdfCompatible: false; SVG has it as an SVG option), ppi?: number (raster formats: pixels per inch, stored in the file; wins over scale; without either, the document's raster effects resolution), scale?: number (pixels per point), background?: transparent|white|black|\"#rrggbb\" (jpg: white when transparent; #rrggbbaa and #rgba are refused here and in matte), antiAlias?: none|art (default)|type (text snapped to pixels), interlaced?: false (png, Adam7), embedIcc?: true (png: an sRGB chunk marks the colours as sRGB), quality?: 90 (jpg: 0–100), colorModel?: rgb|cmyk|gray (jpg), method?: baseline|optimized|progressive, scans?: 3 (3–5, progressive), embedIcc?: true, imageMap?: none|client|server (an HTML or NCSA map of the objects with a URL, written as .html / .map), colors?: 256 (gif/png8: 2–256), reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray, dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, transparency?: true, transparencyDither?: none (default: pixels under half opacity become transparent)|diffusion|pattern|noise (with transparency: as document.exportForWeb), transparencyDitherAmount?: 100 (0–100: the diffusion transparency dither's strength), matte?: white|\"#rrggbb\"|none, interlaced?, lossless?: true (webp: every pixel kept exactly; false writes lossy WebP, a smaller file that loses some detail), quality?: 90 (webp with lossless: false: 0–100, higher keeps more detail in a larger file; more than 100 is refused), embedIcc?: true (webp: the sRGB profile in an ICCP chunk), encoding?: utf8|utf16 (txt: the stories in stacking order, back to front, a thread once; utf16 with a byte order mark), lineEndings?: lf|crlf, selectionOnly?: false, svg?: {styling, outlineText, images, objectIds, decimals, minify, responsive, units, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts, variableData} (see document.formats), …the SVG options given flat instead, …the PDF options of document.exportPdf, …the DXF options of document.exportDxf (useArtboards: one drawing per artboard), …the EPS options of document.exportEps (useArtboards: one file per artboard, {stem}_{artboard}.eps, after a central {stem}.eps of the whole document when there are two or more and art shows; else the visible art), …emf and wmf write one picture of the artboard (useArtboards: true one file per chosen artboard, false the bounds of the visible art; EMF keeps curves, clipping, transparent images and gradients as images clipped to their shape; WMF flattens curves into polygons behind a placeable header; what a format leaves out comes back in warnings), …hpgl writes a plot of the artboard as pen moves for plotters and cutters (each visible path once along its line in plotter units; useArtboards: true one file per chosen artboard, false the bounds of the art it plots, without placed images, unpainted paths and art at 0% opacity), hpglVersion?: hpgl (default: IN, SP, PU, PD) | hpgl2 (also NP and PC pen colors, each pen's paths as one encoded polyline PE), curveTolerance?: 0.1 (points, 0.01 to 10), pens?: [\"#rrggbb\"…] (pen 1 first, up to 255; each path takes the nearest; default a pen per color in the order the art first draws in it, numbered alike in every file), origin?: bottomLeft (default) | center, sortPaths?: false (each pen's next path the nearest), insideFirst?: false (a path after the pen's paths that lie inside it), …cmx writes one file with a page for the artboard (useArtboards: true a page for each chosen artboard, false the bounds of the visible art; a layer for each layer with art on the page, holding the art's fills and strokes as curves in their colors: CMYK, RGB, gray, spot colors at their tints, Registration; type as outlines, gradients and patterns as one color, nonzero fills as even-odd, dashes in whole stroke widths, no miter limit, art across a page's edge written whole, without images, clipping masks or transparency; warnings name each of these losses), colorModel?: rgb|cmyk|gray (tiff: rgb keeps transparency as an alpha channel), lzw?: true, byteOrder?: little|big, embedIcc?: true, colorModel?: rgb|gray (bmp), depth?: 24 (bmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha), fileFormat?: windows|os2 (1, 4, 8 or 24 bits), rle?: false (4 and 8 bits, windows), flipRows?: false (top-down rows), depth?: 24 (tga: 16 one-bit alpha, 24, 32 with alpha), colorModel?: rgb|cmyk|gray (psd), layers?: true (each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white), preserveText?: false (with layers: horizontal and vertical point type in solid colors, with left-to-right paragraphs that set only their alignment, without strokes, effects or an appearance of its own, becomes editable type layers with their pixels; a layer holding it becomes a group, unless other art in it blends in a mode other than normal; refused with layers: false), maxEditability?: false (layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer), hiddenLayers?: false (hidden layers and objects written hidden instead of left out), embedIcc?: true (at most 30000 pixels a side; formats without alpha are flattened on white)} → {path, format, bytes, warnings, files?: [path…] (several), linked?: [path…] (linked images, image maps)}; no path → {dataBase64, format, bytes, warnings, files?: [{name, dataBase64}], linked?: [{name, dataBase64}]}. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg and svgz, and the files that carry the native document (vectorcraft, template, eps, ai of every artboard with useArtboards not false but a version 7 file, pdf of every artboard with preserveEditing on and useArtboards not false), are refused, before any file is written, while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked), or while the file would name a linked image's file outside them (images: link, preserveEditing, or an image whose pixels the document doesn't hold; a URL is not checked). Never changes the document's path", + "{path?, format?: svg|svgz|pdf|ai|png|jpg|webp|gif|png8|txt|dxf|eps|emf|wmf|pict|hpgl|tiff|bmp|tga|psd|cmx|vectorcraft|template (default: from the path's extension, else png; png8 writes an indexed .png; ait, a .ait template, is written by file.saveAsTemplate; an exporter plug-in's format is plugin., which an extension only it lists picks too), params?: {…} (an exporter plug-in's parameters; missing ones take their defaults, see plugin.info), selectedOnly?: false (the selected objects alone, in the layers and groups that hold them; an object of a blend, envelope, repeat or intertwine on its own), includeArtboardFill?: true (raster, PDF, SVG and EPS draw each exported artboard's background color behind its art, a transparent background too; false leaves it out), artboard?: 0, artboards?: [i…], rect?: [x, y, width, height] (raster formats: that area of the page in points, y down, instead of an artboard; not with artboard, artboards, range or useArtboards), range?: \"1-3, 5\" | \"all\" (1-based; PDF and .ai write one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard), useArtboards?: true (raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf/ai: every page) | false (pdf/ai/raster: the bounds of the visible art; pdf/ai: of the layers the file draws, without editing data, with a warning, and ai refuses pdfCompatible: false; SVG has it as an SVG option), ppi?: number (raster formats: pixels per inch, stored in the file; wins over scale; without either, the document's raster effects resolution), scale?: number (pixels per point), background?: transparent|white|black|\"#rrggbb\" (jpg: white when transparent; #rrggbbaa and #rgba are refused here and in matte), antiAlias?: none|art (default)|type (text snapped to pixels), interlaced?: false (png, Adam7), embedIcc?: true (png: an sRGB chunk marks the colours as sRGB), quality?: 90 (jpg: 0–100), colorModel?: rgb|cmyk|gray (jpg), method?: baseline|optimized|progressive, scans?: 3 (3–5, progressive), embedIcc?: true, imageMap?: none|client|server (an HTML or NCSA map of the objects with a URL, written as .html / .map), colors?: 256 (gif/png8: 2–256), reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray, dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, transparency?: true, transparencyDither?: none (default: pixels under half opacity become transparent)|diffusion|pattern|noise (with transparency: as document.exportForWeb), transparencyDitherAmount?: 100 (0–100: the diffusion transparency dither's strength), matte?: white|\"#rrggbb\"|none, interlaced?, lossless?: true (webp: every pixel kept exactly; false writes lossy WebP, a smaller file that loses some detail), quality?: 90 (webp with lossless: false: 0–100, higher keeps more detail in a larger file; more than 100 is refused), embedIcc?: true (webp: the sRGB profile in an ICCP chunk), encoding?: utf8|utf16 (txt: the stories in stacking order, back to front, a thread once; utf16 with a byte order mark), lineEndings?: lf|crlf, selectionOnly?: false, svg?: {styling, outlineText, images, objectIds, decimals, minify, responsive, units, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts, variableData} (see document.formats), …the SVG options given flat instead, …the PDF options of document.exportPdf, …the DXF options of document.exportDxf (useArtboards: one drawing per artboard), …the EPS options of document.exportEps (useArtboards: one file per artboard, {stem}_{artboard}.eps, after a central {stem}.eps of the whole document when there are two or more and art shows; else the visible art), …emf and wmf write one picture of the artboard (useArtboards: true one file per chosen artboard, false the bounds of the visible art; EMF keeps curves, clipping, transparent images and gradients as images clipped to their shape; WMF flattens curves into polygons behind a placeable header; what a format leaves out comes back in warnings), …pict writes a QuickDraw version 2 picture (.pct) of the artboard as emf and wmf do (up to 16 device units a point; at most 32,767 points on a side; fills as polygons, strokes as their filled outlines and images over white; what it leaves out comes back in warnings), …hpgl writes a plot of the artboard as pen moves for plotters and cutters (each visible path once along its line in plotter units; useArtboards: true one file per chosen artboard, false the bounds of the art it plots, without placed images, unpainted paths and art at 0% opacity), hpglVersion?: hpgl (default: IN, SP, PU, PD) | hpgl2 (also NP and PC pen colors, each pen's paths as one encoded polyline PE), curveTolerance?: 0.1 (points, 0.01 to 10), pens?: [\"#rrggbb\"…] (pen 1 first, up to 255; each path takes the nearest; default a pen per color in the order the art first draws in it, numbered alike in every file), origin?: bottomLeft (default) | center, sortPaths?: false (each pen's next path the nearest), insideFirst?: false (a path after the pen's paths that lie inside it), …cmx writes one file with a page for the artboard (useArtboards: true a page for each chosen artboard, false the bounds of the visible art; a layer for each layer with art on the page, holding the art's fills and strokes as curves in their colors: CMYK, RGB, gray, spot colors at their tints, Registration; type as outlines, gradients and patterns as one color, nonzero fills as even-odd, dashes in whole stroke widths, no miter limit, art across a page's edge written whole, without images, clipping masks or transparency; warnings name each of these losses), colorModel?: rgb|cmyk|gray (tiff: rgb keeps transparency as an alpha channel), lzw?: true, byteOrder?: little|big, embedIcc?: true, colorModel?: rgb|gray (bmp), depth?: 24 (bmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha), fileFormat?: windows|os2 (1, 4, 8 or 24 bits), rle?: false (4 and 8 bits, windows), flipRows?: false (top-down rows), depth?: 24 (tga: 16 one-bit alpha, 24, 32 with alpha), colorModel?: rgb|cmyk|gray (psd), layers?: true (each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white), preserveText?: false (with layers: horizontal and vertical point type in solid colors, with left-to-right paragraphs that set only their alignment, without strokes, effects or an appearance of its own, becomes editable type layers with their pixels; a layer holding it becomes a group, unless other art in it blends in a mode other than normal; refused with layers: false), maxEditability?: false (layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer), hiddenLayers?: false (hidden layers and objects written hidden instead of left out), embedIcc?: true (at most 30000 pixels a side; formats without alpha are flattened on white)} → {path, format, bytes, warnings, files?: [path…] (several), linked?: [path…] (linked images, image maps)}; no path → {dataBase64, format, bytes, warnings, files?: [{name, dataBase64}], linked?: [{name, dataBase64}]}. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg and svgz, and the files that carry the native document (vectorcraft, template, eps, ai of every artboard with useArtboards not false but a version 7 file, pdf of every artboard with preserveEditing on and useArtboards not false), are refused, before any file is written, while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked), or while the file would name a linked image's file outside them (images: link, preserveEditing, or an image whose pixels the document doesn't hold; a URL is not checked). Never changes the document's path", has_doc, export::export ), @@ -45,7 +45,7 @@ pub fn specs() -> Vec { "Export Selection…", ["File"], None, - "{path?, format?: png|jpg|webp|svg|svgz|pdf|ai|gif|png8|tiff|bmp|tga|psd|txt|dxf|eps|emf|wmf|hpgl|cmx|vectorcraft|template (default: from the extension, else png), ppi?: number (raster formats: pixels per inch, stored in the file; wins over scale; without either, the document's raster effects resolution), scale?: number (pixels per point), …the format's options} the selected objects (template layers left out), each in the layers and groups that hold it, whose clipping paths, opacity masks, effects, opacity and blend modes apply as on the canvas (an object of a blend, envelope, repeat or intertwine on its own; txt: the selected type alone), cropped to the bounds the renderer measures for that art (a clip group by its clip) → {path, format, bytes, warnings, bounds} (no path → {dataBase64, format, bytes, warnings, bounds}); warnings say what the format approximated or left out, as for document.export. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg, svgz and the files that carry the native document are refused while the document links a JavaScript file outside them, or while the file would name a linked image's file outside them (an image among the selected objects), as document.export refuses them. In the app, with no params or {}, the save panel picks the file and its format's options dialog follows (Save PDF, SVG Options, the raster options, EPS Options, DXF Options, Text Export Options or an exporter plug-in's parameters; other formats are written at once), whose OK writes the selection: the call returns null while the dialog is open, and OK returns what file.exportAs returns, without format or bounds (Text Export Options: {path})", + "{path?, format?: png|jpg|webp|svg|svgz|pdf|ai|gif|png8|tiff|bmp|tga|psd|txt|dxf|eps|emf|wmf|pict|hpgl|cmx|vectorcraft|template (default: from the extension, else png), ppi?: number (raster formats: pixels per inch, stored in the file; wins over scale; without either, the document's raster effects resolution), scale?: number (pixels per point), …the format's options} the selected objects (template layers left out), each in the layers and groups that hold it, whose clipping paths, opacity masks, effects, opacity and blend modes apply as on the canvas (an object of a blend, envelope, repeat or intertwine on its own; txt: the selected type alone), cropped to the bounds the renderer measures for that art (a clip group by its clip) → {path, format, bytes, warnings, bounds} (no path → {dataBase64, format, bytes, warnings, bounds}); warnings say what the format approximated or left out, as for document.export. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg, svgz and the files that carry the native document are refused while the document links a JavaScript file outside them, or while the file would name a linked image's file outside them (an image among the selected objects), as document.export refuses them. In the app, with no params or {}, the save panel picks the file and its format's options dialog follows (Save PDF, SVG Options, the raster options, EPS Options, DXF Options, Text Export Options or an exporter plug-in's parameters; other formats are written at once), whose OK writes the selection: the call returns null while the dialog is open, and OK returns what file.exportAs returns, without format or bounds (Text Export Options: {path})", has_selection, export::export_selection ), diff --git a/crates/engine/src/cmd/fileio/encode.rs b/crates/engine/src/cmd/fileio/encode.rs index fd46b7b4ca..39cff5e6e1 100644 --- a/crates/engine/src/cmd/fileio/encode.rs +++ b/crates/engine/src/cmd/fileio/encode.rs @@ -1073,7 +1073,7 @@ fn encode_all_of(doc: &Document, format: &str, p: &Value) -> Result { } // Formats that draw type: missing fonts come out in the fallback font (PDF and SVG say so // themselves: SVG only when it outlines or embeds fonts). - if (f.raster || matches!(f.id, "eps" | "emf" | "wmf" | "hpgl" | "cmx")) + if (f.raster || matches!(f.id, "eps" | "emf" | "wmf" | "pict" | "hpgl" | "cmx")) && let Some(w) = crate::cmd::fonts::substitution_warning(doc) { enc.warnings.push(w); @@ -1114,7 +1114,8 @@ fn encode_files(doc: &Document, f: &Format, p: &Value) -> Result { let doc = &*doc.without_edit_modes(); let n = doc.artboards.len(); // SVG reads its own `useArtboards` (an SVG option). - let use_artboards = if f.raster || matches!(f.id, "pdf" | "ai" | "dxf" | "emf" | "wmf" | "hpgl" | "cmx") { use_artboards(C, p)? } else { None }; + let use_artboards = + if f.raster || matches!(f.id, "pdf" | "ai" | "dxf" | "emf" | "wmf" | "pict" | "hpgl" | "cmx") { use_artboards(C, p)? } else { None }; // `rect`: that area of the page, as if it were the only artboard (the document is not changed). if let Some(rect) = page_rect(f, p)? { let mut q = super::export::without_artboards(p); @@ -1159,6 +1160,7 @@ fn encode_files(doc: &Document, f: &Format, p: &Value) -> Result { "eps" => return super::eps::encode(doc, p), "emf" => return super::metafile::encode(doc, p, use_artboards, vectorcraft_metafile::Kind::Emf), "wmf" => return super::metafile::encode(doc, p, use_artboards, vectorcraft_metafile::Kind::Wmf), + "pict" => return super::metafile::encode(doc, p, use_artboards, vectorcraft_metafile::Kind::Pict), "hpgl" => return super::hpgl::encode(doc, p, use_artboards), "cmx" => return super::cmx::encode(doc, f, p, use_artboards), "ai" => return super::save::encode_ai(C, f, doc, p), diff --git a/crates/engine/src/cmd/fileio/formats.rs b/crates/engine/src/cmd/fileio/formats.rs index ff20e5046a..0e045d9534 100644 --- a/crates/engine/src/cmd/fileio/formats.rs +++ b/crates/engine/src/cmd/fileio/formats.rs @@ -575,8 +575,18 @@ pub const FORMATS: &[Format] = &[ // `.cmx` exchange files with 32-bit coordinates, read and written by `craft-cdr`: a page for // each chosen artboard, with the art's fills and strokes in their colors. Format { id: "cmx", label: "CMX", extensions: &["cmx"], mime: "image/x-cmx", read: true, write: true, raster: false, options: cmx::OPTIONS }, - // QuickDraw pictures, read by `vectorcraft_metafile::import_pict` into paths, type and images. - reader("pict", "PICT", &["pct", "pic", "pict"], "image/x-pict", false), + // QuickDraw pictures, read by `vectorcraft_metafile::import_pict` into paths, type and images, + // and written by `vectorcraft_metafile::export` as version 2 pictures (`.pct`). + Format { + id: "pict", + label: "PICT", + extensions: &["pct", "pic", "pict"], + mime: "image/x-pict", + read: true, + write: true, + raster: false, + options: metafile::OPTIONS, + }, // Layered raster `.pcraft` documents, read by `pcraftread` as one image: the full-size // composite, the layers combined, or the preview with a note. Exports don't write them. reader("pcraft", "PCRAFT", &["pcraft"], "application/x-pcraft", true), diff --git a/crates/engine/src/cmd/fileio/metafile.rs b/crates/engine/src/cmd/fileio/metafile.rs index 3012f7c238..f26e9d7c38 100644 --- a/crates/engine/src/cmd/fileio/metafile.rs +++ b/crates/engine/src/cmd/fileio/metafile.rs @@ -2,7 +2,7 @@ //! `document.export {format: emf|wmf}` and Export As (one picture of an artboard, or one per //! artboard with Use Artboards; raster effects as images, rendered at the document's raster //! effects resolution), `document.open` and File → Place (one artboard, the picture's frame). -//! QuickDraw pictures (PICT) open and place the same way; they are never written. +//! QuickDraw pictures (PICT) are written (`format: pict`) and open and place the same way. use serde_json::Value; use vectorcraft_doc::Document; @@ -13,7 +13,7 @@ use super::{ArtboardPick, Encoded, FormatOption}; const C: &str = "document.export"; -/// The options `document.formats` lists for EMF and WMF. +/// The options `document.formats` lists for EMF, WMF and PICT. pub(super) const OPTIONS: &[FormatOption] = &[super::ARTBOARD, super::ARTBOARDS, super::RANGE, super::USE_ARTBOARDS]; /// Encode `doc` as `kind`: the chosen artboard (default the first), or with `use_artboards` one @@ -45,7 +45,7 @@ pub(super) fn encode_flattening( .iter() .map(|&b| doc.artboards.get(b).map(|a| a.rect).ok_or_else(|| bad(C, format!("no artboard {}", b + 1)))) .collect::>>()?; - vectorcraft_metafile::check_regions(&rects).map_err(|e| bad(C, e))?; + vectorcraft_metafile::check_regions_for(&rects, kind).map_err(|e| bad(C, e))?; // Raster effects (shadows, glows, blurs) as images, as PDF export does. let flat = flatten(doc); let src = flat.as_ref().unwrap_or(doc); diff --git a/crates/engine/src/cmd/fileio/screens.rs b/crates/engine/src/cmd/fileio/screens.rs index 1c67a44203..fee253a2d1 100644 --- a/crates/engine/src/cmd/fileio/screens.rs +++ b/crates/engine/src/cmd/fileio/screens.rs @@ -196,7 +196,7 @@ pub(super) fn name_without_device(name: &str) -> String { pub(crate) const ROW_KEYS: [&str; 7] = ["format", "scale", "ppi", "width", "height", "suffix", "folder"]; /// The writable formats a format row can't name. -pub(crate) const UNWRITTEN_FORMATS: [&str; 7] = ["template", "txt", "dxf", "emf", "wmf", "hpgl", "cmx"]; +pub(crate) const UNWRITTEN_FORMATS: [&str; 8] = ["template", "txt", "dxf", "emf", "wmf", "hpgl", "cmx", "pict"]; /// One format row: what to write, at which size, with which suffix, into which sub-folder. struct Row { diff --git a/crates/engine/src/cmd/fileio/tests.rs b/crates/engine/src/cmd/fileio/tests.rs index 9c86777182..4aebde39b3 100644 --- a/crates/engine/src/cmd/fileio/tests.rs +++ b/crates/engine/src/cmd/fileio/tests.rs @@ -533,7 +533,8 @@ fn export_extensions_name_every_writable_format() { "plt", "tga", "psd", - "cmx" + "cmx", + "pct" ] ); for e in exts { @@ -570,7 +571,8 @@ fn formats_query_lists_readers_writers_and_options() { "hpgl", "tga", "psd", - "cmx" + "cmx", + "pict" ] ); assert!(ids("readable").contains(&"tiff".to_string()) && ids("readable").contains(&"ait".to_string())); diff --git a/crates/engine/src/cmd/fileio/tests_dxf.rs b/crates/engine/src/cmd/fileio/tests_dxf.rs index dfd5775bc1..67cf497399 100644 --- a/crates/engine/src/cmd/fileio/tests_dxf.rs +++ b/crates/engine/src/cmd/fileio/tests_dxf.rs @@ -326,9 +326,9 @@ fn dwg_and_pagemaker_say_what_to_use_instead() { let e = s.execute("document.export", &p).unwrap_err().to_string(); assert!(e.contains("DWG files open but can't be written") && e.contains("export DXF instead"), "{p}: {e}"); } - // PICT opens; it isn't written. - let e = s.execute("document.export", &json!({"format": "pict"})).unwrap_err().to_string(); - assert!(e.contains("PICT files can be opened but not written"), "{e}"); + // PCX opens; it isn't written. + let e = s.execute("document.export", &json!({"format": "pcx"})).unwrap_err().to_string(); + assert!(e.contains("PCX files can be opened but not written"), "{e}"); let e = s .execute("document.open", &json!({"name": "old.pct", "dataBase64": vectorcraft_format::base64_encode(&[0u8; 600])})) .unwrap_err() diff --git a/crates/engine/src/cmd/fileio/tests_pict.rs b/crates/engine/src/cmd/fileio/tests_pict.rs index 513adffbef..b0e7c58670 100644 --- a/crates/engine/src/cmd/fileio/tests_pict.rs +++ b/crates/engine/src/cmd/fileio/tests_pict.rs @@ -1,6 +1,6 @@ //! PICT pictures through the commands: `document.open` by extension or by content, File › Place as -//! one group clipped to the picture's frame, the dialogs' filters and the format list, and files -//! that aren't pictures, or a PICT export, refused with a message. +//! one group clipped to the picture's frame, `document.export` of one artboard or each, the dialogs' +//! filters and the format list, and files that aren't pictures refused with a message. use serde_json::json; use vectorcraft_doc::NodeKind; @@ -83,8 +83,47 @@ fn files_that_are_not_pictures_are_refused() { let mut png = b"\x89PNG\r\n\x1a\n".to_vec(); png.extend(&picture()[8..]); assert!(detect("x.png", &png).is_none_or(|f| f.id != "pict")); - let e = s.execute("document.export", &json!({"format": "pict"})).expect_err("refused").to_string(); - assert!(e.contains("PICT files can be opened but not written"), "{e}"); +} + +fn data(r: &serde_json::Value) -> Vec { + vectorcraft_format::base64_decode(r["dataBase64"].as_str().expect("dataBase64")).unwrap() +} + +#[test] +fn document_export_writes_a_picture_that_opens_again() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 100, "height": 100, "artboards": 2})).unwrap(); + let second = s.doc().unwrap().doc.artboards[1].rect.x0; + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + s.execute("shape.rectangle", &json!({"x": second + 50.0, "y": 5, "width": 20, "height": 10})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + s.execute("shape.rectangle", &json!({"x": 10, "y": 20, "width": 30, "height": 40})).unwrap(); + let r = s.execute("document.export", &json!({"format": "pict"})).unwrap(); + assert_eq!((r["format"].as_str(), &r["warnings"]), (Some("pict"), &json!([])), "{r}"); + let bytes = data(&r); + assert_eq!(detect("x.bin", &bytes).map(|f| f.id), Some("pict")); + assert_eq!(writable_format(None, Some("x/logo.pct")).unwrap().id, "pict"); + // The first artboard: its red rectangle, in place. + let mut back = Session::new(); + back.execute("document.open", &json!({"name": "logo.pct", "dataBase64": b64(&bytes)})).unwrap(); + let doc = &back.doc().unwrap().doc; + assert_eq!(doc.artboards[0].rect.size(), (100.0, 100.0).into()); + let mut paths = vec![]; + doc.walk(|n| { + if let NodeKind::Path { .. } = n.kind { + paths.push(n.clone()); + } + }); + assert_eq!(paths.len(), 1); + let b = paths[0].geometric_bounds().unwrap(); + let want = vectorcraft_geom::Rect::new(10.0, 20.0, 40.0, 60.0); + assert!([b.x0 - want.x0, b.y0 - want.y0, b.x1 - want.x1, b.y1 - want.y1].iter().all(|d| d.abs() < 0.07), "{b:?}"); + assert_eq!(paths[0].appearance.fill().and_then(|f| f.paint.color()).map(|c| c.to_rgba8(1.0)), Some([255, 0, 0, 255])); + // Use Artboards: one picture each. + let r = s.execute("document.export", &json!({"format": "pict", "useArtboards": true})).unwrap(); + let files = r["files"].as_array().unwrap(); + assert_eq!(files.len(), 2); + assert!(files[1]["name"].as_str().unwrap().ends_with("-Artboard-2.pct"), "{files:?}"); } #[test] @@ -98,7 +137,6 @@ fn the_dialogs_and_the_format_list_name_pict() { assert!(open_filters().any(|f| f == filter) && place_filters().any(|f| f == filter)); let r = Session::new().execute("document.formats", &json!({})).unwrap(); let f = r["formats"].as_array().unwrap().iter().find(|f| f["id"] == "pict").unwrap().clone(); - assert_eq!((f["read"].as_bool(), f["write"].as_bool(), f["raster"].as_bool()), (Some(true), Some(false), Some(false)), "{f}"); + assert_eq!((f["read"].as_bool(), f["write"].as_bool(), f["raster"].as_bool()), (Some(true), Some(true), Some(false)), "{f}"); assert_eq!(f["mime"], "image/x-pict"); - assert!(writable_format(None, Some("x/logo.pct")).is_err()); } diff --git a/crates/mcp/src/tests/fileio.rs b/crates/mcp/src/tests/fileio.rs index f8c3689f99..093bf42af6 100644 --- a/crates/mcp/src/tests/fileio.rs +++ b/crates/mcp/src/tests/fileio.rs @@ -81,7 +81,8 @@ fn export_tool_lists_engine_formats_and_options() { "hpgl", "tga", "psd", - "cmx" + "cmx", + "pict" ]) ); for k in ["artboard", "range", "options"] { diff --git a/crates/mcp/src/tools/definitions.rs b/crates/mcp/src/tools/definitions.rs index 1e9740fa37..0c6b82c309 100644 --- a/crates/mcp/src/tools/definitions.rs +++ b/crates/mcp/src/tools/definitions.rs @@ -400,7 +400,7 @@ pub fn tool_definitions() -> Vec { tool( "export", "Export", - "Export the active document with the engine's document.export (the same bytes in the app and headless), in any format of the `format` enum: vectors (svg/svgz with the artboard as viewBox, eps, dxf, emf, wmf, hpgl pen moves for plotters and cutters, cmx exchange files of fills and strokes), pdf and ai (one page per artboard: all, or `artboard` / `range`; ai is the PDF-compatible .ai file that Save writes, which carries the document when every artboard is written in order), rasters (one rendered artboard: png, jpg, webp, gif, png8 as an indexed .png, tiff, bmp, tga, psd with its layers), txt (the stories, back to front), vectorcraft or template (a native copy or template; the document keeps its path). run_command document.formats lists each format's options. For SVG/SVGZ, top-level `outlineText: true` writes text as paths; DXF takes it too (its type is outlined anyway unless `preserve: editability`). PDF instead uses `options.advanced.outlineText: true`, default false (live text). `selection: true` exports only the selected objects, cropped to their bounds. Template layers are left out; live effects are kept (geometry baked, SVG filters for shadows/glows/blur). Without `path` the bytes come back as dataBase64.", + "Export the active document with the engine's document.export (the same bytes in the app and headless), in any format of the `format` enum: vectors (svg/svgz with the artboard as viewBox, eps, dxf, emf, wmf, hpgl pen moves for plotters and cutters, cmx exchange files of fills and strokes, pict QuickDraw pictures as .pct), pdf and ai (one page per artboard: all, or `artboard` / `range`; ai is the PDF-compatible .ai file that Save writes, which carries the document when every artboard is written in order), rasters (one rendered artboard: png, jpg, webp, gif, png8 as an indexed .png, tiff, bmp, tga, psd with its layers), txt (the stories, back to front), vectorcraft or template (a native copy or template; the document keeps its path). run_command document.formats lists each format's options. For SVG/SVGZ, top-level `outlineText: true` writes text as paths; DXF takes it too (its type is outlined anyway unless `preserve: editability`). PDF instead uses `options.advanced.outlineText: true`, default false (live text). `selection: true` exports only the selected objects, cropped to their bounds. Template layers are left out; live effects are kept (geometry baked, SVG filters for shadows/glows/blur). Without `path` the bytes come back as dataBase64.", obj( json!({ "format": {"type": "string", "enum": FORMATS.iter().filter(|f| f.write).map(|f| f.id).collect::>(), "description": "Default: from the path's extension"}, diff --git a/crates/metafile/Cargo.toml b/crates/metafile/Cargo.toml index 364f5c55d3..8e8cc124f4 100644 --- a/crates/metafile/Cargo.toml +++ b/crates/metafile/Cargo.toml @@ -3,7 +3,7 @@ name = "vectorcraft-metafile" version.workspace = true edition.workspace = true license.workspace = true -description = "VectorCraft metafiles: EMF and WMF export and EMF, EMF+, WMF and QuickDraw PICT import through craft-metafile" +description = "VectorCraft metafiles: EMF, WMF and QuickDraw PICT export and EMF, EMF+, WMF and PICT import through craft-metafile" [lints] workspace = true @@ -13,6 +13,7 @@ vectorcraft-geom = { workspace = true } vectorcraft-color = { workspace = true } vectorcraft-doc = { workspace = true } vectorcraft-effects = { workspace = true } +vectorcraft-pathops = { workspace = true } vectorcraft-brush = { workspace = true } vectorcraft-text = { workspace = true } craft-metafile = { workspace = true, features = ["write"] } diff --git a/crates/metafile/src/encode.rs b/crates/metafile/src/encode.rs index 708f386958..cf171a70de 100644 --- a/crates/metafile/src/encode.rs +++ b/crates/metafile/src/encode.rs @@ -1,4 +1,5 @@ -//! Translate VectorCraft's drawing operations to the shared metafile writers. +//! Translate VectorCraft's drawing operations to the shared metafile writers (EMF, WMF) and to +//! the PICT writer. use craft_metafile::{ Cap, Join, write::{self, Dash, Op, Pen}, @@ -9,11 +10,30 @@ use vectorcraft_geom::{FillRule, Rect}; use crate::{Kind, scene}; pub(crate) fn write(ops: Vec, region: Rect, kind: Kind, title: &str, warnings: &mut Vec) -> Result, String> { - let ops: Vec<_> = ops.into_iter().map(|op| convert(op, kind)).collect(); let invalid = || "the export region is empty".to_string(); + let mut note = |lost: bool, warning: &str| { + if lost && !warnings.iter().any(|w| w == warning) { + warnings.push(warning.to_string()); + } + }; match kind { - Kind::Emf => write::emf(&ops, region, "VectorCraft", title).ok_or_else(invalid), + Kind::Pict => { + crate::pict::check_region(region)?; + let out = crate::pict::write(&ops, region); + note(out.translucent_images, "PICT has no transparency: images are written over white"); + note(out.turned_images, "PICT turns images only by quarter turns: other turns and skews are written upright, filling their bounds"); + note(out.split_fills, "fills with more than 16,381 points are written as several polygons, which may fill their holes"); + note(out.thinned_fills, "outlines with more than 16,379 points are written with fewer points"); + note(out.unresolved_fills, "non-zero fills too complex to resolve are written even-odd, which may leave overlaps unfilled"); + note(out.uncut_fills, "fills too complex to cut to the artboard that reach far outside it may be written distorted"); + Ok(out.bytes) + } + Kind::Emf => { + let ops: Vec<_> = ops.into_iter().map(|op| convert(op, kind)).collect(); + write::emf(&ops, region, "VectorCraft", title).ok_or_else(invalid) + } Kind::Wmf => { + let ops: Vec<_> = ops.into_iter().map(|op| convert(op, kind)).collect(); let out = write::wmf(&ops, region).ok_or_else(invalid)?; for (lost, warning) in [ (out.translucent_images, "WMF has no transparency: images are written over white"), @@ -21,9 +41,7 @@ pub(crate) fn write(ops: Vec, region: Rect, kind: Kind, title: &str, (out.clips_ignored, "clipping masks are not applied: the art they clip is written whole"), (out.oversized_images, "WMF images with a side over 32,767 pixels were left out"), ] { - if lost && !warnings.iter().any(|w| w == warning) { - warnings.push(warning.to_string()); - } + note(lost, warning); } Ok(out.bytes) } diff --git a/crates/metafile/src/import/picture.rs b/crates/metafile/src/import/picture.rs index a32c37ff84..433025635a 100644 --- a/crates/metafile/src/import/picture.rs +++ b/crates/metafile/src/import/picture.rs @@ -1088,7 +1088,11 @@ fn retracked(t: &TextObject, laid: &vectorcraft_text::TextLayout, dx: &[f64]) -> /// Read an EMF or WMF file. pub(crate) fn import(bytes: &[u8]) -> Result { - let kind = crate::sniff(bytes).ok_or("not an EMF or WMF file")?; + let wire_kind = craft_metafile::sniff(bytes).ok_or("not an EMF or WMF file")?; + let kind = match wire_kind { + craft_metafile::Kind::Emf => Kind::Emf, + craft_metafile::Kind::Wmf => Kind::Wmf, + }; let pic = craft_metafile::parse(bytes).map_err(|e| match e { craft_metafile::Error::NotMetafile | craft_metafile::Error::NotPict => "not an EMF or WMF file".to_string(), craft_metafile::Error::BadHeader => format!("the {} header is damaged", kind.id().to_uppercase()), @@ -1096,10 +1100,6 @@ pub(crate) fn import(bytes: &[u8]) -> Result { })?; let k = unit(bytes); let mut m = Mapper::new(f64::from(pic.width), f64::from(pic.height), k); - let wire_kind = match kind { - Kind::Emf => craft_metafile::Kind::Emf, - Kind::Wmf => craft_metafile::Kind::Wmf, - }; if craft_metafile::ends_early(bytes, wire_kind) { m.warn(ENDS_EARLY); } diff --git a/crates/metafile/src/lib.rs b/crates/metafile/src/lib.rs index 66f3c4327b..df852fb02a 100644 --- a/crates/metafile/src/lib.rs +++ b/crates/metafile/src/lib.rs @@ -1,4 +1,5 @@ -//! Windows metafiles: hand-written EMF and WMF writers and readers. +//! Windows metafiles: hand-written EMF and WMF writers and readers, and a QuickDraw picture (PICT) +//! writer and reader. //! //! [`export`] writes the visible art over one region of a document (an artboard) as a metafile, //! and [`export_regions`] one metafile per region: @@ -13,6 +14,9 @@ //! placeable header that gives the size; WMF has no clipping paths, transparency, dashes on wide //! lines or gradients, so clipped art is written whole, images over white, dashes as separate //! lines and gradients and patterns as one colour (each loss comes back as a warning). +//! - **PICT**: the art WMF gets, as a QuickDraw version 2 picture in device units of up to 16 to a +//! point: fills are polygons cut to the picture's frame, strokes their filled outlines, and images +//! 24-bit pixel maps over white (see `pict`). //! //! [`import`] reads either format (an EMF with its EMF+ records too, through `craft_metafile`) //! into a document of one artboard (the picture's frame) and one layer: paths with fills and @@ -33,26 +37,31 @@ mod bytes; mod dib; mod encode; mod import; +mod pict; mod scene; use vectorcraft_doc::Document; use vectorcraft_geom::Rect; -/// A Windows metafile format. +/// A metafile format: the Windows metafiles, and QuickDraw pictures, which [`export`] writes and +/// [`is_pict`] and [`import_pict`] read ([`sniff`] and [`import`] read only the Windows formats). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Kind { /// Enhanced Metafile (32-bit coordinates, Bézier curves, paths and clipping). Emf, /// Windows Metafile with a placeable header (16-bit coordinates, polygons). Wmf, + /// QuickDraw picture, version 2, in a PICT file (16-bit coordinates, polygons). + Pict, } impl Kind { - /// The format id (`emf`, `wmf`). + /// The format id (`emf`, `wmf`, `pict`). pub fn id(self) -> &'static str { match self { Self::Emf => "emf", Self::Wmf => "wmf", + Self::Pict => "pict", } } } @@ -93,11 +102,21 @@ pub fn check_regions(regions: &[Rect]) -> Result<(), String> { Ok(()) } +/// [`check_regions`] for `kind`: a PICT picture's frame is also at most 32,767 points on a side. +pub fn check_regions_for(regions: &[Rect], kind: Kind) -> Result<(), String> { + check_regions(regions)?; + if kind == Kind::Pict { + regions.iter().try_for_each(|r| pict::check_region(r.abs()))?; + } + Ok(()) +} + /// Write the visible art of `doc` over each of `regions` as `kind`, one metafile per region in the /// same order, each as [`export`] writes it over that region. The live effects are applied once -/// for all of them. When any region is empty, nothing is written and the result is an error. +/// for all of them. When any region is empty (or, for PICT, over 32,767 points on a side), +/// nothing is written and the result is an error. pub fn export_regions(doc: &Document, regions: &[Rect], kind: Kind) -> Result, String> { - check_regions(regions)?; + check_regions_for(regions, kind)?; let regions: Vec = regions.iter().map(|r| r.abs()).collect(); if regions.is_empty() { return Ok(Vec::new()); diff --git a/crates/metafile/src/pict.rs b/crates/metafile/src/pict.rs new file mode 100644 index 0000000000..043618aa2b --- /dev/null +++ b/crates/metafile/src/pict.rs @@ -0,0 +1,537 @@ +//! The PICT writer: a QuickDraw version 2 picture with the extended header, behind a PICT file's +//! 512 bytes of application data, by the opcodes and data layouts of Apple's *Imaging With +//! QuickDraw*, appendix A. +//! +//! The picture frame is the region in points; the drawing is in device units of up to 16 to a +//! point (the header's resolution, at most 1,152 dpi), as many as keep the frame within 16-bit +//! coordinates. QuickDraw has no curves, Bézier paths or pens with joins, so: +//! +//! - fills are polygons (`PaintPoly`) in the fill's color, filled even-odd as QuickDraw fills +//! polygons: a path of several figures is one polygon that runs back along the line between its +//! figures, and a non-zero fill is first resolved into figures that do not overlap. Art is cut +//! to the frame first, which keeps every coordinate within 16 bits. +//! - strokes are their outlines (dashes cut first), filled the same way. +//! - images are `DirectBitsRect` records of 24-bit pixels in tiles of at most 1,024 pixels on a +//! side, packed by rows with PackBits; transparency is composited over white, and images that +//! are turned or skewed by other than a quarter turn are written upright, filling their bounds. + +use std::sync::Arc; + +use craft_metafile::write::Image; +use kurbo::{Affine, BezPath, PathEl, Point, Rect, Shape}; +use vectorcraft_color::Paint; +use vectorcraft_doc::StrokeLayer; +use vectorcraft_geom::{FillRule, PathData}; + +use crate::scene::{Op, Pen}; + +/// The application data before the picture in a PICT file. +const FILE_HEADER: usize = 512; +/// The largest 16-bit coordinate. +const MAX_I16: f64 = 32767.0; +/// Most device units a point (16, 1,152 dpi). +const MAX_SCALE: f64 = 16.0; +/// Most points a polygon holds: its size, in bytes with its 10-byte head, is a signed 16-bit count. +const MAX_POLY_POINTS: usize = (i16::MAX as usize - 10) / 4; +/// Curves are flattened to within this many device units. +const FLATNESS: f64 = 0.25; +/// Times the flatness is raised (four-fold each time) for a fill with too many points before it +/// is split into several polygons. +const COARSER: u32 = 3; +/// Most pixels along a side of one image record. +const TILE: usize = 1024; +/// Opacity at or above this is written as opaque. +const OPAQUE: f32 = 0.998; + +// Opcodes (*Imaging With QuickDraw*, table A-2). +const CLIP: u16 = 0x0001; +const PN_MODE: u16 = 0x0008; +const PN_PAT: u16 = 0x0009; +const VERSION: u16 = 0x0011; +const RGB_FG_COL: u16 = 0x001A; +const PAINT_POLY: u16 = 0x0071; +const DIRECT_BITS_RECT: u16 = 0x009A; +const OP_END_PIC: u16 = 0x00FF; +const HEADER_OP: u16 = 0x0C00; +/// The `patCopy` transfer mode. +const PAT_COPY: u16 = 8; + +/// A written picture and what it could not hold. +#[derive(Clone, Debug, Default, PartialEq)] +pub(crate) struct Pict { + pub bytes: Vec, + /// Images with transparency were written over white. + pub translucent_images: bool, + /// Turned or skewed images were written upright, filling their bounds. + pub turned_images: bool, + /// A fill with more points than one polygon holds was written as several polygons, so its + /// holes may be filled. + pub split_fills: bool, + /// A figure with more points than one polygon holds was written with fewer. + pub thinned_fills: bool, + /// A non-zero fill too complex to resolve into figures that don't overlap was written even-odd. + pub unresolved_fills: bool, + /// A fill too complex to cut to the frame was written with its points past 16 bits moved in. + pub uncut_fills: bool, +} + +/// The device units a point for a picture `w` × `h` points: the most, up to [`MAX_SCALE`], that +/// keep its size within 16 bits. +fn units_per_point(w: f64, h: f64) -> f64 { + let side = w.max(h); + if side > 0.0 { (MAX_I16 / side).floor().clamp(1.0, MAX_SCALE) } else { MAX_SCALE } +} + +/// The error for a region the picture frame can't hold: a side over 32,767 points. +pub(crate) fn check_region(region: Rect) -> Result<(), String> { + if region.width().round() > MAX_I16 || region.height().round() > MAX_I16 { + return Err("PICT pictures are at most 32,767 points on a side".into()); + } + Ok(()) +} + +/// Big-endian bytes being written. +struct Out(Vec); + +impl Out { + fn u8(&mut self, v: u8) { + self.0.push(v); + } + fn u16(&mut self, v: u16) { + self.0.extend_from_slice(&v.to_be_bytes()); + } + fn i16(&mut self, v: i16) { + self.0.extend_from_slice(&v.to_be_bytes()); + } + fn u32(&mut self, v: u32) { + self.0.extend_from_slice(&v.to_be_bytes()); + } + fn bytes(&mut self, b: &[u8]) { + self.0.extend_from_slice(b); + } + /// A rectangle as QuickDraw stores one: top, left, bottom, right. + fn rect(&mut self, [left, top, right, bottom]: [i16; 4]) { + self.i16(top); + self.i16(left); + self.i16(bottom); + self.i16(right); + } + /// A zero up to the next even length: every version 2 opcode starts on a word. + fn align(&mut self) { + if self.0.len() % 2 == 1 { + self.0.push(0); + } + } +} + +/// `v` rounded into 16 bits. +fn i16_of(v: f64) -> i16 { + v.round().clamp(-MAX_I16, MAX_I16) as i16 +} + +struct Writer { + out: Out, + /// Document space to device units. + to_dev: Affine, + /// Device units a point. + k: f64, + /// The frame in document space, a little larger: art is cut to it. + cut: Rect, + /// The frame in device units. + frame: Rect, + fg: Option<[u8; 3]>, + lost: Pict, +} + +/// Write `ops` (no clips: [`crate::scene::Scene`] gives none for this format) as a PICT file of +/// `region` (corners in order, finite, with an area, within [`check_region`]). +pub(crate) fn write(ops: &[Op], region: Rect) -> Pict { + let k = units_per_point(region.width(), region.height()); + let size = |v: f64| (v.round()).clamp(1.0, MAX_I16) as i16; + let (w, h) = (size(region.width()), size(region.height())); + let dev = |v: f64| (v * k).round().clamp(1.0, MAX_I16) as i16; + let (dw, dh) = (dev(region.width()), dev(region.height())); + let mut wr = Writer { + out: Out(vec![0; FILE_HEADER]), + to_dev: Affine::scale(k) * Affine::translate(-region.origin().to_vec2()), + k, + cut: region.inflate(1.0, 1.0), + frame: Rect::new(0.0, 0.0, f64::from(dw), f64::from(dh)), + fg: None, + lost: Pict::default(), + }; + let o = &mut wr.out; + // picSize (its low 16 bits, set at the end) and the frame at 72 dpi. + o.u16(0); + o.rect([0, 0, w, h]); + o.u16(VERSION); + o.u16(0x02FF); + // The extended version 2 header: the device resolution and the frame in device units. + let dpi = ((72.0 * k) as u32) << 16; + o.u16(HEADER_OP); + o.i16(-2); + o.u16(0); + o.u32(dpi); + o.u32(dpi); + o.rect([0, 0, dw, dh]); + o.u32(0); + o.u16(CLIP); + o.u16(10); + o.rect([0, 0, dw, dh]); + // Shapes are painted with a solid pen in the foreground color. + o.u16(PN_MODE); + o.u16(PAT_COPY); + o.u16(PN_PAT); + o.bytes(&[0xFF; 8]); + for op in ops { + match op { + Op::Fill { path, rule, rgb, .. } => wr.fill(path, *rule, *rgb), + Op::Stroke { path, pen } => wr.stroke(path, pen), + Op::Image { image, xf, opacity } => wr.image(image, *xf, *opacity), + Op::Clip { .. } | Op::Unclip => {} + } + } + wr.out.align(); + wr.out.u16(OP_END_PIC); + let mut bytes = wr.out.0; + let len = (bytes.len() - FILE_HEADER) as u16; + bytes[FILE_HEADER..FILE_HEADER + 2].copy_from_slice(&len.to_be_bytes()); + Pict { bytes, ..wr.lost } +} + +impl Writer { + fn color(&mut self, rgb: [u8; 3]) { + if self.fg != Some(rgb) { + self.out.u16(RGB_FG_COL); + for c in rgb { + self.out.u16(u16::from(c) * 257); + } + self.fg = Some(rgb); + } + } + + /// `path` filled by `rule`, as polygons QuickDraw fills even-odd: cut to the frame (which also + /// resolves a non-zero fill into figures that don't overlap) unless it is an even-odd fill + /// inside the frame already. + fn fill(&mut self, path: &BezPath, rule: FillRule, rgb: [u8; 3]) { + let b = path.bounding_box(); + let c = self.cut; + if ![b.x0, b.y0, b.x1, b.y1].iter().all(|v| v.is_finite()) || b.x0 >= c.x1 || c.x0 >= b.x1 || b.y0 >= c.y1 || c.y0 >= b.y1 { + return; + } + let inside = self.cut.contains(b.origin()) && self.cut.contains(Point::new(b.x1, b.y1)); + let clean = if rule == FillRule::EvenOdd && inside { + path.clone() + } else { + let cut = PathData::from_bezpath(&self.cut.to_path(0.1)); + match vectorcraft_pathops::try_boolean( + &PathData::from_bezpath(path), + rule, + &cut, + FillRule::NonZero, + vectorcraft_pathops::BoolOp::Intersect, + vectorcraft_pathops::DEFAULT_PRECISION, + ) { + Ok(p) => p.to_bezpath(), + // Too complex to resolve: written as it is, filled even-odd, its coordinates kept + // within 16 bits. + Err(_) => { + self.lost.unresolved_fills |= rule == FillRule::NonZero; + let d = self.to_dev.transform_rect_bbox(b); + self.lost.uncut_fills |= [d.x0, d.y0, d.x1, d.y1].iter().any(|v| v.abs() > MAX_I16); + path.clone() + } + } + }; + self.polygons(&clean, rgb); + } + + /// A stroke's outline (`vectorcraft_effects::stroke::line_outline`, with its dashes, caps, + /// joins and miter limit), filled non-zero in its color as [`Writer::fill`] fills. A stroke + /// thinner than a device unit is written one unit wide. + fn stroke(&mut self, path: &BezPath, pen: &Pen) { + if !(pen.width.is_finite() && pen.width > 0.0) { + return; + } + let width = pen.width.max(1.0 / self.k); + let mut st = StrokeLayer::new(Paint::None, width); + st.cap = pen.cap; + st.join = pen.join; + st.miter_limit = pen.miter; + st.dash = pen.dash.clone(); + let outline = vectorcraft_effects::stroke::line_outline(path, &st, width, FLATNESS / self.k); + self.fill(&outline, FillRule::NonZero, pen.rgb); + } + + /// The figures of `path` (document space) in device units, flattened to within `flatness` + /// device units, each without repeated points and with three or more. + fn figures(&self, path: &BezPath, flatness: f64) -> Vec> { + let mut figs: Vec> = vec![]; + let mut cur: Vec<[i16; 2]> = vec![]; + let mut done = |cur: &mut Vec<[i16; 2]>| { + if cur.len() > 1 && cur.first() == cur.last() { + cur.pop(); + } + if cur.len() > 2 { + figs.push(std::mem::take(cur)); + } + cur.clear(); + }; + let dev = self.to_dev * path.clone(); + vectorcraft_geom::flatten(dev.iter(), flatness, |el| match el { + PathEl::MoveTo(p) => { + done(&mut cur); + cur.push([i16_of(p.x), i16_of(p.y)]); + } + PathEl::LineTo(p) => { + let q = [i16_of(p.x), i16_of(p.y)]; + if cur.last() != Some(&q) { + cur.push(q); + } + } + PathEl::ClosePath => done(&mut cur), + _ => {} + }); + done(&mut cur); + figs + } + + /// `path` painted as polygons. All its figures go into one polygon, which returns along the + /// lines between them: each such line is crossed twice and changes nothing in an even-odd + /// fill. A path with more points than a polygon holds is flattened more coarsely, and past + /// that split into several polygons. + fn polygons(&mut self, path: &BezPath, rgb: [u8; 3]) { + let count = |figs: &[Vec<[i16; 2]>]| figs.iter().map(|f| f.len() + 2).sum::(); + let mut flatness = FLATNESS; + let mut figs = self.figures(path, flatness); + for _ in 0..COARSER { + if count(&figs) <= MAX_POLY_POINTS { + break; + } + flatness *= 4.0; + figs = self.figures(path, flatness); + } + if figs.is_empty() { + return; + } + self.color(rgb); + let mut group: Vec<&[[i16; 2]]> = vec![]; + let mut points = 0; + let thinned: Vec> = figs + .iter() + .map(|fig| { + // A figure no polygon holds keeps evenly spaced points, as many as one holds. + let n = fig.len(); + if n + 2 <= MAX_POLY_POINTS { + return fig.clone(); + } + self.lost.thinned_fills = true; + let keep = MAX_POLY_POINTS - 2; + (0..keep).map(|i| fig[i * n / keep]).collect() + }) + .collect(); + for fig in &thinned { + if !group.is_empty() && points + fig.len() + 2 > MAX_POLY_POINTS { + self.lost.split_fills = true; + self.poly(&group); + group.clear(); + points = 0; + } + points += fig.len() + 2; + group.push(fig); + } + self.poly(&group); + } + + /// One `PaintPoly` of `figs`: each figure back to its start, then the next; after the last, + /// back through the starts to the first. + fn poly(&mut self, figs: &[&[[i16; 2]]]) { + let mut pts: Vec<[i16; 2]> = Vec::with_capacity(figs.iter().map(|f| f.len() + 2).sum()); + for f in figs { + pts.extend_from_slice(f); + pts.push(f[0]); + } + pts.extend(figs.iter().rev().skip(1).map(|f| f[0])); + let (mut l, mut t, mut r, mut b) = (i16::MAX, i16::MAX, i16::MIN, i16::MIN); + for p in &pts { + (l, t, r, b) = (l.min(p[0]), t.min(p[1]), r.max(p[0]), b.max(p[1])); + } + self.out.u16(PAINT_POLY); + self.out.u16((10 + 4 * pts.len()) as u16); + self.out.rect([l, t, r, b]); + for p in &pts { + self.out.i16(p[1]); + self.out.i16(p[0]); + } + } + + /// An image placed by `xf`, over white. Mirrored and quarter-turned images keep their + /// placement; other turns and skews are written upright, filling their bounds. + fn image(&mut self, img: &Arc, xf: Affine, opacity: f32) { + let (w, h) = (img.width as usize, img.height as usize); + if w == 0 || h == 0 || opacity <= 0.0 || img.rgba.len() < w * h * 4 { + return; + } + let m = self.to_dev * xf; + let [a, b, c, d, e, f] = m.as_coeffs(); + if ![a, b, c, d, e, f].iter().all(|v| v.is_finite()) { + return; + } + let tiny = |v: f64| v.abs() < 1e-9; + // Output pixel (x, y) shows source pixel `src(x, y)`, in an output `ow` × `oh`. + let swapped = tiny(a) && tiny(d) && !tiny(b) && !tiny(c); + let upright = tiny(b) && tiny(c) && !tiny(a) && !tiny(d); + if !(upright || swapped) { + self.lost.turned_images = true; + } + let (ow, oh) = if swapped { (h, w) } else { (w, h) }; + let (flip_x, flip_y) = if swapped { (c < 0.0, b < 0.0) } else { (upright && a < 0.0, upright && d < 0.0) }; + let src = |x: usize, y: usize| { + let (x, y) = (if flip_x { ow - 1 - x } else { x }, if flip_y { oh - 1 - y } else { y }); + if swapped { (y, x) } else { (x, y) } + }; + let dst = m.transform_rect_bbox(Rect::new(0.0, 0.0, w as f64, h as f64)); + // The device edges of output columns and rows, and the ones that reach into the frame. + let edge = |from: f64, to: f64, n: usize, i: usize| from + (to - from) * i as f64 / n as f64; + let span = |from: f64, to: f64, n: usize, lo: f64, hi: f64| { + let first = (0..n).find(|&i| edge(from, to, n, i + 1) > lo); + let last = (0..n).rev().find(|&i| edge(from, to, n, i) < hi); + match (first, last) { + (Some(f), Some(l)) if f <= l => Some((f, l + 1)), + _ => None, + } + }; + let (Some((x0, x1)), Some((y0, y1))) = + (span(dst.x0, dst.x1, ow, self.frame.x0, self.frame.x1), span(dst.y0, dst.y1, oh, self.frame.y0, self.frame.y1)) + else { + return; + }; + let alpha = opacity.clamp(0.0, 1.0); + let mut translucent = false; + let mut pixel = |x: usize, y: usize| { + let (sx, sy) = src(x, y); + let i = (sy * w + sx) * 4; + let p = &img.rgba[i..i + 4]; + let a = f32::from(p[3]) / 255.0 * alpha; + if a < OPAQUE { + translucent = true; + } + [0, 1, 2].map(|c| (f32::from(p[c]) * a + 255.0 * (1.0 - a)).round() as u8) + }; + // Tiles of up to `TILE` columns (rows). The edges between the visible columns lie in the + // frame; an outer edge past 16 bits is moved in, so its column (row) is a tile of its own, + // one color however far it is stretched. + let tiles = |from: f64, to: f64, n: usize, first: usize, end: usize| { + let far = |i: usize| edge(from, to, n, i).abs() > MAX_I16; + let mut cuts = vec![]; + let (mut i, mut stop) = (first, end); + if far(i) && i + 1 < stop { + cuts.push((i, i + 1)); + i += 1; + } + let last = (far(stop) && i + 1 < stop).then(|| { + stop -= 1; + (stop, stop + 1) + }); + while i < stop { + let next = (i + TILE).min(stop); + cuts.push((i, next)); + i = next; + } + cuts.extend(last); + cuts + }; + for (ty, ty1) in tiles(dst.y0, dst.y1, oh, y0, y1) { + for (tx, tx1) in tiles(dst.x0, dst.x1, ow, x0, x1) { + let rect = [ + i16_of(edge(dst.x0, dst.x1, ow, tx)), + i16_of(edge(dst.y0, dst.y1, oh, ty)), + i16_of(edge(dst.x0, dst.x1, ow, tx1)), + i16_of(edge(dst.y0, dst.y1, oh, ty1)), + ]; + if rect[2] > rect[0] && rect[3] > rect[1] { + let rows: Vec> = (ty..ty1).map(|y| (tx..tx1).map(|x| pixel(x, y)).collect()).collect(); + self.bits(&rows, tx1 - tx, ty1 - ty, rect); + } + } + } + self.lost.translucent_images |= translucent; + } + + /// One `DirectBitsRect` of `rows` (`tw` × `th` pixels) into `dst` (left, top, right, bottom), + /// 32-bit pixels: rows of a red, a green and a blue plane, each row packed with PackBits; a + /// pixel map narrower than two pixels has unpacked rows of `0RGB` pixels. + fn bits(&mut self, rows: &[Vec<[u8; 3]>], tw: usize, th: usize, dst: [i16; 4]) { + let row_bytes = 4 * tw; + let o = &mut self.out; + o.align(); + o.u16(DIRECT_BITS_RECT); + o.u32(0xFF); + o.u16(row_bytes as u16 | 0x8000); + o.rect([0, 0, tw as i16, th as i16]); + // pmVersion, packType 4 (component planes), packSize, 72 dpi. + o.u16(0); + o.u16(4); + o.u32(0); + o.u32(72 << 16); + o.u32(72 << 16); + // RGBDirect, 32 bits a pixel, 3 components of 8 bits, no plane bytes, table or reserve. + o.u16(16); + o.u16(32); + o.u16(3); + o.u16(8); + o.u32(0); + o.u32(0); + o.u32(0); + o.rect([0, 0, tw as i16, th as i16]); + o.rect(dst); + // srcCopy. + o.u16(0); + let mut plane = Vec::with_capacity(3 * tw); + let mut packed = Vec::with_capacity(3 * tw + 3 * tw / 128 + 2); + for row in rows { + if row_bytes < 8 { + for p in row { + o.u8(0); + o.bytes(p); + } + continue; + } + plane.clear(); + for c in 0..3 { + plane.extend(row.iter().map(|p| p[c])); + } + packed.clear(); + packbits(&plane, &mut packed); + if row_bytes > 250 { + o.u16(packed.len() as u16); + } else { + o.u8(packed.len() as u8); + } + o.bytes(&packed); + } + o.align(); + } +} + +/// `src` packed with PackBits: runs of two to 128 equal bytes as a count byte `1 - n` and the +/// byte, other bytes in literal runs of up to 128 behind a count byte `n - 1`. +fn packbits(src: &[u8], out: &mut Vec) { + let run_at = |i: usize| src[i..].iter().take(128).take_while(|&&b| b == src[i]).count(); + let mut i = 0; + while i < src.len() { + let run = run_at(i); + if run >= 2 { + out.push((1 - run as i16) as u8); + out.push(src[i]); + i += run; + continue; + } + let start = i; + while i < src.len() && i - start < 128 && (i == start || run_at(i) < 3) { + i += 1; + } + out.push((i - start - 1) as u8); + out.extend_from_slice(&src[start..i]); + } +} diff --git a/crates/metafile/src/tests.rs b/crates/metafile/src/tests.rs index eeb30ec846..90153bf27b 100644 --- a/crates/metafile/src/tests.rs +++ b/crates/metafile/src/tests.rs @@ -13,6 +13,7 @@ use crate::*; mod import; mod pict; +mod pict_export; /// Add `n` (with a fresh id) on top of `d`'s first layer. pub(crate) fn add(d: &mut Document, mut n: Node) { diff --git a/crates/metafile/src/tests/pict_export.rs b/crates/metafile/src/tests/pict_export.rs new file mode 100644 index 0000000000..26ee1047df --- /dev/null +++ b/crates/metafile/src/tests/pict_export.rs @@ -0,0 +1,394 @@ +//! PICT output read back through `craft_metafile`'s QuickDraw reader: the frame and resolution, +//! fills and their fill rules, strokes, images and their placement, and what the format leaves +//! out. + +use craft_metafile::{Item, Seg}; +use vectorcraft_geom::{BezPath, FillRule, Shape}; + +use super::*; + +fn pict(d: &Document) -> Output { + export(d, d.artboards[0].rect, Kind::Pict).unwrap() +} + +fn read(out: &Output) -> craft_metafile::Picture { + let pic = craft_metafile::parse_pict(&out.bytes).unwrap(); + assert!(!pic.truncated && pic.skipped_records == 0 && pic.dropped_images == 0, "{pic:?}"); + pic +} + +fn bez(segs: &[Seg]) -> BezPath { + let mut bp = BezPath::new(); + for s in segs { + match *s { + Seg::Move(x, y) => bp.move_to((f64::from(x), f64::from(y))), + Seg::Line(x, y) => bp.line_to((f64::from(x), f64::from(y))), + Seg::Cubic(a, b, c, d, e, f) => bp.curve_to((f64::from(a), f64::from(b)), (f64::from(c), f64::from(d)), (f64::from(e), f64::from(f))), + Seg::Close => bp.close_path(), + } + } + bp +} + +/// The filled paths of `pic`: their outline and their color. +fn fills(pic: &craft_metafile::Picture) -> Vec<(BezPath, [u8; 4])> { + pic.items + .iter() + .filter_map(|i| match i { + Item::Path { segs, fill: Some(c), stroke: None, .. } => Some((bez(segs), *c)), + _ => None, + }) + .collect() +} + +/// Is `p` painted by one of `pic`'s fills, each filled even-odd as QuickDraw fills polygons? +fn painted(pic: &craft_metafile::Picture, p: (f64, f64)) -> bool { + fills(pic).iter().any(|(bp, _)| bp.winding(p.into()) % 2 != 0) +} + +fn near(a: Rect, b: Rect, tol: f64) -> bool { + [a.x0 - b.x0, a.y0 - b.y0, a.x1 - b.x1, a.y1 - b.y1].iter().all(|d| d.abs() <= tol) +} + +fn compound(parts: &[BezPath], rule: FillRule) -> Node { + let mut bp = BezPath::new(); + parts.iter().for_each(|p| bp.extend(p.iter())); + let mut n = path(PathData::from_bezpath(&bp), red(), Paint::None, 0.0); + if let NodeKind::Path { rule: r, .. } = &mut n.kind { + *r = rule; + } + n +} + +fn square(x0: f64, y0: f64, x1: f64, y1: f64, clockwise: bool) -> BezPath { + let mut pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]; + if !clockwise { + pts.reverse(); + } + let mut bp = BezPath::new(); + bp.move_to(pts[0]); + pts[1..].iter().for_each(|p| bp.line_to(*p)); + bp.close_path(); + bp +} + +/// Walk the writer's version 2 opcodes and collect their PaintPoly data. +fn paint_polys(bytes: &[u8]) -> Vec<&[u8]> { + let word = |at: usize| u16::from_be_bytes(bytes[at..at + 2].try_into().unwrap()); + let mut at = 522; // Application data, picSize, and frame. + let mut polys = vec![]; + loop { + at += at % 2; + let opcode = word(at); + at += 2; + let len = match opcode { + 0x0011 => { + assert_eq!(word(at), 0x02FF); + 2 + } + 0x0C00 => 24, + 0x0001 => usize::from(word(at)), + 0x0008 => 2, + 0x0009 => 8, + 0x001A => 6, + 0x0071 => { + let len = usize::from(word(at)); + polys.push(&bytes[at..at + len]); + len + } + 0x009A => { + let row_bytes = usize::from(word(at + 4) & 0x3FFF); + let rows = usize::from(word(at + 10) - word(at + 6)); + let mut end = at + 68; // PixMap, source and destination rectangles, mode. + for _ in 0..rows { + if row_bytes < 8 { + end += row_bytes; + } else if row_bytes > 250 { + end += 2 + usize::from(word(end)); + } else { + end += 1 + usize::from(bytes[end]); + } + } + end - at + } + 0x00FF => { + assert_eq!(at, bytes.len()); + return polys; + } + _ => panic!("unexpected PICT opcode {opcode:#06X}"), + }; + at += len; + } +} + +#[test] +fn pict_frame_is_the_region_in_points_and_art_lands_within_a_sixteenth_of_a_point() { + let r = Rect::new(10.5, 20.25, 100.0, 50.0); + let d = doc_with(612.0, 792.0, vec![path(shapes::rectangle(r), red(), Paint::None, 0.0)]); + let out = pict(&d); + assert!(out.warnings.is_empty(), "{:?}", out.warnings); + // 512 bytes of application data, then the frame (top, left, bottom, right) at 72 dpi and the + // version 2 opcodes. + assert_eq!(out.bytes[514..522], [0, 0, 0, 0, 3, 24, 2, 100]); + assert_eq!(out.bytes[522..528], [0x00, 0x11, 0x02, 0xFF, 0x0C, 0x00]); + let pic = read(&out); + assert_eq!((pic.width, pic.height), (612.0, 792.0)); + let f = fills(&pic); + assert_eq!(f.len(), 1, "{f:?}"); + assert_eq!(f[0].1, [255, 0, 0, 255]); + assert!(near(f[0].0.bounding_box(), r, 1.0 / 16.0), "{:?}", f[0].0.bounding_box()); +} + +#[test] +fn fills_keep_their_holes_and_non_zero_overlaps() { + let even_odd = compound(&[square(10.0, 10.0, 90.0, 90.0, true), square(30.0, 30.0, 70.0, 70.0, true)], FillRule::EvenOdd); + let mut d = doc_with(300.0, 100.0, vec![even_odd]); + // Two overlapping squares drawn the same way round: non-zero fills where they overlap. + add(&mut d, compound(&[square(110.0, 10.0, 150.0, 50.0, true), square(130.0, 30.0, 170.0, 70.0, true)], FillRule::NonZero)); + // A square with a hole drawn the other way round. + add(&mut d, compound(&[square(210.0, 10.0, 290.0, 90.0, true), square(230.0, 30.0, 270.0, 70.0, false)], FillRule::NonZero)); + let pic = read(&pict(&d)); + for (p, filled) in [ + ((20.0, 20.0), true), + ((50.0, 50.0), false), + ((120.0, 20.0), true), + ((140.0, 40.0), true), + ((160.0, 60.0), true), + ((120.0, 60.0), false), + ((220.0, 20.0), true), + ((250.0, 50.0), false), + ] { + assert_eq!(painted(&pic, p), filled, "{p:?}"); + } +} + +#[test] +fn art_off_the_frame_is_cut_to_it() { + // Far enough out that its device coordinates would not fit 16 bits. + let wide = path(shapes::rectangle(Rect::new(-5000.0, 10.0, 5000.0, 20.0)), red(), Paint::None, 0.0); + let away = path(shapes::rectangle(Rect::new(400.0, 10.0, 410.0, 20.0)), blue(), Paint::None, 0.0); + let pic = read(&pict(&doc_with(100.0, 100.0, vec![wide, away]))); + let f = fills(&pic); + assert_eq!(f.len(), 1, "{f:?}"); + let b = f[0].0.bounding_box(); + assert!(b.x0 >= -1.0 && b.x1 <= 101.0 && near(Rect::new(0.0, b.y0, 100.0, b.y1), Rect::new(0.0, 10.0, 100.0, 20.0), 1.0 / 16.0), "{b:?}"); + assert!(painted(&pic, (1.0, 15.0)) && painted(&pic, (99.0, 15.0))); +} + +#[test] +fn strokes_are_written_as_their_outlines() { + let line = |y: f64| { + let mut bp = BezPath::new(); + bp.move_to((10.0, y)); + bp.line_to((50.0, y)); + path(PathData::from_bezpath(&bp), Paint::None, blue(), 4.0) + }; + let butt = line(20.0); + let mut round = line(60.0); + if let Some(s) = round.appearance.stroke_mut() { + s.cap = LineCap::Round; + } + let pic = read(&pict(&doc_with(100.0, 100.0, vec![butt, round]))); + let f = fills(&pic); + assert_eq!(f.len(), 2, "{f:?}"); + assert!(f.iter().all(|(_, c)| *c == [0, 0, 255, 255])); + let tol = 1.0 / 8.0; + assert!(near(f[0].0.bounding_box(), Rect::new(10.0, 18.0, 50.0, 22.0), tol), "{:?}", f[0].0.bounding_box()); + assert!(near(f[1].0.bounding_box(), Rect::new(8.0, 58.0, 52.0, 62.0), tol), "{:?}", f[1].0.bounding_box()); + // A stroke wider than the shape covers its interior. + let dot = path(shapes::ellipse(Rect::new(45.0, 45.0, 55.0, 55.0)), Paint::None, blue(), 40.0); + let pic = read(&pict(&doc_with(100.0, 100.0, vec![dot]))); + assert!(painted(&pic, (50.0, 50.0)) && painted(&pic, (50.0, 32.0)) && !painted(&pic, (50.0, 20.0))); +} + +/// A PNG of `w` × `h` pixels, `rgba` row by row. +fn png_of(w: u32, h: u32, rgba: Vec) -> Vec { + let img = craft_image_codecs::Image::from_raw(w, h, craft_image_codecs::ChannelLayout::Rgba, craft_image_codecs::SampleType::U8, rgba).unwrap(); + craft_image_codecs::encode(&img, craft_image_codecs::Format::Png, &craft_image_codecs::EncodeOptions::default()).unwrap() +} + +/// A bitmap read back: where it goes (`[x, y, w, h]`), its width and height in pixels, and its +/// RGB pixels. +type Bitmap = ([f32; 4], u32, u32, Vec<[u8; 3]>); + +/// The bitmaps of `pic`. +fn bitmaps(pic: &craft_metafile::Picture) -> Vec { + pic.items + .iter() + .filter_map(|i| match i { + Item::Bitmap { rect, width, height, rgba, .. } => { + Some((*rect, *width, *height, rgba.as_chunks::<4>().0.iter().map(|p| [p[0], p[1], p[2]]).collect())) + } + _ => None, + }) + .collect() +} + +/// Each pixel of a bitmap read back shows the pixel of `src` (`w` × `h`) that `xf` places under +/// its center. +fn shows(bitmap: &Bitmap, src: &[[u8; 3]], w: usize, xf: Affine) { + let (rect, bw, bh, px) = bitmap; + let inv = xf.inverse(); + let (cw, ch) = (f64::from(rect[2]) / f64::from(*bw), f64::from(rect[3]) / f64::from(*bh)); + for y in 0..*bh as usize { + for x in 0..*bw as usize { + let at = Point::new(f64::from(rect[0]) + (x as f64 + 0.5) * cw, f64::from(rect[1]) + (y as f64 + 0.5) * ch); + let s = inv * at; + let want = src[s.y.floor() as usize * w + s.x.floor() as usize]; + assert_eq!(px[y * *bw as usize + x], want, "pixel ({x}, {y}) at {at:?}"); + } + } +} + +#[test] +fn images_keep_their_pixels_mirrored_and_quarter_turned() { + let src: Vec<[u8; 3]> = vec![[255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 255, 0], [0, 255, 255], [255, 0, 255]]; + let bytes = png_of(3, 2, src.iter().flat_map(|p| [p[0], p[1], p[2], 255]).collect()); + let places = [ + Affine::translate((10.0, 10.0)) * Affine::scale(4.0), + Affine::translate((40.0, 10.0)) * Affine::scale_non_uniform(-4.0, 4.0), + Affine::translate((60.0, 10.0)) * Affine::rotate(std::f64::consts::FRAC_PI_2) * Affine::scale(4.0), + Affine::translate((70.0, 60.0)) * Affine::rotate(-std::f64::consts::FRAC_PI_2) * Affine::scale_non_uniform(4.0, -4.0), + ]; + let mut d = doc_with(100.0, 100.0, vec![]); + for xf in places { + let n = image_node(&mut d, bytes.clone(), 3, 2, xf); + add(&mut d, n); + } + let out = pict(&d); + assert!(out.warnings.is_empty(), "{:?}", out.warnings); + let bm = bitmaps(&read(&out)); + assert_eq!(bm.len(), places.len()); + for (b, xf) in bm.iter().zip(places) { + let want = xf.transform_rect_bbox(Rect::new(0.0, 0.0, 3.0, 2.0)); + let got = Rect::new(f64::from(b.0[0]), f64::from(b.0[1]), f64::from(b.0[0] + b.0[2]), f64::from(b.0[1] + b.0[3])); + assert!(near(got, want, 1.0 / 16.0), "{got:?} {want:?}"); + shows(b, &src, 3, xf); + } +} + +#[test] +fn turned_and_translucent_images_are_reported() { + let mut d = doc_with(100.0, 100.0, vec![]); + // One pixel: a row narrower than two pixels is stored unpacked. + let half = image_node(&mut d, png(1, 1, [0, 0, 0, 128]), 1, 1, Affine::translate((10.0, 10.0)) * Affine::scale(10.0)); + add(&mut d, half); + let out = pict(&d); + assert_eq!(out.warnings, ["PICT has no transparency: images are written over white"]); + let bm = bitmaps(&read(&out)); + assert_eq!(bm.len(), 1); + assert_eq!(bm[0].3, [[127, 127, 127]]); + let turned = image_node(&mut d, png(2, 2, [0, 0, 0, 255]), 2, 2, Affine::translate((50.0, 50.0)) * Affine::rotate(0.5)); + add(&mut d, turned); + assert!(pict(&d).warnings.iter().any(|w| w.contains("quarter turns"))); +} + +#[test] +fn large_images_are_written_in_tiles() { + let (w, h) = (1500usize, 3usize); + // Red changes along each row and green stays the same over long runs: both literal and + // repeated bytes are packed, in rows longer than 250 bytes. + let src: Vec<[u8; 3]> = (0..w * h).map(|i| [(i % w % 256) as u8, (i % w / 256) as u8, (i / w * 60) as u8]).collect(); + let mut d = doc_with(100.0, 100.0, vec![]); + // A pixel a device unit (a sixteenth of a point) wide. + let xf = Affine::translate((5.0, 5.0)) * Affine::scale(0.0625); + let n = image_node(&mut d, png_of(w as u32, h as u32, src.iter().flat_map(|p| [p[0], p[1], p[2], 255]).collect()), w as u32, h as u32, xf); + add(&mut d, n); + let bm = bitmaps(&read(&pict(&d))); + assert_eq!(bm.iter().map(|b| (b.1, b.2)).collect::>(), [(1024, 3), (476, 3)]); + for b in &bm { + shows(b, &src, w, xf); + } +} + +#[test] +fn pict_polygon_sizes_fit_a_signed_word() { + // 8,800 figure points, plus closing points and bridges, fit the old unsigned limit. + let squares: Vec = (0..2200) + .map(|i| (f64::from(i % 50) * 1.5 + 1.0, f64::from(i / 50) * 1.5 + 1.0)) + .map(|(x, y)| square(x, y, x + 1.0, y + 1.0, true)) + .collect(); + let out = pict(&doc_with(100.0, 100.0, vec![compound(&squares, FillRule::EvenOdd)])); + let polys = paint_polys(&out.bytes); + assert!(!polys.is_empty()); + for poly in polys { + let size = i16::from_be_bytes(poly[..2].try_into().unwrap()); + assert!(size > 0, "polySize must be a positive signed byte count: {size}"); + let (points, remainder) = poly[10..].as_chunks::<4>(); + assert!(remainder.is_empty()); + assert!(!points.is_empty()); + assert_eq!(size as usize, 10 + 4 * points.len()); + } +} + +#[test] +fn a_fill_past_one_polygon_is_split_or_thinned() { + // 3,000 separate squares: more points than one polygon holds. + let squares: Vec = (0..3000) + .map(|i| (f64::from(i % 60) * 1.5 + 1.0, f64::from(i / 60) * 1.5 + 1.0)) + .map(|(x, y)| square(x, y, x + 1.0, y + 1.0, true)) + .collect(); + let out = pict(&doc_with(100.0, 100.0, vec![compound(&squares, FillRule::EvenOdd)])); + assert!(out.warnings.iter().any(|w| w.contains("several polygons")), "{:?}", out.warnings); + let pic = read(&out); + assert!(fills(&pic).len() > 1); + assert!(painted(&pic, (1.5, 1.5)) && painted(&pic, (59.0 * 1.5 + 1.5, 49.0 * 1.5 + 1.5))); + // One outline of 20,000 points. + let mut star = BezPath::new(); + for i in 0..20_000 { + let t = f64::from(i) / 20_000.0 * std::f64::consts::TAU; + let r = if i % 2 == 0 { 45.0 } else { 40.0 }; + let p = (50.0 + r * t.cos(), 50.0 + r * t.sin()); + if i == 0 { star.move_to(p) } else { star.line_to(p) } + } + star.close_path(); + let out = pict(&doc_with(100.0, 100.0, vec![compound(&[star], FillRule::EvenOdd)])); + assert!(out.warnings.iter().any(|w| w.contains("fewer points")), "{:?}", out.warnings); + let pic = read(&out); + assert!(painted(&pic, (50.0, 50.0)) && !painted(&pic, (2.0, 2.0))); +} + +#[test] +fn an_image_reaching_far_past_the_frame_keeps_its_columns_in_place() { + // Two columns, each 2,550 pt wide: red ends at x = 50, well inside the frame, while the outer + // edges lie past 16-bit device coordinates. + let mut d = doc_with(100.0, 100.0, vec![]); + let bytes = png_of(2, 1, vec![255, 0, 0, 255, 0, 0, 255, 255]); + let n = image_node(&mut d, bytes, 2, 1, Affine::translate((-2500.0, 10.0)) * Affine::scale_non_uniform(2550.0, 10.0)); + add(&mut d, n); + let bm = bitmaps(&read(&pict(&d))); + let color_at = |x: f64| { + bm.iter().find_map(|(r, bw, _, px)| { + let (x0, w) = (f64::from(r[0]), f64::from(r[2])); + (x0..x0 + w).contains(&x).then(|| px[((x - x0) / w * f64::from(*bw)) as usize]) + }) + }; + assert_eq!(color_at(25.0), Some([255, 0, 0]), "{bm:?}"); + assert_eq!(color_at(49.0), Some([255, 0, 0]), "{bm:?}"); + assert_eq!(color_at(51.0), Some([0, 0, 255]), "{bm:?}"); +} + +#[test] +fn a_non_zero_fill_too_complex_to_resolve_is_reported() { + let squares: Vec = (0..1000).map(|_| square(10.0, 10.0, 50.0, 50.0, true)).collect(); + let out = pict(&doc_with(100.0, 100.0, vec![compound(&squares, FillRule::NonZero)])); + assert!(out.warnings.iter().any(|w| w.contains("written even-odd")), "{:?}", out.warnings); + // The same for a stroke whose outline can't be resolved: it is still written, not left out. + let mut lines = BezPath::new(); + for _ in 0..1000 { + lines.move_to((10.0, 50.0)); + lines.line_to((90.0, 50.0)); + } + let out = pict(&doc_with(100.0, 100.0, vec![path(PathData::from_bezpath(&lines), Paint::None, blue(), 4.0)])); + assert!(out.warnings.iter().any(|w| w.contains("written even-odd")), "{:?}", out.warnings); + assert!(!fills(&read(&out)).is_empty()); +} + +#[test] +fn pict_regions_over_32767_points_are_refused() { + let d = doc_with(100.0, 100.0, vec![]); + assert!(export(&d, Rect::new(0.0, 0.0, 40_000.0, 10.0), Kind::Pict).is_err()); + assert!(check_regions_for(&[Rect::new(0.0, 0.0, 40_000.0, 10.0)], Kind::Pict).is_err()); + assert!(check_regions_for(&[Rect::new(0.0, 0.0, 40_000.0, 10.0)], Kind::Emf).is_ok()); + assert!(export(&d, Rect::new(0.0, 0.0, 32_000.0, 10.0), Kind::Pict).is_ok()); +} diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 0f4d35f635..22c5465c14 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -982,9 +982,10 @@ artboard. OK is disabled with none checked. Save As to an EPS file opens the sam a pick writes the option's value (`"tiffColor"`, `"preserve"`, a built-in preset's id such as `"medium"` or a saved preset's name, the level as a number), and a value none of them names shows as it is. -EMF and WMF: Export As… lists both formats (`file.exportAs {format: "emf"}` or `"wmf"`); they have no options -dialog, so `ui.dialog.confirm` asks for the path and writes the file (one per artboard with Use Artboards). Open and -Place read `.emf` and `.wmf`; a paste of `image/emf` from a system clipboard service runs `clipboard.importEmf`. +EMF, WMF and PICT: Export As… lists the three formats (`file.exportAs {format: "emf"}`, `"wmf"` or `"pict"`); they +have no options dialog, so `ui.dialog.confirm` asks for the path and writes the file (one per artboard with Use +Artboards). Open and Place read `.emf` and `.wmf`; a paste of `image/emf` from a system clipboard service runs +`clipboard.importEmf`. HP-GL Options: Export As… with the HP-GL format (`file.exportAs {format: "hpgl"}`, then the save dialog), or `ui.hpglOptionsDialog {path?, …HP-GL options}` for agents, opens the `hpglOptions` dialog. Its fields are diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 5bbf877836..9d4deb8bfa 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -384,7 +384,7 @@ Gradient meshes in the editing data keep each point's own color where a patch's | Layered raster `.pcraft` | open, place | yes (as one image: the full-size composite when the file has one; else the layers combined at the canvas size when the document is RGB at 8 or 16 bits and every visible layer is a Normal raster layer without clipping, layer effects, a vector mask, a frame, advanced blending or a feathered layer mask; else the composite preview, with a warning when it is smaller than the canvas) | no | read with craft-doc; sized by the document's resolution, the preview at the canvas's size (at least 1 ppi); a linked file is read the same way again when it is updated; a missing or damaged full-size composite or preview is an error; `tests_pcraftread.rs` | | PCX | open, place | yes (1 bit in the header palette's first two colors, black and white without them; 1 bit in two to four planes and 4 bits with up to 16 colors; 2 bits in the CGA colors the header's CGA palette settings pick; 8 bits with the 256-color palette, gray without one; 24-bit color in three planes) | no | the header's HDpi and VDpi size the image; a file of another depth or plane count, cut short or past the pixel allowance is refused with a message; tests in `crates/engine/src/cmd/fileio/tests_pcxread.rs` and `crates/engine/tests/import_fuzz.rs` | | JPEG 2000 | open, place | yes (JP2 and raw codestream images; multiple codestreams and JPX composition or layers are refused) | no | `.jpf`, `.jpx`, `.jp2`, `.j2k`, `.j2c`, `.jpc`; resolution uses the valid `resd` (display) value on each axis, or else the valid `resc` (capture) value, or 72 ppi; bounded decoding; `tests_jp2read.rs` | -| PICT | open, place (legacy) | yes (versions 1 and 2: shapes, lines, regions, text, bitmaps, pixel maps and QuickTime JPEG images; placed as one group clipped to the picture's frame) | no | `.pct`, `.pic` and `.pict`; a version 2 picture also opens by its content; a two-color pattern fills with its average color; inverted shapes, transfer modes other than a copy and QuickTime images in other formats come back as warnings; a picture cut short keeps what came before it; tests in `crates/metafile/src/tests/pict.rs`, `crates/engine/src/cmd/fileio/tests_pict.rs` and `crates/engine/tests/import_fuzz.rs` | +| PICT | open, place (legacy) | yes (versions 1 and 2: shapes, lines, regions, text, bitmaps, pixel maps and QuickTime JPEG images; placed as one group clipped to the picture's frame) | yes (a version 2 `.pct` of an artboard, or one per artboard: fills as polygons cut to the frame, strokes as their outlines, images as 24-bit pixel maps over white, at up to 16 device units a point) | `.pct`, `.pic` and `.pict`; a version 2 picture also opens by its content; export writes clipping masks, gradients, patterns and transparency as WMF does and reports each loss, and `crates/metafile/src/tests/pict_export.rs` reads its pictures back through the reader; a two-color pattern fills with its average color; inverted shapes, transfer modes other than a copy and QuickTime images in other formats come back as warnings; a picture cut short keeps what came before it; tests in `crates/metafile/src/tests/pict.rs`, `crates/engine/src/cmd/fileio/tests_pict.rs` and `crates/engine/tests/import_fuzz.rs` | | Pixar PXR | open, place (legacy) | yes (any set of the R, G, B and A channels in 8 or 12 bits, dumped or run-length encoded, in tiles; R alone is gray; alpha matted to black or unassociated) | no | recognized by its magic number; 12-bit samples are clamped to 0.0 to 1.0; null tiles are transparent with A and black without; the offsets aren't read, and the image takes the default resolution; a file cut short, with header values or packets the format doesn't define, or past the pixel allowance is refused with a message; tested on synthetic files only; tests in `crates/engine/src/cmd/fileio/tests_pxrread.rs` and `crates/engine/tests/import_fuzz.rs` | | FreeHand `.fh*` | open (legacy) | no | no | | | `.cdr` drawings | open | yes (versions 1 to 27, the `WL` files of versions 1 and 2 and the ZIP packages of versions 14 on included: pages, layers, guidelines, groups, clipping containers, curves, paths, rectangles, ellipses, arcs, polygons, uniform fills and outlines, from the object's style where it has none of its own; hidden and locked layers, groups and objects; the winding flag as the nonzero fill rule; uniform transparency of version 13 on as opacity and blend mode; text, bitmaps, blends, contours, brush strokes, fountain, pattern, texture and PostScript fills and arrowheads are left out with a warning, and lenses, other transparency and merge modes without a blend mode are not applied, with a warning; versions 1 and 2 open as one page and one layer without groups, arcs or pies; version 3 envelopes are not applied, so the objects and groups under one keep their outlines and matrices, with a warning; encrypted, ZIP64 and split packages are refused) | no | `.cdt` templates open as new untitled documents; File › Place reads both; after an open with a warning, an export or Save As to the drawing's own path needs `acknowledgeLoss: true`; record layouts and their sources in `craft-cdr` (`storytold/craft-libs@9b28b56bc7`, `crates/cdr/PROVENANCE.md`); synthetic test files only; tests in `craft-cdr` `crates/cdr/tests/it/read.rs`, `crates/engine/src/cmd/fileio/tests_cdr.rs` and `crates/engine/tests/import_fuzz.rs` | diff --git a/docs/mcp.md b/docs/mcp.md index c5c7fcbdcc..d9786dcad6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -882,7 +882,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions | `screenshot` | `{path?, scale?, artboard?, window?, max_side?, traceViews?}` | Returns MCP image content (`image/png`, base64) plus a text block. Renders the artboard with the pixels of a PNG `export` with `background: "white"` at the same scale; `traceViews:true` draws Image Trace objects in the view set with `imageTrace.setView`, as in the app's window; `window:true` captures the app window (remote only), as `ui_screenshot` does, and `max_side` (1–4096, window captures only) scales the returned image down as described for `ui_screenshot`. With `path` the backend (the headless session or the app) writes the PNG there too; a window capture written there keeps its full size with `max_side`. An app that does not send the image back writes a window capture without `path` to a file in a new folder inside the system's temporary folder (on Unix only the user can open it); the server reads the file and then removes the folder, also when the capture or the read fails. | | `open_file` | `{path, importer?, params?}` | Opens any readable file as a new active document: `.vectorcraft`/`.drawcraft`, `.vctemplate`, `.svg`/`.svgz`, `.pdf`/`.ai`, `.ait`, `.eps`/`.epsf`, `.ps`, `.dxf`, `.emf`, `.wmf`, PICT (`.pct`/`.pic`/`.pict`, and a version 2 picture of any extension), HP-GL (`.plt`/`.hpgl`/`.hgl`/`.hpg`, and a file of an extension no other format reads that starts with plotter instructions), PNG (`.png`/`.pns`), JPEG (`.jpg`/`.jpeg`/`.jpe`), GIF, WebP, TIFF, BMP (`.bmp`/`.dib`/`.rle`), Targa (`.tga`/`.vda`/`.icb`/`.vst`), PCX, Pixar (`.pxr`), JPEG 2000 (`.jpf`/`.jpx`/`.jp2`/`.j2k`/`.j2c`/`.jpc`), HEIC/HEIF (`.heic`/`.heif`), JPEG XL (`.jxl`), PSD (`.psd`/`.pdd`)/PSB (an image opens as a document of its pixel size; a PSD or PSB file with its layers as layers, or as its merged image through `run_command document.open` with `layers: false`; a JPEG XL file as its first frame), CDR drawings of versions 1 to 27 (`.cdr`, `.cdt`), CMX files with 32-bit coordinates (`.cmx`), layered raster `.pcraft` documents (as one image at the canvas size; a warning says when only the smaller preview could be read), DWG drawings (`.dwg`, `.dws`, `.dwt`). Templates (`.vctemplate`, `.ait`, `.cdt`, `.dwt`) open as a new untitled document. PDF, `.ai` and SVG files saved with Preserve Editing reopen as the document they carry. The reply is `document.open`'s: its `warnings` say what didn't come in as it was (an EPS whose PostScript can't be read opens as its preview, and the warning names the PostScript error, the operator and the procedure). A file of an extension only an installed importer plug-in lists opens with that importer ([Plug-ins](#plug-ins)); `importer: "plugin."` opens the file with the importer it names, which must list the file's extension, also one a built-in format reads (in the app, as File › Open With does), and `params` gives that importer's parameters (their defaults when omitted). `run_command document.formats` lists the formats. | | `save_file` | `{path?, compress?, version?, preview?, precision?, options?}` | Runs `document.save`: the document's own file in its own format (native `.vectorcraft` unless it was opened from or saved as SVG, PDF or a restorable `.ai`; then `warnings` say what that format loses). A path's extension picks the format (`.vectorcraft`, `.vctemplate`, `.pdf`, `.svg`, `.svgz`, `.ai`: a PDF carrying the native document, which reopens editable; `.eps`: by default one file whose bounding box fits the visible art, the first artboard when no art shows; `options.useArtboards: true` makes the chosen artboard the page and, with two or more chosen, the file at the path is the central file of the visible art and each artboard is also written to `_.eps` beside it, listed in the reply's `files`). For a native file, `compress: true` gzips it (default: the `useCompression` preference, Preferences › File Handling › Use Compression), `version` (1 to 4) writes it for an older VectorCraft (1 and 2 are never compressed, and `version: 2` with `compress: true` is an error; versions 1 to 3 get each live star as a plain path of its outline, without its point count and ratio), `preview: true` embeds a PNG of the first artboard, and `precision` (0 to 9) rounds path anchors and handles to that many decimal places for that save only (colors, transforms and type stay exact). `options` passes the format's save options as `run_command document.formats` lists them. When `compress`, `version`, `preview` or `precision` is given both at the top level and in `options` with different values, the call is an error (`` `compress: true` and `options.compress: false` disagree: give the option once ``) and nothing is written. A key in `options` that no save format takes is an error, and nothing is written (see Parameter keys). The save drops each option the written format doesn't read. The reply's `warnings` then name each such option given (for example `` `compress` was not used: SVG files don't read it `` for an `.svg` path, and `` `options.preview` was not used: … `` for a key in `options`; a PDF-compatible `.ai` file reads `compress` but not `version`, `preview`, `precision`, `outlineText`, `hiddenObjects`, `transparentImages` or `preserveEditing`, and a legacy `.ai` file reads only its own options). For a `.ai` file, these warnings name the kind of `.ai` written: a legacy .ai (version 7) for `aiVersion: "7"`, a non-PDF-compatible .ai for `pdfCompatible: false`, and a PDF-compatible .ai otherwise, including a save that reuses the options the document was last saved with. `run_command document.save` and the other save commands refuse any option given beside the path and in `options` with different values, and give the same warnings for each key given beside the path or in `options` that the file doesn't read. The headless session and the app receive the same `app.save` params, and the app is also sent `wait: true`: the call returns once the file is written, or with the error (such as a path outside the write root), even with Background Save on. When the save asks first (the question before replacing a file that opened with losses, or on macOS and Linux the file dialog for an untitled document without `path`), the reply is `{pending}` or `"cancelled"` as before, and the save that runs after the answer uses the Background Save preference. Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). In the desktop app, a save that runs in the background shows in the progress window after 0.4 s with a moving bar. `file.cancelSave` stops every such save before it replaces its file → `{cancelled: n}`: the file stays as it was, and the document keeps its file and format and stays modified. A save whose file was already being replaced finishes and is reported as saved. `file.saveInBackground` closes the window while the saves go on → `{hidden: n}`. | -| `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `hpgl` (a `.plt` plot file for plotters and cutters), `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF, WMF and HP-GL write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. | +| `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `pict` (a QuickDraw `.pct` picture), `hpgl` (a `.plt` plot file for plotters and cutters), `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF, WMF, PICT and HP-GL write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. | | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` for type on a path (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning). An invalid effect is rejected before editing. `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | | `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Successful panel operations, direct `object.pathfinder.*` commands, and `command.batch` steps (including Actions panel playback) set its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits, live effects and `action.batch` do not set history. With no history it returns "no Pathfinder operation applied yet". | @@ -13564,13 +13564,43 @@ under any name. Opcodes and their data lengths follow Apple's inverted shapes, transfer modes other than a copy (drawn as a copy), QuickTime images in formats other than JPEG, and regions or images past the reader's limits. A picture cut short keeps what came before it with a warning, and one that draws nothing VectorCraft reads opens empty with a warning. A file that holds no picture is refused with -"not a PICT file". PICT can't be written: `document.export` to it is refused with "PICT files can be opened but not -written". +"not a PICT file". ```json {"name":"run_command","arguments":{"command":"file.place","params":{"path":"/tmp/logo.pct","at":[300,200]}}} ``` +## PICT export + +`document.export` (and `export`) with format `pict`, or a path ending in `.pct`, `.pic` or `.pict`, writes a QuickDraw +version 2 picture of the first artboard (or `artboard`): 512 bytes of application data, then the picture. Export As +offers it as PICT with the `.pct` extension. `useArtboards: true` writes one file per chosen artboard (`{stem}-{artboard}.pct`), `false` the bounds of the +visible art. The picture's frame is the artboard in points, at most 32,767 points on a side (a larger artboard is +refused). The drawing uses the extended version 2 header at up to 16 device units a point (1,152 dpi), as many as keep +the frame within 16-bit coordinates. The writer follows the opcodes and data layouts of Apple's +[Opcodes in Pictures](https://dev.os9.ca/techpubs/mac/QuickDraw/QuickDraw-461.html) and +[Version and Header Opcodes](https://dev.os9.ca/techpubs/mac/QuickDraw/QuickDraw-459.html): + +- Fills are polygons (`PaintPoly`) in their color, with curves flattened. QuickDraw fills a polygon even-odd, so a path of + several figures is one polygon that runs back along the line between its figures, and a non-zero fill is first + resolved into figures that don't overlap. Art is cut to the frame. A fill too complex to resolve or cut is written + as it is, filled even-odd. A fill of more than 16,381 points is written as several polygons, and a single outline of + more than 16,379 points keeps that many points, evenly spaced. Each of these adds a warning. +- Strokes are their filled outlines, with their caps, joins, miter limit and dashes; a stroke thinner than a device unit + is written one unit wide. +- Images are `DirectBitsRect` pixel maps of 24-bit color in tiles of at most 1,024 pixels on a side, each row packed + with PackBits. Mirrored images and images turned by quarter turns keep their placement; other turns and skews are + written upright, filling their bounds, with a warning. PICT has no transparency: images are written over white, with + a warning. +- Type is written as outlines. Clipping masks, gradients, patterns, transparency and blending are written as WMF writes + them (clipped art whole, gradients and patterns as one color), each with its warning. + +`document.open` reads a written picture back with the reader above. + +```json +{"name":"run_command","arguments":{"command":"document.export","params":{"format":"pict","useArtboards":true,"path":"/tmp/icons.pct"}}} +``` + ## HP-GL import `document.open` and `file.place` read HP-GL/2 plot files (`.plt`, `.hpgl`, `.hgl`, `.hpg`) into one layer, with the From 32ae1862cc7e4f6ffde065c5b96640b61afd9ff6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:52:54 -0800 Subject: [PATCH 032/115] Cargo: pin craft-i18n to the craft-libs rev the other craft crates use main moved every craft-libs dependency to 4f3e34d0, and the craft-i18n line added for the digit input still named 4c330f6b. crates/i18n is the same at both revs, so Cargo.lock keeps one craft-i18n package. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 79446f9246..71e64927a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dd craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["tree"] } craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } # Digits typed in any script in numeric fields (`vectorcraft_doc::units`). -craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "4c330f6bd1f38dd536f830483ea9618db2cb2bd8" } +craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } # DXF tags, reader and writer (craft-libs#778, #926, #927). From 116049ca656b817682bbee8ba2180389e876f418 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:54:36 -0800 Subject: [PATCH 033/115] Docs: number input reads Unicode 16 decimal digits, not digits of any script craft-i18n's digit table (ZEROS in crates/i18n/src/number.rs) lists the decimal digit sets of Unicode 16.0, so a digit added in a later Unicode version is not read. docs/mcp.md, the Number input section of docs/localization-parity.md, its revision row and the doc comments in crates/doc/src/units.rs now say Unicode 16 decimal digits. --- crates/doc/src/units.rs | 4 ++-- docs/localization-parity.md | 6 +++--- docs/mcp.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index 2e4b4e5c1b..c114ceb75f 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -206,7 +206,7 @@ impl Unit { /// Text with more than 128 `+ - * /` signs ([`arithmetic_signs`], a multiplication sign counted /// as `*`) reads as nothing. /// - /// Digits may be in any script ([`ascii_digits`]): `१२ mm` is `12 mm`, `૪૫*૨` is `45*2`. + /// Digits may be any Unicode 16 decimal digits ([`ascii_digits`]): `१२ mm` is `12 mm`, `૪૫*૨` is `45*2`. pub fn parse(self, s: &str) -> Option { if arithmetic_signs(s) > MAX_MEASURE_OPERATORS { return None; @@ -428,7 +428,7 @@ pub fn decimal_point(text: &str) -> Cow<'_, str> { if text.contains(',') && !thousands(&text) { text.replace(',', ".").into() } else { text } } -/// `text` with every Unicode decimal digit (Devanagari `०-९`, Gujarati `૦-૯`, Bengali, +/// `text` with every Unicode 16 decimal digit (Devanagari `०-९`, Gujarati `૦-૯`, Bengali, /// Arabic-Indic, full-width, …) written as its ASCII digit, so `१२.५ mm` reads as `12.5 mm`. A /// number here is a run of digits, `.` and `,`, and must use one digit set: `1२` and `૧२` are /// `None`. Operators, unit suffixes and other characters are left as they are. diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 2f886918e6..61a0389dfc 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -94,8 +94,8 @@ translated. ## Number input -Number fields and command parameters given as text (MCP, the control channel, `addon.units.convert`) read digits in -any script (Devanagari `१२ mm`, Gujarati `૪૫*૨`, Bengali, Arabic-Indic, full-width). Units, arithmetic and the decimal +Number fields and command parameters given as text (MCP, the control channel, `addon.units.convert`) read the +decimal digits of Unicode 16 (Devanagari `१२ mm`, Gujarati `૪૫*૨`, Bengali, Arabic-Indic, full-width). Units, arithmetic and the decimal comma work as they do with ASCII digits. One number mixing digit sets (`1२`) is refused. Both readers take their digits from craft-i18n (storytold/craft-libs#198 track 5): the dialog fields and parameters VectorCraft reads itself through `vectorcraft_doc::units` use `craft_i18n::ascii_digits`, and fields on the shared craft number field (the panels, and @@ -110,7 +110,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| -| 2026-12-05 | minor | Number input: number fields and command parameters given as text read Devanagari, Gujarati and other Unicode digits, with units, arithmetic and the decimal comma as for ASCII digits; a number mixing digit sets is refused. `vectorcraft_doc::units` uses `craft_i18n::ascii_digits`, and the shared craft number field reads every script after storytold/craft-libs#4872 (storytold/craft-libs#198 track 5); scores and estimates unchanged | +| 2026-12-05 | minor | Number input: number fields and command parameters given as text read Devanagari, Gujarati and other Unicode 16 decimal digits, with units, arithmetic and the decimal comma as for ASCII digits; a number mixing digit sets is refused. `vectorcraft_doc::units` uses `craft_i18n::ascii_digits`, and the shared craft number field reads the same digits after storytold/craft-libs#4872 (storytold/craft-libs#198 track 5); scores and estimates unchanged | | 2026-12-02 | minor | Gujarati (`gu`): Web: Gujarati can be selected as the interface language; the web fetches Noto Sans Gujarati when the interface needs it (`crates/text/web-fonts.txt`, `demand`), as it does Noto Sans Devanagari for Hindi. Status/error messages remain partial. Scores and estimates unchanged. | | 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | diff --git a/docs/mcp.md b/docs/mcp.md index 248e24bc5c..da5982fd55 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -19755,7 +19755,7 @@ Converter and in its panel (`window.panel {panel: "unitConverter"}`). Neither co `addon.units.convert {value, unit?}` accepts a number, or text with a unit suffix and `+ - * /` arithmetic, where `x`, `X` and `×` multiply as `*` does (`"10mm"`, `"1in/2"`, `"2p6"`, `"1080/2 px"`, `"3cm*50%"`, `"2x3 mm"`, `"13q"`). The command reads an unambiguous decimal comma as a point (`"0,5 mm"`). -Digits may be in any script, one set per number (`"१२ mm"`, `"૪૫*૨"`); `"1२"` is refused. +Digits may be any Unicode 16 decimal digits, one set per number (`"१२ mm"`, `"૪૫*૨"`); `"1२"` is refused. It refuses numbers that look like grouped integers, whether alone (`"1,000 mm"`) or in arithmetic (`"1,500+2"`). Text may contain at most 1024 bytes and 128 `+ - * /` signs (each multiplication sign counts). A number without a suffix is in `unit` (a unit's name, suffix or key: `points`, `picas`, `inches`, `millimeters`, From 7961e2563b77137edbcbd5b52ca205333847de41 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:57:45 -0800 Subject: [PATCH 034/115] Tests: check the imported instance transforms with is_finite The gate's test-lint flagged the coefficient .all() check as unguarded. --- crates/cad/src/import/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index 08f683a65f..fae4602028 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -1158,7 +1158,7 @@ fn a_dashed_block_at_a_tiny_scale_in_a_huge_fitted_drawing_keeps_a_finite_instan } assert!(instances.iter().any(|(symbol, _)| symbol == "D0"), "{instances:?}"); for (symbol, xf) in &instances { - assert!(xf.as_coeffs().iter().all(|c| c.is_finite()), "{symbol}: {xf:?}"); + assert!(xf.is_finite(), "{symbol}: {xf:?}"); } } From 545f6f97cf79b4fa6526e1e9ee3016cede5c410e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:39:15 -0800 Subject: [PATCH 035/115] 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 036/115] 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 d327a20efd9c2f3d740c8d06ad44704012f0e22a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:54:48 -0800 Subject: [PATCH 037/115] Locale: raster resolution and Export for Screens sizes read Unicode digits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit document.rasterEffectsSettings' text resolution ("300 ppi") and ScreenSize::parse ("2x", "100w", "144ppi") read their numbers with str::parse and an ASCII-only check, so "३०० ppi" and "२x" were refused while number fields read them. Both now convert digits with vectorcraft_doc::ascii_digits, now public, before their own grammar and range checks; one number mixing digit sets is still refused. --- crates/doc/src/lib.rs | 2 +- crates/doc/src/units.rs | 2 +- crates/engine/src/cmd/fileio/screens.rs | 5 +++-- crates/engine/src/cmd/fileio/tests_screens.rs | 11 +++++++++++ crates/engine/src/cmd/rasterfx.rs | 5 ++++- crates/engine/src/tests/rastersettings.rs | 13 +++++++++++++ 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index 7bddc2c482..7772056668 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -179,7 +179,7 @@ use limits::MAX_NEXT_ID; pub use limits::{DocError, FORMAT_VERSION, MAX_COORD}; pub use records::{ImageBlob, MaskEdit, NewArtIds, SavedSelection, SavedView, SvgFilter, Symbol, SymbolEdit}; pub use stored_art::{StoredPlace, StoredRoot}; -pub use units::{ColorMode, Unit, arithmetic_signs, decimal_point, finite_in_every_unit, parse_number}; +pub use units::{ColorMode, Unit, arithmetic_signs, ascii_digits, decimal_point, finite_in_every_unit, parse_number}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Document { diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index c114ceb75f..cc4ab253de 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -432,7 +432,7 @@ pub fn decimal_point(text: &str) -> Cow<'_, str> { /// Arabic-Indic, full-width, …) written as its ASCII digit, so `१२.५ mm` reads as `12.5 mm`. A /// number here is a run of digits, `.` and `,`, and must use one digit set: `1२` and `૧२` are /// `None`. Operators, unit suffixes and other characters are left as they are. -fn ascii_digits(text: &str) -> Option> { +pub fn ascii_digits(text: &str) -> Option> { craft_i18n::ascii_digits(text, |c| matches!(c, '.' | ',')).ok() } diff --git a/crates/engine/src/cmd/fileio/screens.rs b/crates/engine/src/cmd/fileio/screens.rs index 109dd1c59e..8e499f289d 100644 --- a/crates/engine/src/cmd/fileio/screens.rs +++ b/crates/engine/src/cmd/fileio/screens.rs @@ -46,9 +46,10 @@ impl ScreenSize { /// `2x` (or `2`), `100w`, `100h` or `72ppi`, in any case; positive numbers only. pub fn parse(s: &str) -> Option { let s = s.trim().to_ascii_lowercase(); - // Digits and `.` only: `str::parse` would also take `+2`, `1e2`, `inf` and `nan`. + // Digits and `.` only: `str::parse` would also take `+2`, `1e2`, `inf` and `nan`. Digits of + // other scripts read as ASCII digits do (`"२x"` is `2x`), as number fields read them. let num = |t: &str| { - let t = t.trim(); + let t = vectorcraft_doc::ascii_digits(t.trim())?; if !t.bytes().all(|b| b.is_ascii_digit() || b == b'.') { return None; } diff --git a/crates/engine/src/cmd/fileio/tests_screens.rs b/crates/engine/src/cmd/fileio/tests_screens.rs index 93c4d7e6b1..491fca372e 100644 --- a/crates/engine/src/cmd/fileio/tests_screens.rs +++ b/crates/engine/src/cmd/fileio/tests_screens.rs @@ -72,6 +72,17 @@ fn sizes_parse_as_factor_width_height_or_resolution() { ); } +#[test] +fn sizes_read_digits_of_other_scripts() { + assert_eq!(ScreenSize::parse("२x"), Some(ScreenSize::Scale(2.0))); + assert_eq!(ScreenSize::parse("૧૦૦W"), Some(ScreenSize::Width(100.0))); + assert_eq!(ScreenSize::parse("१४४ppi"), Some(ScreenSize::Ppi(144.0))); + // One digit set per number, and the same grammar as ASCII digits. + for bad in ["1२x", "१.5x", "-२x", "०w"] { + assert_eq!(ScreenSize::parse(bad), None, "{bad}"); + } +} + #[test] fn a_width_or_height_row_gives_that_many_pixels() { let mut s = session(1); diff --git a/crates/engine/src/cmd/rasterfx.rs b/crates/engine/src/cmd/rasterfx.rs index 97dd890457..b567c0f3a0 100644 --- a/crates/engine/src/cmd/rasterfx.rs +++ b/crates/engine/src/cmd/rasterfx.rs @@ -71,7 +71,10 @@ fn resolution(v: &Value) -> Result { "screen" => 72.0, "medium" => 150.0, "high" => 300.0, - other => other.trim_end_matches("ppi").trim().parse::().map_err(|_| bad(C, format!("unknown resolution `{v}`")))?, + // Digits of other scripts read as ASCII digits do (`"३००"` is 300), as number fields read them. + other => vectorcraft_doc::ascii_digits(other.trim_end_matches("ppi").trim()) + .and_then(|n| n.parse::().ok()) + .ok_or_else(|| bad(C, format!("unknown resolution `{v}`")))?, }, v => v.as_f64().ok_or_else(|| bad(C, "resolution must be a number or screen|medium|high"))?, }; diff --git a/crates/engine/src/tests/rastersettings.rs b/crates/engine/src/tests/rastersettings.rs index 6e3ef16476..fd88793cc9 100644 --- a/crates/engine/src/tests/rastersettings.rs +++ b/crates/engine/src/tests/rastersettings.rs @@ -91,6 +91,19 @@ fn settings_report_change_in_one_step_and_reject_junk() { assert_eq!(s.execute(C, &json!({"colorModel": "cmyk"})).unwrap()["colorModel"], "cmyk"); } +#[test] +fn a_resolution_given_as_text_reads_digits_of_other_scripts() { + let mut s = session(); + let r = s.execute(C, &json!({"resolution": "३०० ppi"})).unwrap(); + assert_eq!(r["resolution"].as_f64(), Some(300.0)); + assert_eq!(s.doc().unwrap().doc.raster_effects_ppi, 300.0); + // One digit set per number, and the same 1 to 2400 ppi range as ASCII digits. + for bad in ["1५0", "५०००"] { + assert!(s.execute(C, &json!({"resolution": bad})).is_err(), "{bad}"); + } + assert_eq!(s.doc().unwrap().history.undo.len(), 1); +} + #[test] fn a_white_background_makes_effect_images_opaque() { let mut s = session(); From 987da47762a54c7c623610af0a62757e76a47fa3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:56:48 -0800 Subject: [PATCH 038/115] PICT: small curved figures stay when a fill is flattened more coarsely A fill with more points than one polygon holds is flattened more coarsely, and a small figure of two curves could then shrink to two points and be left out. Each figure now keeps its finer outline when the coarser one would drop it. The warnings and docs/mcp.md now give the polygon limits as 8,189 and 8,187 points, since a polygon's size is a signed 16-bit count. --- crates/metafile/src/encode.rs | 4 ++-- crates/metafile/src/pict.rs | 11 ++++++++++- crates/metafile/src/tests/pict_export.rs | 25 ++++++++++++++++++++++++ docs/mcp.md | 4 ++-- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/crates/metafile/src/encode.rs b/crates/metafile/src/encode.rs index cf171a70de..4dfdda49b8 100644 --- a/crates/metafile/src/encode.rs +++ b/crates/metafile/src/encode.rs @@ -22,8 +22,8 @@ pub(crate) fn write(ops: Vec, region: Rect, kind: Kind, title: &str, let out = crate::pict::write(&ops, region); note(out.translucent_images, "PICT has no transparency: images are written over white"); note(out.turned_images, "PICT turns images only by quarter turns: other turns and skews are written upright, filling their bounds"); - note(out.split_fills, "fills with more than 16,381 points are written as several polygons, which may fill their holes"); - note(out.thinned_fills, "outlines with more than 16,379 points are written with fewer points"); + note(out.split_fills, "fills with more than 8,189 points are written as several polygons, which may fill their holes"); + note(out.thinned_fills, "outlines with more than 8,187 points are written with fewer points"); note(out.unresolved_fills, "non-zero fills too complex to resolve are written even-odd, which may leave overlaps unfilled"); note(out.uncut_fills, "fills too complex to cut to the artboard that reach far outside it may be written distorted"); Ok(out.bytes) diff --git a/crates/metafile/src/pict.rs b/crates/metafile/src/pict.rs index 043618aa2b..bd5bf7b3ae 100644 --- a/crates/metafile/src/pict.rs +++ b/crates/metafile/src/pict.rs @@ -309,7 +309,16 @@ impl Writer { break; } flatness *= 4.0; - figs = self.figures(path, flatness); + figs = vectorcraft_geom::bez::subpaths(path) + .into_iter() + .flat_map(|(range, _)| { + let subpath = BezPath::from_vec(path.elements()[range].to_vec()); + let coarse = self.figures(&subpath, flatness); + // A small curved figure can collapse to two points. Keep its finer outline + // rather than leave it out; splitting and thinning still bound polygon size. + if coarse.is_empty() { self.figures(&subpath, FLATNESS) } else { coarse } + }) + .collect(); } if figs.is_empty() { return; diff --git a/crates/metafile/src/tests/pict_export.rs b/crates/metafile/src/tests/pict_export.rs index 26ee1047df..1660db9dc2 100644 --- a/crates/metafile/src/tests/pict_export.rs +++ b/crates/metafile/src/tests/pict_export.rs @@ -321,6 +321,31 @@ fn pict_polygon_sizes_fit_a_signed_word() { } } +#[test] +fn pict_coarse_flattening_keeps_small_curved_figures() { + // Even four points per lens, plus closing points and bridges, exceed one polygon. + // At the coarsest flatness both curves become lines between the same two endpoints. + let lenses: Vec = (0..2200) + .map(|i| { + let (x, y) = (f64::from(i % 50) * 1.5 + 1.0, f64::from(i / 50) * 1.5 + 1.0); + let mut bp = BezPath::new(); + bp.move_to((x, y)); + bp.quad_to((x + 0.5, y - 0.5), (x + 1.0, y)); + bp.quad_to((x + 0.5, y + 0.5), (x, y)); + bp.close_path(); + bp + }) + .collect(); + let out = pict(&doc_with(100.0, 100.0, vec![compound(&lenses, FillRule::EvenOdd)])); + let pic = read(&out); + for i in [0, lenses.len() / 2, lenses.len() - 1] { + let p = lenses[i].bounding_box().center(); + assert!(painted(&pic, (p.x, p.y)), "lens {i} was lost"); + } + assert!(fills(&pic).len() > 1); + assert!(out.warnings.iter().any(|w| w.contains("several polygons")), "{:?}", out.warnings); +} + #[test] fn a_fill_past_one_polygon_is_split_or_thinned() { // 3,000 separate squares: more points than one polygon holds. diff --git a/docs/mcp.md b/docs/mcp.md index 8bb7aff2f2..06ebf4f3b2 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13619,8 +13619,8 @@ the frame within 16-bit coordinates. The writer follows the opcodes and data lay - Fills are polygons (`PaintPoly`) in their color, with curves flattened. QuickDraw fills a polygon even-odd, so a path of several figures is one polygon that runs back along the line between its figures, and a non-zero fill is first resolved into figures that don't overlap. Art is cut to the frame. A fill too complex to resolve or cut is written - as it is, filled even-odd. A fill of more than 16,381 points is written as several polygons, and a single outline of - more than 16,379 points keeps that many points, evenly spaced. Each of these adds a warning. + as it is, filled even-odd. A fill of more than 8,189 points is written as several polygons, and a single outline of + more than 8,187 points keeps that many points, evenly spaced. Each of these adds a warning. - Strokes are their filled outlines, with their caps, joins, miter limit and dashes; a stroke thinner than a device unit is written one unit wide. - Images are `DirectBitsRect` pixel maps of 24-bit color in tiles of at most 1,024 pixels on a side, each row packed From c2485d29ef5be4720fb3227b9b2829d409ab2d9a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:05:45 -0800 Subject: [PATCH 039/115] Swatches: a Swatch Strip panel of one-click color chips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Window › Swatch Strip shows a None chip and then the document's color swatches as a row of chips that wraps to the panel's room and scrolls when the chips do not fit. Docked on the window's bottom edge the chips run across in one line; in a dock column or a narrow floating window they run down it. Gradient and pattern swatches are left out. A click on a chip sets the fill (paint.setFill) and a right-click or an Alt-click sets the stroke (paint.setStroke). Both pass focus: false, so the active Fill or Stroke proxy stays as it was. - window.panel {panel: "swatchStrip"} shows the panel, and window.panel.dock with placement {"Edge": "Bottom"} beside the canvas docks it along the bottom edge. - The Swatches panel's shown() is shared so the strip draws a spot color the way its art shows it. Docs: docs/control-protocol.md, ROADMAP. Fixes #10951 --- ROADMAP.md | 1 + crates/ui-egui/src/menus/tree.rs | 1 + crates/ui-egui/src/panels.rs | 2 + crates/ui-egui/src/panels/swatch_strip.rs | 216 ++++++++++++++++++++++ crates/ui-egui/src/panels/swatches.rs | 2 +- crates/ui-egui/src/state.rs | 1 + docs/control-protocol.md | 7 + 7 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 crates/ui-egui/src/panels/swatch_strip.rs diff --git a/ROADMAP.md b/ROADMAP.md index 9b6adac135..9eb13ef8d4 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -124,6 +124,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap ## Progress log +- 2026-12-05: Window › Swatch Strip shows a None chip and the document's color swatches as a strip of chips that wraps to the panel's room: docked on the window's bottom edge it runs across in one line, and in a dock column or a narrow floating window it runs down. A click sets the fill and a right-click or Alt-click sets the stroke (#10951). A VectorCraft addition: headline numbers unchanged. - 2026-12-04: Raster Settings OK edits the objects selected when the dialog opened. It keeps the dialog open with the reason if its document is not active, was reverted or had an Undo, a Redo or a canceled edit that put back an earlier state, if a target was changed, deleted, locked or hidden, if another edit is in progress, or if the change is refused. Headline numbers unchanged. - 2026-12-04: Paste from CAD apps: on Windows, Paste reads the enhanced metafile CAD and office apps copy as vector art, and a `.dxf`, `.dwg` or HP-GL plot file copied in a file manager pastes as its drawing through the new command `clipboard.importCad` (#10819). Headline numbers unchanged. diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index dad0879333..fd144ad2b2 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -798,6 +798,7 @@ fn built_in_tree(english_names: bool, listed: &Listed) -> Vec<(&'static str, Vec panel("Separations Preview", "separations"), panel("Stroke", "stroke"), panel("SVG Interactivity", crate::panels::svg_interactivity::ID), + panel("Swatch Strip", crate::panels::swatch_strip::ID), panel("Swatches", "swatches"), panel("Symbols", "symbols"), panel("Transform", "transform"), diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index cf129bf26c..adbacb0382 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -46,6 +46,7 @@ pub mod script_console; pub mod separations; pub mod stroke; pub mod svg_interactivity; +pub mod swatch_strip; pub mod swatches; pub mod symbols; pub mod tabs; @@ -568,6 +569,7 @@ pub(crate) fn set_part_hidden(app: &mut VectorcraftApp, key: &'static str, on: b pub fn show_icon_panel(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { match id { "swatches" => swatches::show(app, ui), + swatch_strip::ID => swatch_strip::show(app, ui), "color" => color::show(app, ui), "colorGuide" => color_guide::show(app, ui), "stroke" => stroke::show(app, ui), diff --git a/crates/ui-egui/src/panels/swatch_strip.rs b/crates/ui-egui/src/panels/swatch_strip.rs new file mode 100644 index 0000000000..f6a5f4e8f2 --- /dev/null +++ b/crates/ui-egui/src/panels/swatch_strip.rs @@ -0,0 +1,216 @@ +//! Swatch Strip panel (Window › Swatch Strip): a None chip, then the document's color swatches, in a row of chips +//! that wraps to the room the panel has. Docked along the bottom of the window (`window.panel.dock {panel: +//! "swatchStrip", anchor: "canvas", placement: {"Edge": "Bottom"}}`, or a drop on the bottom edge) the chips run +//! across in one line; in a dock column or a narrow floating window they wrap down the column, and scroll when they +//! do not fit. +//! +//! A click on a chip sets the fill (`paint.setFill`); a right-click or an Alt-click sets the stroke +//! (`paint.setStroke`). Neither changes which of the Fill and Stroke proxies is active. + +use craft::theme::Srgba; +use craft::ui::choice::Swatch; +use craft::ui::contract::{Props as _, Scroll, Show as _, ShowContainer as _}; +use craft::ui::layout_components::{Row, Stack}; +use egui::{PointerButton, Ui}; +use serde_json::{Value, json}; +use vectorcraft_color::Paint; + +use super::srgba; +use crate::VectorcraftApp; + +/// The panel's id, as `window.panel` takes it. +pub const ID: &str = "swatchStrip"; + +/// One chip: its name, the color it shows (`None`: the None chip) and the paint params a pick sends. +struct Chip { + name: String, + color: Option, + params: Value, +} + +/// The None chip, then each color swatch of the active document in the Swatches panel's order (the swatches outside +/// any color group, then each group's), shown in the color its art shows. Gradient and pattern swatches are left out. +fn chips(app: &VectorcraftApp) -> Vec { + let Some(st) = app.session.active() else { return Vec::new() }; + let d = &st.doc; + let none = Chip { name: tl!("None").to_owned(), color: None, params: json!({"none": true}) }; + let swatches = d.swatches_iter().filter_map(|s| match super::swatches::shown(d, s).0 { + Paint::Solid { color, .. } => Some(Chip { name: s.name.clone(), color: Some(srgba(&color)), params: json!({"swatch": s.name}) }), + _ => None, + }); + std::iter::once(none).chain(swatches).collect() +} + +/// Sets the fill (`stroke`: the stroke) to the chip's paint, leaving the active proxy as it is. +fn apply(app: &mut VectorcraftApp, chip: &Chip, stroke: bool) { + let mut params = chip.params.clone(); + params["focus"] = json!(false); + app.run(if stroke { "paint.setStroke" } else { "paint.setFill" }, params).ok(); +} + +/// The panel's body. +pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { + if app.session.active().is_none() { + super::empty_state(ui, "swatch-book", tl!("No document"), tl!("Open a document to see its swatches.")); + return; + } + let chips = chips(app); + let mut picked = None; + Stack::new().id_salt(ID).fill().scroll(Scroll::vertical()).show(ui, |ui, _| { + Row::new().fill_width().wrap(true).show(ui, |ui, _| { + for (at, chip) in chips.iter().enumerate() { + let swatch = match chip.color { + Some(color) => Swatch::new(chip.name.clone(), color), + None => Swatch::optional(chip.name.clone(), None::), + }; + let out = swatch.id_salt(at).tooltip(chip.name.clone()).show(ui); + // A right-click ends on the chip, as the framework's swatch palette reads one. + let secondary = out.response.contains_pointer() && ui.input(|i| i.pointer.button_released(PointerButton::Secondary)); + if out.clicked || secondary { + picked = Some((at, secondary || out.activation.is_some_and(|a| a.mods.alt))); + } + } + }); + }); + if let Some((at, stroke)) = picked + && let Some(chip) = chips.get(at) + { + apply(app, chip, stroke); + } +} + +#[cfg(test)] +mod tests { + use craft::behavior::Axis; + use craft::behavior::dock::Node; + use egui::{Modifiers, vec2}; + use serde_json::json; + use vectorcraft_color::Paint; + use vectorcraft_engine::Session; + + use super::show; + use crate::VectorcraftApp; + use crate::tests::panel_harness::Panel; + + /// A document with three global color swatches (art painted with one stays linked to it) and a gradient swatch, + /// and one selected rectangle. + fn app() -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + for (name, color) in [("Strip Red", "#cc2222"), ("Strip Green", "#22aa44"), ("Strip Blue", "#2244cc")] { + app.run("swatch.new", json!({"name": name, "color": color, "global": true})).unwrap(); + } + let ramp = json!({"kind": "linear", "stops": [{"offset": 0, "color": "#000"}, {"offset": 1, "color": "#fff"}]}); + app.run("swatch.new", json!({"name": "Strip Ramp", "gradient": ramp})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + app + } + + /// The fill and stroke the Fill and Stroke proxies show: the selected rectangle's. + fn paints(panel: &Panel) -> (Paint, Paint) { + crate::panels::current_paints(&panel.app()) + } + + /// The swatch a solid paint is linked to. + fn swatch_of(paint: &Paint) -> Option { + match paint { + Paint::Solid { swatch, .. } => swatch.clone(), + _ => None, + } + } + + #[test] + fn a_click_sets_the_fill_and_a_right_click_or_alt_click_the_stroke() { + let mut panel = Panel::new(app(), show); + let fill_active = panel.app().session.fill_active; + + panel.click("Strip Red"); + let (fill, stroke) = paints(&panel); + assert_eq!(swatch_of(&fill).as_deref(), Some("Strip Red"), "a click sets the fill"); + assert_ne!(swatch_of(&stroke).as_deref(), Some("Strip Red"), "a click leaves the stroke"); + + panel.secondary_click("Strip Green"); + let (fill, stroke) = paints(&panel); + assert_eq!(swatch_of(&stroke).as_deref(), Some("Strip Green"), "a right-click sets the stroke"); + assert_eq!(swatch_of(&fill).as_deref(), Some("Strip Red"), "a right-click leaves the fill"); + + panel.click_with("Strip Blue", Modifiers::ALT); + let (fill, stroke) = paints(&panel); + assert_eq!(swatch_of(&stroke).as_deref(), Some("Strip Blue"), "an Alt-click sets the stroke"); + assert_eq!(swatch_of(&fill).as_deref(), Some("Strip Red"), "an Alt-click leaves the fill"); + + assert_eq!(panel.app().session.fill_active, fill_active, "the active proxy stays as it was"); + } + + #[test] + fn the_none_chip_comes_first_and_takes_the_paint_off() { + let mut panel = Panel::new(app(), show); + let none = panel.rect("None"); + let red = panel.rect("Strip Red"); + assert!(none.left() < red.left() || none.top() < red.top(), "the None chip comes before the swatches: {none:?} {red:?}"); + + panel.click("Strip Red"); + panel.click("None"); + assert!(paints(&panel).0.is_none(), "a click on None takes the fill off"); + panel.secondary_click("None"); + assert!(paints(&panel).1.is_none(), "a right-click on None takes the stroke off"); + } + + #[test] + fn only_color_swatches_get_chips() { + let panel = Panel::new(app(), show); + assert!(panel.shows("Strip Red"), "a color swatch has a chip"); + assert!(!panel.shows("Strip Ramp"), "a gradient swatch has none"); + } + + #[test] + fn the_chips_run_along_a_wide_strip_and_wrap_down_a_narrow_one() { + let mut panel = Panel::new(app(), show); + let names = ["None", "Strip Red", "Strip Green", "Strip Blue"]; + + panel.room(vec2(4000.0, 200.0)).frame(); + panel.frame(); + let rects: Vec<_> = names.iter().map(|n| panel.rect(n)).collect(); + for pair in rects.windows(2) { + assert!((pair[0].center().y - pair[1].center().y).abs() < 1.0, "the chips share one line: {pair:?}"); + assert!(pair[0].right() <= pair[1].left(), "each chip lies after the one before it without overlapping: {pair:?}"); + } + + let one_chip = rects[0].width(); + panel.room(vec2(one_chip * 2.5, 2000.0)).frame(); + panel.frame(); + let first = panel.rect("None"); + let last = panel.rect("Strip Blue"); + assert!(last.top() >= first.bottom(), "in a narrow column a later chip wraps below the first: {first:?} {last:?}"); + assert!(last.right() <= one_chip * 2.5 + 0.5, "the chips stay inside the column: {last:?}"); + } + + /// Whether `node` holds panel `panel`. + fn holds(node: &Node, panel: &str) -> bool { + match node { + Node::Split { first, second, .. } => holds(first, panel) || holds(second, panel), + Node::Tabs { panels, .. } => panels.iter().any(|p| p == panel), + Node::Stack { entries, .. } => entries.iter().any(|e| e.panel == panel), + Node::Dock { columns, .. } => columns.iter().any(|c| c.panels().any(|p| p == panel)), + _ => false, + } + } + + /// Whether `node` has a split of rows with `upper` in its top part and `lower` in its bottom part. + fn above(node: &Node, upper: &str, lower: &str) -> bool { + match node { + Node::Split { axis: Axis::Y, first, second, .. } if holds(first, upper) && holds(second, lower) => true, + Node::Split { first, second, .. } => above(first, upper, lower) || above(second, upper, lower), + _ => false, + } + } + + #[test] + fn the_strip_docks_along_the_bottom_edge_below_the_canvas() { + let mut app = app(); + app.run("window.panel.dock", json!({"panel": super::ID, "anchor": "canvas", "placement": {"Edge": "Bottom"}})).unwrap(); + let layout = crate::panel_docking::layout_of(&app.ui); + let root = layout.root.as_ref().expect("a docked layout"); + assert!(above(root, crate::panel_docking::CANVAS, super::ID), "the strip lies in a row below the canvas: {root:?}"); + } +} diff --git a/crates/ui-egui/src/panels/swatches.rs b/crates/ui-egui/src/panels/swatches.rs index bea36866bb..8142bc9d33 100644 --- a/crates/ui-egui/src/panels/swatches.rs +++ b/crates/ui-egui/src/panels/swatches.rs @@ -284,7 +284,7 @@ fn highlighted<'a>(d: &'a Document, sel: &'a [String]) -> Vec<&'a str> { /// The `swatch`'s paint as the panel shows it, and whether it is global and spot. A tint swatch shows its base's kind; /// a spot colour shows the colour its art shows (a Lab one's CMYK equivalent when the Spot Colors options use those). -fn shown(d: &Document, s: &Swatch) -> (Paint, bool, bool) { +pub(crate) fn shown(d: &Document, s: &Swatch) -> (Paint, bool, bool) { let (global, spot) = s.tint_of().and_then(|(base, _)| d.swatch(base)).map_or((s.global, s.spot), |b| (b.global, b.spot)); let paint = match s.paint { Paint::Solid { color, swatch: None, .. } if spot => Paint::solid(d.linked_color(color, true)), diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index cfc38a0be6..133f7e97e8 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -308,6 +308,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[ ("color", "Color", "palette"), ("colorGuide", "Color Guide", "dc-color-guide"), ("swatches", "Swatches", "swatch-book"), + (crate::panels::swatch_strip::ID, "Swatch Strip", "swatch-book"), ("brushes", "Brushes", "paintbrush"), ("symbols", "Symbols", "spray-can"), ("patternOptions", "Pattern Options", "grid-3x3"), diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 0f4d35f635..204d98696d 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -289,6 +289,13 @@ or `rgbPercent` value that is not true or false. The desktop app keeps the four switches R, G and B between percent and 0 to 255 and answers true when they show in percent; a parameter answers an error and changes nothing. +Swatch Strip panel (`window.panel {panel: "swatchStrip"}`): a None chip, then the document's color swatches (the +swatches outside any color group, then each group's; gradient and pattern swatches are left out), in a row of chips +that wraps to the panel's room and scrolls when they do not fit. `window.panel.dock {panel: "swatchStrip", anchor: +"canvas", placement: {"Edge": "Bottom"}}` docks it along the window's bottom edge, where the chips run across in one +line. A click on a chip runs `paint.setFill {swatch}` (`{none: true}` for None) and a right-click or an Alt-click +runs `paint.setStroke`, both with `focus: false`, so the active proxy stays as it was. + Color Themes panel (`window.panel {panel: "colorThemes"}`): its Create tab makes a theme on a harmony wheel and its My Themes tab lists the saved themes; every action runs a command (`colorTheme.save`, `colorTheme.delete`, `colorTheme.addToSwatches`, `swatch.newGroup` for the theme being made), and `colorTheme.list` reads the library. From 276a00fe18b8974bcf16b99db64ae362493fbe3e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:06:19 -0800 Subject: [PATCH 040/115] 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 432930961fdea35748897fba086c061e9403304c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:06:44 -0800 Subject: [PATCH 041/115] PICT: art on a fractional artboard keeps its size when it opens again The picture frame is in whole points, but the frame in device units was rounded from the artboard's own size, so a reader scaled the drawing by their ratio: on a 100.4 pt artboard art at x = 80 opened near 79.7. The device frame is now the picture frame times the device units a point, and art is cut to that frame. --- crates/metafile/src/pict.rs | 7 +++---- crates/metafile/src/tests/pict_export.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/metafile/src/pict.rs b/crates/metafile/src/pict.rs index bd5bf7b3ae..843f7eac64 100644 --- a/crates/metafile/src/pict.rs +++ b/crates/metafile/src/pict.rs @@ -146,16 +146,15 @@ struct Writer { /// Write `ops` (no clips: [`crate::scene::Scene`] gives none for this format) as a PICT file of /// `region` (corners in order, finite, with an area, within [`check_region`]). pub(crate) fn write(ops: &[Op], region: Rect) -> Pict { - let k = units_per_point(region.width(), region.height()); let size = |v: f64| (v.round()).clamp(1.0, MAX_I16) as i16; let (w, h) = (size(region.width()), size(region.height())); - let dev = |v: f64| (v * k).round().clamp(1.0, MAX_I16) as i16; - let (dw, dh) = (dev(region.width()), dev(region.height())); + let k = units_per_point(f64::from(w), f64::from(h)); + let (dw, dh) = (w * k as i16, h * k as i16); let mut wr = Writer { out: Out(vec![0; FILE_HEADER]), to_dev: Affine::scale(k) * Affine::translate(-region.origin().to_vec2()), k, - cut: region.inflate(1.0, 1.0), + cut: Rect::from_origin_size(region.origin(), (f64::from(w), f64::from(h))).inflate(1.0, 1.0), frame: Rect::new(0.0, 0.0, f64::from(dw), f64::from(dh)), fg: None, lost: Pict::default(), diff --git a/crates/metafile/src/tests/pict_export.rs b/crates/metafile/src/tests/pict_export.rs index 1660db9dc2..175318315f 100644 --- a/crates/metafile/src/tests/pict_export.rs +++ b/crates/metafile/src/tests/pict_export.rs @@ -139,6 +139,18 @@ fn pict_frame_is_the_region_in_points_and_art_lands_within_a_sixteenth_of_a_poin assert!(near(f[0].0.bounding_box(), r, 1.0 / 16.0), "{:?}", f[0].0.bounding_box()); } +#[test] +fn pict_fractional_artboards_keep_art_within_a_sixteenth_of_a_point() { + let r = Rect::new(20.25, 10.5, 80.0, 50.0); + let d = doc_with(100.4, 60.7, vec![path(shapes::rectangle(r), red(), Paint::None, 0.0)]); + let pic = read(&pict(&d)); + let artboard = d.artboards[0].rect; + assert_eq!((pic.width, pic.height), (artboard.width().round() as f32, artboard.height().round() as f32)); + let f = fills(&pic); + assert_eq!(f.len(), 1, "{f:?}"); + assert!(near(f[0].0.bounding_box(), r, 1.0 / 16.0), "{:?}", f[0].0.bounding_box()); +} + #[test] fn fills_keep_their_holes_and_non_zero_overlaps() { let even_odd = compound(&[square(10.0, 10.0, 90.0, 90.0, true), square(30.0, 30.0, 70.0, 70.0, true)], FillRule::EvenOdd); From e90b66052709aff0f3abb10bf525fee747b8c0f8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:35:32 -0800 Subject: [PATCH 042/115] Save: a file comparison waits for another document's dialog and drops a stale file A save waiting for its file comparison now goes on only when no dialog or file picker of another document is open, so writing it does not activate its document under that dialog. While it waits, no frames are requested. A comparison for a file the document no longer uses is dropped and its save canceled, without asking about the old file, and the next Save starts. --- crates/ui-egui/src/io/save.rs | 36 ++++++++++++++- crates/ui-egui/src/tests/save.rs | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs index c09cbe7106..1fb7d89d3a 100644 --- a/crates/ui-egui/src/io/save.rs +++ b/crates/ui-egui/src/io/save.rs @@ -158,7 +158,15 @@ impl Saves { /// Whether file comparisons need another frame to collect their answers. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn checks_pending(app: &VectorcraftApp) -> bool { - !app.saves.checks.is_empty() + // A save waiting for a dialog goes on in the frame that closes the dialog. + app.saves.checks.keys().any(|uid| !under_dialog(app, *uid)) +} + +/// Whether a dialog or file picker of a document other than `uid` is open: writing document +/// `uid`'s save would activate it under the dialog. +#[cfg(not(target_arch = "wasm32"))] +fn under_dialog(app: &VectorcraftApp, uid: u64) -> bool { + app.session.active().map(|d| d.uid) != Some(uid) && (app.any_dialog_open() || app.file_dialog_open()) } /// The web has no file comparisons to collect. @@ -246,12 +254,24 @@ fn resume_checked(app: &mut VectorcraftApp, wait: bool) { let checking: Vec = app.saves.checks.keys().copied().collect(); for uid in checking { // A closed document's save is cancelled with its flow, in [`pump`]. - if !app.session.documents().iter().any(|d| d.uid == uid) { + let Some(file) = app.session.documents().iter().find(|d| d.uid == uid).map(|d| d.path.clone()) else { + continue; + }; + // Writing activates the save's document: while a dialog or file picker of another document + // is open, the answer stays in its channel for a later pass. + if !wait && under_dialog(app, uid) { continue; } let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); let r = scope.run(|| { file_asks::as_automated(app, automated, |app| { + // The document now uses another file (a Save As finished meanwhile): the comparison + // is dropped and its save cancelled, without asking about the old file. + if app.saves.checks.get(&uid).is_some_and(|c| file.as_deref().map(Path::new) != Some(c.path.as_path())) { + app.saves.checks.remove(&uid); + let step = app.saves.flows.get_mut(&uid).and_then(|f| f.cancel(app.host.files())); + return step.map(|step| run_step(app, uid, step)); + } let (same, path) = app.saves.answer(uid, wait)?; // Still that version: a change made since the comparison is asked about. let Some(stamp) = same.filter(|stamp| FileStamp::at(&path) == Some(*stamp)) else { @@ -278,6 +298,18 @@ pub(crate) fn wait_for_checks(app: &mut VectorcraftApp) { resume_checked(app, true); } +/// Waits for every save's file comparison to answer, leaving each answer for the next [`pump`]. +#[cfg(all(test, not(target_arch = "wasm32")))] +pub(crate) fn wait_for_answers(app: &mut VectorcraftApp) { + for check in app.saves.checks.values_mut() { + let (send, answer) = std::sync::mpsc::channel(); + if let Ok(same) = check.answer.recv() { + let _ = send.send(same); + } + check.answer = answer; + } +} + /// Waits for the active document's baseline digest and compares it with the file. #[cfg(all(test, not(target_arch = "wasm32")))] pub(crate) fn wait_for_contents(app: &VectorcraftApp) -> Option { diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index de7728f9e7..d6c1d0b34d 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -649,3 +649,79 @@ fn save_asks_about_a_changed_file_only_when_its_bytes_changed() { assert_eq!(std::fs::read(&path).unwrap(), other, "nothing is written before the answer"); let _ = std::fs::remove_dir_all(d); } + +/// Opens a file saved by another app, with the file then put back (with other bytes of the same +/// length unless `same`), and one more object: File › Save compares the file before it writes. +fn opened_then_put_back(tag: &str, same: bool) -> (std::path::PathBuf, String, VectorcraftApp) { + let d = dir(tag); + let path = d.join("a.vectorcraft").to_string_lossy().to_string(); + let mut writer = app(); + writer.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + rect(&mut writer); + writer.run("file.saveAs", json!({"path": path})).unwrap(); + crate::background::wait_all(&mut writer); + let mut app = app(); + io::open_path(&mut app, &path).unwrap(); + assert!(io::save::wait_for_contents(&app).is_some(), "the opened file's baseline is recorded"); + let mut other = std::fs::read(&path).unwrap(); + if !same { + let last = other.last_mut().unwrap(); + *last ^= 0xff; + } + put_back(&path, &other); + rect(&mut app); + (d, path, app) +} + +/// A comparison that answers after the document took another file does not ask about the old one. +#[test] +fn a_comparison_for_a_file_the_document_no_longer_uses_asks_nothing() { + let (d, path, mut app) = opened_then_put_back("compare-retargeted", false); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + let other = d.join("b.vectorcraft").to_string_lossy().to_string(); + app.session.doc_mut().unwrap().path = Some(other.clone()); + let before = std::fs::read(&path).unwrap(); + io::save::wait_for_checks(&mut app); + crate::background::wait_all(&mut app); + let asked = app.any_dialog_open(); + let pending = io::save::checks_pending(&app); + let after = std::fs::read(&path).unwrap(); + // The dropped save freed the flow: the next File › Save writes the new file. + let next = app.run("file.save", json!({})); + crate::background::wait_all(&mut app); + let wrote_new = std::path::Path::new(&other).exists(); + let _ = std::fs::remove_dir_all(d); + assert!(next.is_ok(), "the next save starts: {next:?}"); + assert!(wrote_new, "the next save writes the document's new file"); + assert!(!asked, "no changed-on-disk question about a file the document no longer uses"); + assert!(!pending, "the comparison is dropped"); + assert_eq!(after, before, "the old file is not written"); +} + +/// A comparison that answers while a dialog is open over another document waits for it to close, +/// so the save does not activate its own document under the dialog. +#[test] +fn a_comparison_waits_while_a_dialog_is_open_over_another_document() { + let (d, path, mut app) = opened_then_put_back("compare-under-dialog", true); + let before = std::fs::read(&path).unwrap(); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + let prompt = craft::ui::dialog::StandardPrompt::changed_on_disk("other"); + app.dialogs().unwrap().with(|h| h.open(prompt)); + io::save::wait_for_answers(&mut app); + let ctx = egui::Context::default(); + io::save::pump(&mut app, &ctx); + let active = app.session.active_index(); + let pending = io::save::checks_pending(&app); + let unwritten = std::fs::read(&path).unwrap() == before; + // Once the dialog closes, the save goes on and writes the file. + answer_top(&mut app, false); + io::save::pump(&mut app, &ctx); + crate::background::wait_all(&mut app); + let written = std::fs::read(&path).unwrap() != before; + let _ = std::fs::remove_dir_all(d); + assert_eq!(active, Some(1), "the document under the dialog stays active"); + assert!(!pending, "no frames are asked for while the save waits for the dialog"); + assert!(unwritten, "nothing is written while the dialog is open"); + assert!(written, "the save finishes once the dialog closes"); +} From 11aa309eafc49c3226906e7e0df5ed0a62b0f699 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:48:27 -0800 Subject: [PATCH 043/115] PICT: the records are written by craft-metafile's PictWriter The picture header, PaintPoly and DirectBitsRect records and PackBits move to craft_metafile::write::PictWriter (storytold/craft-libs#5541), next to the PICT reader, so other apps can write the format. VectorCraft keeps flattening, cutting to the frame, non-zero fills, stroke outlines and image placement. Every craft-libs dependency moves from 4f3e34d0dd to 71dac21c25, the head of craft-libs#5541, which is that commit plus the writer. --- Cargo.lock | 182 ++++++++++++------------- Cargo.toml | 82 +++++------ apps/vectorcraft-web/Cargo.toml | 2 +- crates/metafile/src/encode.rs | 3 +- crates/metafile/src/pict.rs | 232 ++++---------------------------- xtask/src/pdf_deps.rs | 2 +- 6 files changed, 161 insertions(+), 342 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b396baad94..4329ab1597 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "egui", ] @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "rayon", ] @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "serde", ] @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "gif", ] @@ -1681,7 +1681,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "flate2", ] @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "winsafe", ] @@ -2470,7 +2470,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0#71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 73e26d5375..8a8749d639 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0" } # 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 62605759eb..b1e0f1296d 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/metafile/src/encode.rs b/crates/metafile/src/encode.rs index 4dfdda49b8..ec6671da8a 100644 --- a/crates/metafile/src/encode.rs +++ b/crates/metafile/src/encode.rs @@ -18,8 +18,7 @@ pub(crate) fn write(ops: Vec, region: Rect, kind: Kind, title: &str, }; match kind { Kind::Pict => { - crate::pict::check_region(region)?; - let out = crate::pict::write(&ops, region); + let out = crate::pict::write(&ops, region)?; note(out.translucent_images, "PICT has no transparency: images are written over white"); note(out.turned_images, "PICT turns images only by quarter turns: other turns and skews are written upright, filling their bounds"); note(out.split_fills, "fills with more than 8,189 points are written as several polygons, which may fill their holes"); diff --git a/crates/metafile/src/pict.rs b/crates/metafile/src/pict.rs index 843f7eac64..4c4d8a1c47 100644 --- a/crates/metafile/src/pict.rs +++ b/crates/metafile/src/pict.rs @@ -1,9 +1,8 @@ -//! The PICT writer: a QuickDraw version 2 picture with the extended header, behind a PICT file's -//! 512 bytes of application data, by the opcodes and data layouts of Apple's *Imaging With -//! QuickDraw*, appendix A. +//! The PICT writer: the art WMF gets, as a QuickDraw version 2 picture written through +//! [`craft_metafile::write::PictWriter`], which writes the records. //! -//! The picture frame is the region in points; the drawing is in device units of up to 16 to a -//! point (the header's resolution, at most 1,152 dpi), as many as keep the frame within 16-bit +//! The picture frame is the region in whole points; the drawing is in device units of up to 16 to +//! a point (the header's resolution, at most 1,152 dpi), as many as keep the frame within 16-bit //! coordinates. QuickDraw has no curves, Bézier paths or pens with joins, so: //! //! - fills are polygons (`PaintPoly`) in the fill's color, filled even-odd as QuickDraw fills @@ -17,7 +16,7 @@ use std::sync::Arc; -use craft_metafile::write::Image; +use craft_metafile::write::{Image, PICT_MAX_POLY_POINTS as MAX_POLY_POINTS, PictWriter}; use kurbo::{Affine, BezPath, PathEl, Point, Rect, Shape}; use vectorcraft_color::Paint; use vectorcraft_doc::StrokeLayer; @@ -25,14 +24,10 @@ use vectorcraft_geom::{FillRule, PathData}; use crate::scene::{Op, Pen}; -/// The application data before the picture in a PICT file. -const FILE_HEADER: usize = 512; /// The largest 16-bit coordinate. const MAX_I16: f64 = 32767.0; /// Most device units a point (16, 1,152 dpi). const MAX_SCALE: f64 = 16.0; -/// Most points a polygon holds: its size, in bytes with its 10-byte head, is a signed 16-bit count. -const MAX_POLY_POINTS: usize = (i16::MAX as usize - 10) / 4; /// Curves are flattened to within this many device units. const FLATNESS: f64 = 0.25; /// Times the flatness is raised (four-fold each time) for a fill with too many points before it @@ -43,19 +38,6 @@ const TILE: usize = 1024; /// Opacity at or above this is written as opaque. const OPAQUE: f32 = 0.998; -// Opcodes (*Imaging With QuickDraw*, table A-2). -const CLIP: u16 = 0x0001; -const PN_MODE: u16 = 0x0008; -const PN_PAT: u16 = 0x0009; -const VERSION: u16 = 0x0011; -const RGB_FG_COL: u16 = 0x001A; -const PAINT_POLY: u16 = 0x0071; -const DIRECT_BITS_RECT: u16 = 0x009A; -const OP_END_PIC: u16 = 0x00FF; -const HEADER_OP: u16 = 0x0C00; -/// The `patCopy` transfer mode. -const PAT_COPY: u16 = 8; - /// A written picture and what it could not hold. #[derive(Clone, Debug, Default, PartialEq)] pub(crate) struct Pict { @@ -90,47 +72,13 @@ pub(crate) fn check_region(region: Rect) -> Result<(), String> { Ok(()) } -/// Big-endian bytes being written. -struct Out(Vec); - -impl Out { - fn u8(&mut self, v: u8) { - self.0.push(v); - } - fn u16(&mut self, v: u16) { - self.0.extend_from_slice(&v.to_be_bytes()); - } - fn i16(&mut self, v: i16) { - self.0.extend_from_slice(&v.to_be_bytes()); - } - fn u32(&mut self, v: u32) { - self.0.extend_from_slice(&v.to_be_bytes()); - } - fn bytes(&mut self, b: &[u8]) { - self.0.extend_from_slice(b); - } - /// A rectangle as QuickDraw stores one: top, left, bottom, right. - fn rect(&mut self, [left, top, right, bottom]: [i16; 4]) { - self.i16(top); - self.i16(left); - self.i16(bottom); - self.i16(right); - } - /// A zero up to the next even length: every version 2 opcode starts on a word. - fn align(&mut self) { - if self.0.len() % 2 == 1 { - self.0.push(0); - } - } -} - /// `v` rounded into 16 bits. fn i16_of(v: f64) -> i16 { v.round().clamp(-MAX_I16, MAX_I16) as i16 } struct Writer { - out: Out, + pic: PictWriter, /// Document space to device units. to_dev: Affine, /// Device units a point. @@ -139,49 +87,28 @@ struct Writer { cut: Rect, /// The frame in device units. frame: Rect, - fg: Option<[u8; 3]>, lost: Pict, } /// Write `ops` (no clips: [`crate::scene::Scene`] gives none for this format) as a PICT file of -/// `region` (corners in order, finite, with an area, within [`check_region`]). -pub(crate) fn write(ops: &[Op], region: Rect) -> Pict { +/// `region` (corners in order, finite, with an area). The picture frame is the region's size in +/// whole points, and the device frame is that times the device units a point, so a reader maps +/// one onto the other without scaling the drawing. A region [`check_region`] refuses is refused. +pub(crate) fn write(ops: &[Op], region: Rect) -> Result { + check_region(region)?; let size = |v: f64| (v.round()).clamp(1.0, MAX_I16) as i16; let (w, h) = (size(region.width()), size(region.height())); let k = units_per_point(f64::from(w), f64::from(h)); - let (dw, dh) = (w * k as i16, h * k as i16); + let units = k as i16; + let pic = PictWriter::new(w, h, units).ok_or("PICT pictures are at most 32,767 points on a side")?; let mut wr = Writer { - out: Out(vec![0; FILE_HEADER]), + pic, to_dev: Affine::scale(k) * Affine::translate(-region.origin().to_vec2()), k, cut: Rect::from_origin_size(region.origin(), (f64::from(w), f64::from(h))).inflate(1.0, 1.0), - frame: Rect::new(0.0, 0.0, f64::from(dw), f64::from(dh)), - fg: None, + frame: Rect::new(0.0, 0.0, f64::from(w) * k, f64::from(h) * k), lost: Pict::default(), }; - let o = &mut wr.out; - // picSize (its low 16 bits, set at the end) and the frame at 72 dpi. - o.u16(0); - o.rect([0, 0, w, h]); - o.u16(VERSION); - o.u16(0x02FF); - // The extended version 2 header: the device resolution and the frame in device units. - let dpi = ((72.0 * k) as u32) << 16; - o.u16(HEADER_OP); - o.i16(-2); - o.u16(0); - o.u32(dpi); - o.u32(dpi); - o.rect([0, 0, dw, dh]); - o.u32(0); - o.u16(CLIP); - o.u16(10); - o.rect([0, 0, dw, dh]); - // Shapes are painted with a solid pen in the foreground color. - o.u16(PN_MODE); - o.u16(PAT_COPY); - o.u16(PN_PAT); - o.bytes(&[0xFF; 8]); for op in ops { match op { Op::Fill { path, rule, rgb, .. } => wr.fill(path, *rule, *rgb), @@ -190,25 +117,10 @@ pub(crate) fn write(ops: &[Op], region: Rect) -> Pict { Op::Clip { .. } | Op::Unclip => {} } } - wr.out.align(); - wr.out.u16(OP_END_PIC); - let mut bytes = wr.out.0; - let len = (bytes.len() - FILE_HEADER) as u16; - bytes[FILE_HEADER..FILE_HEADER + 2].copy_from_slice(&len.to_be_bytes()); - Pict { bytes, ..wr.lost } + Ok(Pict { bytes: wr.pic.finish(), ..wr.lost }) } impl Writer { - fn color(&mut self, rgb: [u8; 3]) { - if self.fg != Some(rgb) { - self.out.u16(RGB_FG_COL); - for c in rgb { - self.out.u16(u16::from(c) * 257); - } - self.fg = Some(rgb); - } - } - /// `path` filled by `rule`, as polygons QuickDraw fills even-odd: cut to the frame (which also /// resolves a non-zero fill into figures that don't overlap) unless it is an even-odd fill /// inside the frame already. @@ -322,7 +234,6 @@ impl Writer { if figs.is_empty() { return; } - self.color(rgb); let mut group: Vec<&[[i16; 2]]> = vec![]; let mut points = 0; let thinned: Vec> = figs @@ -341,36 +252,20 @@ impl Writer { for fig in &thinned { if !group.is_empty() && points + fig.len() + 2 > MAX_POLY_POINTS { self.lost.split_fills = true; - self.poly(&group); + self.poly(rgb, &group); group.clear(); points = 0; } points += fig.len() + 2; group.push(fig); } - self.poly(&group); + self.poly(rgb, &group); } - /// One `PaintPoly` of `figs`: each figure back to its start, then the next; after the last, - /// back through the starts to the first. - fn poly(&mut self, figs: &[&[[i16; 2]]]) { - let mut pts: Vec<[i16; 2]> = Vec::with_capacity(figs.iter().map(|f| f.len() + 2).sum()); - for f in figs { - pts.extend_from_slice(f); - pts.push(f[0]); - } - pts.extend(figs.iter().rev().skip(1).map(|f| f[0])); - let (mut l, mut t, mut r, mut b) = (i16::MAX, i16::MAX, i16::MIN, i16::MIN); - for p in &pts { - (l, t, r, b) = (l.min(p[0]), t.min(p[1]), r.max(p[0]), b.max(p[1])); - } - self.out.u16(PAINT_POLY); - self.out.u16((10 + 4 * pts.len()) as u16); - self.out.rect([l, t, r, b]); - for p in &pts { - self.out.i16(p[1]); - self.out.i16(p[0]); - } + /// One polygon of `figs` in `rgb`. Each figure is counted above at two points more than + /// [`PictWriter::paint_poly`] adds for it, so every group fits one polygon and is written. + fn poly(&mut self, rgb: [u8; 3], figs: &[&[[i16; 2]]]) { + let _written = self.pic.paint_poly(rgb, figs); } /// An image placed by `xf`, over white. Mirrored and quarter-turned images keep their @@ -458,88 +353,13 @@ impl Writer { i16_of(edge(dst.y0, dst.y1, oh, ty1)), ]; if rect[2] > rect[0] && rect[3] > rect[1] { - let rows: Vec> = (ty..ty1).map(|y| (tx..tx1).map(|x| pixel(x, y)).collect()).collect(); - self.bits(&rows, tx1 - tx, ty1 - ty, rect); + let pixels: Vec<[u8; 3]> = (ty..ty1).flat_map(|y| (tx..tx1).map(move |x| (x, y))).map(|(x, y)| pixel(x, y)).collect(); + // Tiles are at most `TILE` pixels a side and `rect` has an area, so the + // pixel map is written. + let _written = self.pic.direct_bits(tx1 - tx, ty1 - ty, &pixels, rect); } } } self.lost.translucent_images |= translucent; } - - /// One `DirectBitsRect` of `rows` (`tw` × `th` pixels) into `dst` (left, top, right, bottom), - /// 32-bit pixels: rows of a red, a green and a blue plane, each row packed with PackBits; a - /// pixel map narrower than two pixels has unpacked rows of `0RGB` pixels. - fn bits(&mut self, rows: &[Vec<[u8; 3]>], tw: usize, th: usize, dst: [i16; 4]) { - let row_bytes = 4 * tw; - let o = &mut self.out; - o.align(); - o.u16(DIRECT_BITS_RECT); - o.u32(0xFF); - o.u16(row_bytes as u16 | 0x8000); - o.rect([0, 0, tw as i16, th as i16]); - // pmVersion, packType 4 (component planes), packSize, 72 dpi. - o.u16(0); - o.u16(4); - o.u32(0); - o.u32(72 << 16); - o.u32(72 << 16); - // RGBDirect, 32 bits a pixel, 3 components of 8 bits, no plane bytes, table or reserve. - o.u16(16); - o.u16(32); - o.u16(3); - o.u16(8); - o.u32(0); - o.u32(0); - o.u32(0); - o.rect([0, 0, tw as i16, th as i16]); - o.rect(dst); - // srcCopy. - o.u16(0); - let mut plane = Vec::with_capacity(3 * tw); - let mut packed = Vec::with_capacity(3 * tw + 3 * tw / 128 + 2); - for row in rows { - if row_bytes < 8 { - for p in row { - o.u8(0); - o.bytes(p); - } - continue; - } - plane.clear(); - for c in 0..3 { - plane.extend(row.iter().map(|p| p[c])); - } - packed.clear(); - packbits(&plane, &mut packed); - if row_bytes > 250 { - o.u16(packed.len() as u16); - } else { - o.u8(packed.len() as u8); - } - o.bytes(&packed); - } - o.align(); - } -} - -/// `src` packed with PackBits: runs of two to 128 equal bytes as a count byte `1 - n` and the -/// byte, other bytes in literal runs of up to 128 behind a count byte `n - 1`. -fn packbits(src: &[u8], out: &mut Vec) { - let run_at = |i: usize| src[i..].iter().take(128).take_while(|&&b| b == src[i]).count(); - let mut i = 0; - while i < src.len() { - let run = run_at(i); - if run >= 2 { - out.push((1 - run as i16) as u8); - out.push(src[i]); - i += run; - continue; - } - let start = i; - while i < src.len() && i - start < 128 && (i == start || run_at(i) < 3) { - i += 1; - } - out.push((i - start - 1) as u8); - out.extend_from_slice(&src[start..i]); - } } diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 6e4766a8af..2de5fc1591 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da"; +const REV: &str = "71dac21c25f4233b5ae1aeed5b8fec1c22bf2cd0"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 8ff9a8c9eb59501a8812c052d8ceacd3a4e61eb2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:05:39 -0800 Subject: [PATCH 044/115] Canvas: keep the moved anchor marks mesh only when every mark moves by whole pixels A move of whole pixels on screen did not guarantee that each mark's f32 screen position moved by whole pixels: `CanvasView::to_screen` casts to f32, so a point at x = 255.999991 lands at 255.99998 before a one-pixel move and at 257.0 after it, and its square rounds to other pixels than the moved mesh's. The move now checks every anchor and handle's f32 screen position before and after, and tessellates again when one does not move by the whole pixels. The same pass checks that every point stays inside the canvas, in place of the box of the points. --- crates/ui-egui/src/canvas/selection.rs | 43 +++++++++++--------- crates/ui-egui/src/canvas/selection/tests.rs | 37 +++++++++++++++++ 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index b6421c882b..6151e3affb 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -699,12 +699,12 @@ const PIXEL_SLACK: f64 = 1e-6; impl KeptMesh { /// Moves the mesh by `by` in the document when tessellating the moved marks would give the same mesh moved, and - /// returns whether it did. `was` is the box of the marks' points before the move ([`knots_box`]). The mesh moves - /// when the marks' whole move since they were tessellated is a whole number of physical pixels on screen, so the - /// tessellator's rounding to pixels lands the same, and when every point is inside the canvas the marks are drawn - /// near and inside the clip both before and after the move, so no anchor, handle or outline is left out or culled - /// on either side. - fn translate(&mut self, by: Vec2, was: Option) -> bool { + /// returns whether it did. `points` are the marks' anchors and direction handles before the move ([`knot_points`]). + /// The mesh moves when the marks' whole move since they were tessellated is a whole number of physical pixels on + /// screen, and when every point's `f32` screen position moves by this move's whole pixels too, so the tessellator's + /// rounding to pixels lands the same. It also needs every point inside the canvas before and after the move, so the + /// marks are drawn near and inside the clip on both sides and no anchor, handle or outline is left out or culled. + fn translate(&mut self, by: Vec2, points: impl IntoIterator) -> bool { let key = &self.key; let ppp = f64::from(key.pixels_per_point); let view = key.view.affine(); @@ -713,26 +713,31 @@ impl KeptMesh { if moved.iter().any(|p| !p.is_finite() || (p - p.round()).abs() > PIXEL_SLACK) { return false; } - if let Some(was) = was { - let area = key.rect.expand(key.look.reach).intersect(key.clip); - let inside = |r: vectorcraft_geom::Rect| { - [(r.x0, r.y0), (r.x1, r.y0), (r.x1, r.y1), (r.x0, r.y1)].into_iter().all(|(x, y)| area.contains(key.view.to_screen(Point::new(x, y)))) - }; - if !(inside(was) && inside(was + by)) { + // This move in whole physical pixels. + let pixels = [moved[0].round() - self.moved[0].round(), moved[1].round() - self.moved[1].round()]; + let area = key.rect.expand(key.look.reach).intersect(key.clip); + // `CanvasView::to_screen` with the affine computed once. + let screen = |p: Point| { + let s = view * p; + egui::pos2(s.x as f32, s.y as f32) + }; + let whole = |from: f32, to: f32, px: f64| ((f64::from(to) - f64::from(from)) * ppp - px).abs() <= PIXEL_SLACK; + for p in points { + let (from, to) = (screen(p), screen(p + by)); + if !(area.contains(from) && area.contains(to) && whole(from.x, to.x, pixels[0]) && whole(from.y, to.y, pixels[1])) { return false; } } - let step = |axis: usize| ((moved[axis].round() - self.moved[axis].round()) / ppp) as f32; - let offset = vec2(step(0), step(1)); + let offset = vec2((pixels[0] / ppp) as f32, (pixels[1] / ppp) as f32); self.moved = moved; Arc::make_mut(&mut self.mesh).translate(offset); true } } -/// The box of every anchor and direction handle of `anchors`, in document units, or `None` without any. The outlines -/// lie inside it too, as a curve lies inside the hull of its points. -fn knots_box(anchors: &Anchors) -> Option { +/// Every anchor and direction handle of `anchors`, in document units. The outlines lie inside the hull of these +/// points, as a curve lies inside the hull of its points. +fn knot_points(anchors: &Anchors) -> impl Iterator + '_ { anchors .paths .iter() @@ -740,7 +745,6 @@ fn knots_box(anchors: &Anchors) -> Option { .flat_map(|p| &p.subpaths) .flat_map(|sp| &sp.knots) .flat_map(|knot| [knot.anchor, knot.in_ctrl, knot.out_ctrl]) - .fold(None, |r: Option, p| Some(r.map_or(vectorcraft_geom::Rect::from_points(p, p), |r| r.union_pt(p)))) } /// One set of anchors as `BezierOverlay` took it: the paths, which anchors are selected and how they show. @@ -1263,9 +1267,8 @@ impl SelectionMarks { /// Moves every mark by `by`, and the kept mesh of the anchor marks with them when it can move as it is /// ([`KeptMesh::translate`]); otherwise the next paint tessellates the marks again. fn translate(&mut self, by: Vec2) { - let was = knots_box(&self.anchors); let mesh = self.mesh.get_mut(); - if mesh.as_mut().is_some_and(|kept| !kept.translate(by, was)) { + if mesh.as_mut().is_some_and(|kept| !kept.translate(by, knot_points(&self.anchors))) { *mesh = None; } let shift = vectorcraft_geom::Affine::translate(by); diff --git a/crates/ui-egui/src/canvas/selection/tests.rs b/crates/ui-egui/src/canvas/selection/tests.rs index f23e4087aa..3b979256c5 100644 --- a/crates/ui-egui/src/canvas/selection/tests.rs +++ b/crates/ui-egui/src/canvas/selection/tests.rs @@ -1360,3 +1360,40 @@ fn a_drag_of_the_selection_moves_the_anchor_marks_mesh_without_tessellating_it() assert_eq!(frames(&mut app, 2), 1, "a step past the canvas's edge"); app.session.commit_interaction().unwrap(); } + +// A move of whole pixels keeps the mesh only when every point's `f32` screen position moves by those whole pixels: +// at x = 255.999991 the screen position before a one-pixel move is 255.99998 and after it 257.0, so the marks' +// squares would round to other pixels than the moved mesh's. +#[test] +fn a_whole_pixel_move_keeps_the_mesh_only_when_the_screen_positions_move_by_whole_pixels() { + let screen = Rect::from_min_size(egui::pos2(0.0, 0.0), vec2(1000.0, 1000.0)); + let look = MarkLook { + line: Color32::BLACK, + fill: Color32::WHITE, + edge: Color32::BLACK, + anchor: 5.0, + large: 7.0, + thin: 1.0, + medium: 2.0, + thick: 3.0, + reach: 20.0, + }; + let kept = || KeptMesh { + key: MeshKey { + marks: 0, + view: CanvasView::new(screen, Point::new(500.0, 500.0), 1.0), + rect: screen, + clip: screen, + pixels_per_point: 1.0, + options: egui::epaint::TessellationOptions::default(), + look, + }, + mesh: Arc::new(egui::Mesh::default()), + moved: [0.0; 2], + }; + let by = Vec2::new(1.0, 0.0); + assert!(kept().translate(by, [Point::new(255.5, 10.0)]), "a point whose screen position moves one whole pixel"); + let mut off = kept(); + assert!(!off.translate(by, [Point::new(255.5, 10.0), Point::new(255.999_991, 10.0)]), "a point that moves 1.0000153 pixels"); + assert_eq!(off.moved, [0.0; 2], "the refused move leaves the mesh where it was"); +} From 3493a12c0056af2919a3c5c44965e72872dbfbdb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:05:49 -0800 Subject: [PATCH 045/115] 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 1bc0c5ba7825048b93195848a9ee02904cf6ec6c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:06:12 -0800 Subject: [PATCH 046/115] CI: analyze main in SonarCloud only at the nightly's commit SonarCloud ran a full instrumented analysis for every merge commit on main (about 90 a day, 97 to 191 minutes each). Stage 2 only reads the analysis of the commit the nightly builds, so main is now analyzed once a day: - sonarcloud.yml drops the push trigger and starts when the unsigned nightly starts (workflow_run, requested). A first job fails the run when main has moved past the nightly's commit, so the analysis is never of another commit. Pull request analysis is unchanged. - nightly-dispatch.yml waits, for up to 280 minutes, for the SonarCloud check on the producer's commit to complete before it dispatches the signer. A SonarCloud run that ended without a check stops the wait after 20 minutes. The job gains checks: read and a 300-minute timeout. - packaging/nightly-release-tests.py runs the dispatch script against a fake API: it dispatches only after the check completes, and refuses when the SonarCloud run ended without one or when the deadline passes. - docs/nightly-release-preparation.md describes both workflows. --- .github/workflows/nightly-dispatch.yml | 66 ++++++++++++++---- .github/workflows/sonarcloud.yml | 32 ++++++++- docs/nightly-release-preparation.md | 16 +++-- packaging/nightly-release-tests.py | 92 ++++++++++++++++++++++++++ 4 files changed, 186 insertions(+), 20 deletions(-) diff --git a/.github/workflows/nightly-dispatch.yml b/.github/workflows/nightly-dispatch.yml index 4ef372c40b..4581f75d39 100644 --- a/.github/workflows/nightly-dispatch.yml +++ b/.github/workflows/nightly-dispatch.yml @@ -16,9 +16,11 @@ jobs: github.repository == 'storytold/vectorcraft' && github.event_name == 'workflow_run' runs-on: ubuntu-latest - timeout-minutes: 5 + # Most of the time is the wait for the producer commit's SonarCloud analysis (up to 280 minutes). + timeout-minutes: 300 permissions: actions: write + checks: read steps: - name: Dispatch only the exact completed producer run and attempt shell: python @@ -27,6 +29,10 @@ jobs: run: | import json import os + import re + import time + import urllib.error + import urllib.parse import urllib.request def require(value, message): @@ -51,22 +57,58 @@ jobs: run_id, attempt = producer.get('id'), producer.get('run_attempt') require(type(run_id) is int and run_id > 0, 'invalid producer run id') require(type(attempt) is int and attempt == 1, 'invalid automatic producer attempt') + source = producer.get('head_sha') + require(isinstance(source, str) and re.fullmatch(r'[0-9a-f]{40}', source), 'invalid producer commit') + headers = { + 'Authorization': 'Bearer ' + os.environ['GH_TOKEN'], + 'Accept': 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28', + 'User-Agent': 'vectorcraft-nightly-dispatch' + } + class NoRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + raise RuntimeError('dispatch redirects are forbidden') + opener = urllib.request.build_opener(NoRedirect()) + + def read(path): + request = urllib.request.Request('https://api.github.com/repos/storytold/vectorcraft' + path, headers=headers) + with opener.open(request, timeout=20) as response: + require(response.status == 200, 'read was not accepted') + return json.load(response) + + # Stage 2 admits the producer only on its commit's own SonarCloud analysis, which + # sonarcloud.yml starts when the producer starts. Wait for the check that analysis posts; + # a SonarCloud run that ended without one gets 20 minutes before the wait gives up. + checks_path = '/commits/' + source + '/check-runs?' + urllib.parse.urlencode( + {'app_id': 12526, 'check_name': 'SonarCloud Code Analysis', 'filter': 'latest'}) + runs_path = '/actions/workflows/sonarcloud.yml/runs?' + urllib.parse.urlencode( + {'event': 'workflow_run', 'head_sha': source, 'per_page': 1}) + deadline = time.monotonic() + 280 * 60 + ended = None + while True: + try: + checks = read(checks_path).get('check_runs', []) + if any(c.get('head_sha') == source and c.get('status') == 'completed' for c in checks): + break + runs = read(runs_path).get('workflow_runs', []) + if runs and runs[0].get('status') == 'completed' and ended is None: + ended = time.monotonic() + print('SonarCloud run', runs[0].get('id'), 'ended:', runs[0].get('conclusion')) + except (urllib.error.URLError, OSError, ValueError) as error: + print('Read failed, polling again:', error) + require(ended is None or time.monotonic() < ended + 20 * 60, + 'the SonarCloud run for the producer commit ended without an analysis check') + require(time.monotonic() < deadline, 'no SonarCloud analysis of the producer commit in time') + time.sleep(60) + print('SonarCloud analysis check of', source, 'is complete.') + body = json.dumps({'ref': 'refs/heads/nightly-signer', 'inputs': { 'producer_run_id': str(run_id), 'producer_run_attempt': str(attempt) }}).encode('utf-8') request = urllib.request.Request( 'https://api.github.com/repos/storytold/vectorcraft/actions/workflows/nightly-sign.yml/dispatches', - data=body, method='POST', headers={ - 'Authorization': 'Bearer ' + os.environ['GH_TOKEN'], - 'Accept': 'application/vnd.github+json', - 'Content-Type': 'application/json', - 'X-GitHub-Api-Version': '2022-11-28', - 'User-Agent': 'vectorcraft-nightly-dispatch' - }) - class NoRedirect(urllib.request.HTTPRedirectHandler): - def redirect_request(self, req, fp, code, msg, headers, newurl): - raise RuntimeError('dispatch redirects are forbidden') + data=body, method='POST', headers=dict(headers, **{'Content-Type': 'application/json'})) # One bounded request, no retry: duplicate transport is not publication authority. - with urllib.request.build_opener(NoRedirect()).open(request, timeout=20) as response: + with opener.open(request, timeout=20) as response: require(response.status == 204, 'dispatch was not accepted') print('Dispatched producer run/attempt to the release-ref validator; not a signing result.') diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 98e9c1d00a..312ab1cbda 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,8 +1,12 @@ name: SonarCloud +# Main is analyzed once a day, at the commit the nightly builds: Stage 2 admits a nightly only on +# that commit's own analysis, and nightly-dispatch.yml waits for it before dispatching the signer. on: workflow_dispatch: - push: + workflow_run: + workflows: [VectorCraft unsigned nightly] + types: [requested] branches: [main] pull_request: types: [opened, synchronize, reopened] @@ -12,11 +16,35 @@ permissions: concurrency: group: ${{ github.ref == 'refs/heads/main' && format('sonarcloud-main-{0}', github.sha) || format('sonarcloud-{0}', github.ref) }} - # A push to main is the run that publishes coverage; superseded runs there would never finish. + # A main run is the analysis a nightly waits for; superseded runs there would never finish. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: + nightly-commit: + name: Nightly commit is main's head + # A workflow_run checks out and analyzes main's head, so main must not have moved since the + # nightly started. + if: github.event_name == 'workflow_run' + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - name: Require main's head to be the nightly's commit + env: + NIGHTLY_SHA: ${{ github.event.workflow_run.head_sha }} + RUN_SHA: ${{ github.sha }} + run: | + if [ "$NIGHTLY_SHA" != "$RUN_SHA" ]; then + echo "::error::main moved from $NIGHTLY_SHA to $RUN_SHA after the nightly started; this run would not analyze the nightly's commit" + exit 1 + fi + sonarcloud: + needs: nightly-commit + if: ${{ !cancelled() && contains(fromJSON('["success","skipped"]'), needs.nightly-commit.result) }} # Tracked at @main so org-wide CI improvements propagate without PR churn. # The reusable workflow defaults build-jobs to 2 so a cold instrumented # archive stays within hosted-runner memory (craft-common-actions#333). diff --git a/docs/nightly-release-preparation.md b/docs/nightly-release-preparation.md index 29ca838f1d..1074e90299 100644 --- a/docs/nightly-release-preparation.md +++ b/docs/nightly-release-preparation.md @@ -79,7 +79,7 @@ Read on 2026-11-24; re-read anything that may have moved before `nightly-signer` | `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist | | `platforms` | three rows | Learning Machines stable identities (Windows Authenticode publisher subject, Linux OpenPGP fingerprint, Apple Developer ID team `DJ6XS33FX8`) | | `candidate_policy.required_workflows` | CI (`ci.yml`, workflow `380135806`), 9 jobs | Workflow list API; jobs that succeeded on recent main push runs | -| `candidate_policy.sonar` | `storytold` / `storytold_vectorcraft`, app `12526` | `sonar-project.properties`; the SonarCloud check on main commits | +| `candidate_policy.sonar` | `storytold` / `storytold_vectorcraft`, app `12526` | `sonar-project.properties`; the SonarCloud check on the nightly's commit | The signer reads the policy from `nightly-signer`, so a candidate whose CI built the tests once (`build`, `lint` and `test 1/5` to `test 5/5`) is admitted only after `nightly-signer` advances to @@ -97,9 +97,12 @@ a main commit with this policy. Candidates whose CI ran six shards (`cache warm` from stable, cancellation is off and `queue: max` must be hosted-qualified. The caller itself passes no credentials; only the shared callee's sign jobs bind the `release` environment, which must admit `nightly-signer` alongside `release` before the first dispatch. -- `.github/workflows/nightly-dispatch.yml`: transport only, never authorization. It is literally - off (`false &&`) and forwards only a first-attempt scheduled producer to `nightly-sign.yml` on - `nightly-signer`. No schedule is registered until activation is reviewed. +- `.github/workflows/nightly-dispatch.yml`: transport only, never authorization. It forwards only + a first-attempt scheduled producer to `nightly-sign.yml` on `nightly-signer`, after the + SonarCloud check on the producer's commit has completed. +- `.github/workflows/sonarcloud.yml`: analyzes main only at the commit a nightly builds. It starts + when the producer starts and fails when main has moved past the producer's commit. Pull requests + are analyzed on every push as before. - Shared reusable entrypoints are `nightly-unsigned.yml` and `nightly-release.yml` in `storytold/craft-common-actions`. Both must resolve to a **real reviewed public immutable commit**; the defining workflow SHA and tooling input must match. @@ -117,8 +120,9 @@ a main commit with this policy. Candidates whose CI ran six shards (`cache warm` - A trust-closure scan reads every workflow: nothing binds an `environment`, only `nightly-sign.yml` calls `nightly-release.yml` (at a full SHA), and the only caller of the shared stable `release.yml` is `release.yml`. -- `nightly-dispatch.yml` keeps a literal-off guard, a `workflow_run`-only trigger and a - `refs/heads/nightly-signer` request. +- `nightly-dispatch.yml` keeps its exact context guard, a `workflow_run`-only trigger and a + `refs/heads/nightly-signer` request, and sends that request only after the SonarCloud check on + the producer's commit has completed. ## The app side of a Nightly build diff --git a/packaging/nightly-release-tests.py b/packaging/nightly-release-tests.py index 2729b40282..ef1003f46e 100755 --- a/packaging/nightly-release-tests.py +++ b/packaging/nightly-release-tests.py @@ -2,10 +2,15 @@ """Local regression checks for VectorCraft nightly workflow and signing-policy contracts.""" import copy from decimal import Decimal +import io import json +import os from pathlib import Path import re +import tempfile +import textwrap import unittest +from unittest import mock ROOT = Path(__file__).resolve().parents[1] INSTALLED_POLICY = ROOT / ".github/nightly-signing-policy.json" @@ -907,5 +912,92 @@ class NightlyDispatchTransport(unittest.TestCase): self.assertIn("repos/storytold/" + APP_NAME + "/actions/workflows/nightly-sign.yml/dispatches", self.source) self.assertNotIn("'ref': 'release'", self.source) + +SONAR_SOURCE = "c" * 40 + + +def dispatch_script(): + """The dispatch job's inline Python, as the runner's `shell: python` step receives it.""" + source = (ROOT / ".github/workflows/nightly-dispatch.yml").read_text() + block = source.split(" run: |\n", 1)[1] + return textwrap.dedent(block) + + +class FakeGitHub: + """Answers the dispatch script's API reads from scripted poll results and records every request.""" + + def __init__(self, polls, run=None): + self.polls = list(polls) + self.run = run + self.requests = [] + self.now = 0.0 + + def open(self, request, timeout): + self.requests.append((request.get_method(), request.full_url)) + if request.get_method() == "POST": + payload = b"" + status = 204 + elif "/check-runs?" in request.full_url: + done = self.polls.pop(0) if self.polls else False + rows = [{"head_sha": SONAR_SOURCE, "status": "completed" if done else "in_progress"}] + payload, status = json.dumps({"check_runs": rows}).encode(), 200 + else: + runs = [self.run] if self.run else [] + payload, status = json.dumps({"workflow_runs": runs}).encode(), 200 + response = io.BytesIO(payload) + response.status = status + return response + + def sleep(self, seconds): + self.now += seconds + + +def run_dispatch(github): + producer = {"head_repository": {"full_name": "storytold/vectorcraft"}, "path": ".github/workflows/nightly.yml", + "head_branch": "main", "status": "completed", "conclusion": "success", "event": "schedule", + "id": 7, "run_attempt": 1, "head_sha": SONAR_SOURCE} + event = {"action": "completed", "repository": {"full_name": "storytold/vectorcraft"}, "workflow_run": producer} + with tempfile.TemporaryDirectory() as folder: + path = Path(folder) / "event.json" + path.write_text(json.dumps(event)) + env = {"GITHUB_REPOSITORY": "storytold/vectorcraft", "GITHUB_EVENT_NAME": "workflow_run", + "GITHUB_EVENT_PATH": str(path), "GH_TOKEN": "token"} + with mock.patch.dict(os.environ, env), \ + mock.patch("urllib.request.build_opener", return_value=github), \ + mock.patch("time.monotonic", side_effect=lambda: github.now), \ + mock.patch("time.sleep", side_effect=github.sleep), \ + mock.patch("builtins.print"): + exec(compile(dispatch_script(), "nightly-dispatch.yml", "exec"), {}) + + +class NightlyDispatchWaitsForSonar(unittest.TestCase): + """The signer is dispatched only after the producer commit's SonarCloud check completes.""" + + def posts(self, github): + return [url for method, url in github.requests if method == "POST"] + + def test_dispatch_waits_for_the_completed_check_of_the_producer_commit(self): + github = FakeGitHub([False, False, True]) + run_dispatch(github) + checks = [url for method, url in github.requests if "/check-runs?" in url] + self.assertEqual(len(checks), 3) + self.assertTrue(all("/commits/" + SONAR_SOURCE + "/" in url and "app_id=12526" in url for url in checks)) + self.assertEqual(len(self.posts(github)), 1) + self.assertEqual(github.requests[-1][0], "POST", "the dispatch comes after the last check read") + + def test_a_sonar_run_that_ended_without_a_check_stops_the_dispatch(self): + github = FakeGitHub([], run={"id": 9, "status": "completed", "conclusion": "failure"}) + with self.assertRaisesRegex(RuntimeError, "ended without an analysis check"): + run_dispatch(github) + self.assertEqual(self.posts(github), []) + self.assertLessEqual(github.now, 21 * 60, "a finished run does not wait for the whole deadline") + + def test_no_analysis_by_the_deadline_stops_the_dispatch(self): + github = FakeGitHub([]) + with self.assertRaisesRegex(RuntimeError, "in time"): + run_dispatch(github) + self.assertEqual(self.posts(github), []) + + if __name__ == "__main__": unittest.main(verbosity=2) From cf429ac1d85dbe65adcc119546f9478fbddea226 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:48:58 -0800 Subject: [PATCH 047/115] Locale: a text resolution uses one digit set, exponent included MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `document.rasterEffectsSettings` read `"१e2"` and `"१e+2"` as 100 ppi: `ascii_digits` treats `e` and `+` as the end of a number, so each side could use its own digit set. The resolution now goes through `vectorcraft_doc::ascii_digits_one_number`, which requires one digit set for the whole value. `"१e२"` still reads as 100, and `"1e२"`, `"१e2"` and `"१e+2"` are refused. --- crates/doc/src/lib.rs | 2 +- crates/doc/src/units.rs | 6 ++++++ crates/engine/src/cmd/rasterfx.rs | 5 +++-- crates/engine/src/tests/rastersettings.rs | 6 ++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index ebc2088245..276f298ffe 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -179,7 +179,7 @@ use limits::MAX_NEXT_ID; pub use limits::{DocError, FORMAT_VERSION, MAX_COORD}; pub use records::{ImageBlob, MaskEdit, NewArtIds, SavedSelection, SavedView, SvgFilter, Symbol, SymbolEdit}; pub use stored_art::{StoredPlace, StoredRoot}; -pub use units::{ColorMode, Unit, arithmetic_signs, ascii_digits, decimal_point, finite_in_every_unit, parse_number}; +pub use units::{ColorMode, Unit, arithmetic_signs, ascii_digits, ascii_digits_one_number, decimal_point, finite_in_every_unit, parse_number}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Document { diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index cc4ab253de..1ef44c0413 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -436,6 +436,12 @@ pub fn ascii_digits(text: &str) -> Option> { craft_i18n::ascii_digits(text, |c| matches!(c, '.' | ',')).ok() } +/// [`ascii_digits`] for text that holds a single number, exponent and unit included: every digit +/// must come from one set, so `१e२` is `1e2` and `१e2` is `None`. +pub fn ascii_digits_one_number(text: &str) -> Option> { + craft_i18n::ascii_digits(text, |_| true).ok() +} + /// Does the operand contain a thousands comma? Check both parts of a compact pica value and /// read a percentage's number without its percent sign. fn thousands_operand(operand: &str) -> bool { diff --git a/crates/engine/src/cmd/rasterfx.rs b/crates/engine/src/cmd/rasterfx.rs index b567c0f3a0..1447532743 100644 --- a/crates/engine/src/cmd/rasterfx.rs +++ b/crates/engine/src/cmd/rasterfx.rs @@ -71,8 +71,9 @@ fn resolution(v: &Value) -> Result { "screen" => 72.0, "medium" => 150.0, "high" => 300.0, - // Digits of other scripts read as ASCII digits do (`"३००"` is 300), as number fields read them. - other => vectorcraft_doc::ascii_digits(other.trim_end_matches("ppi").trim()) + // Digits of other scripts read as ASCII digits do (`"३००"` is 300), as number fields read them, + // with one digit set for the whole value, exponent included (`"१e2"` is refused). + other => vectorcraft_doc::ascii_digits_one_number(other.trim_end_matches("ppi").trim()) .and_then(|n| n.parse::().ok()) .ok_or_else(|| bad(C, format!("unknown resolution `{v}`")))?, }, diff --git a/crates/engine/src/tests/rastersettings.rs b/crates/engine/src/tests/rastersettings.rs index fd88793cc9..d918113114 100644 --- a/crates/engine/src/tests/rastersettings.rs +++ b/crates/engine/src/tests/rastersettings.rs @@ -97,11 +97,13 @@ fn a_resolution_given_as_text_reads_digits_of_other_scripts() { let r = s.execute(C, &json!({"resolution": "३०० ppi"})).unwrap(); assert_eq!(r["resolution"].as_f64(), Some(300.0)); assert_eq!(s.doc().unwrap().doc.raster_effects_ppi, 300.0); - // One digit set per number, and the same 1 to 2400 ppi range as ASCII digits. - for bad in ["1५0", "५०००"] { + // One digit set per number, exponent included, and the same 1 to 2400 ppi range as ASCII digits. + for bad in ["1५0", "५०००", "१e2", "1e२", "१e+2"] { assert!(s.execute(C, &json!({"resolution": bad})).is_err(), "{bad}"); } assert_eq!(s.doc().unwrap().history.undo.len(), 1); + let r = s.execute(C, &json!({"resolution": "१e२"})).unwrap(); + assert_eq!(r["resolution"].as_f64(), Some(100.0)); } #[test] From a1e9779fba1212894cd9b518bd026aac1a33c91c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:59:53 -0800 Subject: [PATCH 048/115] Save: a file comparison waits for a drag in another document and wakes after a dialog closes A save whose file comparison answered made its document active even while a drag went on in the active document, and the switch canceled the drag. The save now waits until the drag ends (no interaction and no held press in the active document), as it already waited for another document's dialog or file picker. A save that waited for a dialog went on only at the next input after the dialog closed, because the dialogs close in the UI pass, after the save pump has run. The pass that closes the dialog, or ends the drag, now asks for one more frame, and no frames are asked for while the save waits. --- crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/io/save.rs | 40 ++++++++++++++---- crates/ui-egui/src/tests/save.rs | 71 ++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index b769dac802..f2ca6fae4d 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -777,6 +777,7 @@ impl VectorcraftApp { self.handle_input(&ctx); self.ui_frame(ui); self.window_keys(&ctx); + io::save::after_ui(self, &ctx); // What the canvas, a panel, a dialog or a window key changed in this pass reaches // the plug-ins that react to it now, since an idle app draws no further frame; a // line a handler wrote shows in the next one. The handlers' time counts toward the diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs index 1fb7d89d3a..f373ed900b 100644 --- a/crates/ui-egui/src/io/save.rs +++ b/crates/ui-egui/src/io/save.rs @@ -71,6 +71,10 @@ pub(crate) struct Saves { /// The saves waiting for a comparison of their document's file with those bytes. #[cfg(not(target_arch = "wasm32"))] checks: HashMap, + /// A comparison's save waited in the last pass for a dialog, a file picker or a gesture in + /// another document: [`after_ui`] asks for a frame once it no longer has to. + #[cfg(not(target_arch = "wasm32"))] + held: bool, /// The files written beside each document's file, which its next save replaces. pub(crate) written_beside: HashMap>, /// The files the OK of the replace question allows the save it runs again to replace. @@ -89,6 +93,8 @@ impl Saves { contents: super::saved_contents::SavedContents::new(), #[cfg(not(target_arch = "wasm32"))] checks: HashMap::new(), + #[cfg(not(target_arch = "wasm32"))] + held: false, watch: FileWatch::new(wake), written_beside: HashMap::new(), replace_files_ok: Vec::new(), @@ -158,17 +164,34 @@ impl Saves { /// Whether file comparisons need another frame to collect their answers. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn checks_pending(app: &VectorcraftApp) -> bool { - // A save waiting for a dialog goes on in the frame that closes the dialog. - app.saves.checks.keys().any(|uid| !under_dialog(app, *uid)) + // A save waiting for a dialog or a gesture goes on in the frame after the one that ends it ([`after_ui`]). + app.saves.checks.keys().any(|uid| !held(app, *uid)) } -/// Whether a dialog or file picker of a document other than `uid` is open: writing document -/// `uid`'s save would activate it under the dialog. +/// Whether document `uid`'s save has to wait: writing it activates its document, which would +/// put it under an open dialog or file picker of another document, or cancel a drag in progress +/// in the active one. #[cfg(not(target_arch = "wasm32"))] -fn under_dialog(app: &VectorcraftApp, uid: u64) -> bool { - app.session.active().map(|d| d.uid) != Some(uid) && (app.any_dialog_open() || app.file_dialog_open()) +fn held(app: &VectorcraftApp, uid: u64) -> bool { + let active = app.session.active(); + active.map(|d| d.uid) != Some(uid) + && (app.any_dialog_open() || app.file_dialog_open() || active.is_some_and(|d| d.interaction.is_some()) || app.canvas.grab.is_some()) } +/// Asks for one frame when a save waited in the last pass and this pass's UI closed what it +/// waited for: the dialog pumps and the canvas run after [`pump`], so nothing else would. +#[cfg(not(target_arch = "wasm32"))] +pub(crate) fn after_ui(app: &mut VectorcraftApp, ctx: &egui::Context) { + if app.saves.held && app.saves.checks.keys().any(|uid| !held(app, *uid)) { + app.saves.held = false; + ctx.request_repaint(); + } +} + +/// The web has no saves that wait. +#[cfg(target_arch = "wasm32")] +pub(crate) fn after_ui(_: &mut VectorcraftApp, _: &egui::Context) {} + /// The web has no file comparisons to collect. #[cfg(target_arch = "wasm32")] pub(crate) fn checks_pending(_: &VectorcraftApp) -> bool { @@ -258,8 +281,9 @@ fn resume_checked(app: &mut VectorcraftApp, wait: bool) { continue; }; // Writing activates the save's document: while a dialog or file picker of another document - // is open, the answer stays in its channel for a later pass. - if !wait && under_dialog(app, uid) { + // is open, or a drag goes on in it, the answer stays in its channel for a later pass. + if !wait && held(app, uid) { + app.saves.held = true; continue; } let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index d6c1d0b34d..912626e647 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -725,3 +725,74 @@ fn a_comparison_waits_while_a_dialog_is_open_over_another_document() { assert!(unwritten, "nothing is written while the dialog is open"); assert!(written, "the save finishes once the dialog closes"); } + +/// A context whose first frames have run, so it asks for no more frames of its own. +fn settled() -> egui::Context { + let ctx = egui::Context::default(); + for _ in 0..10 { + if !ctx.has_requested_repaint() { + break; + } + ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear(); + } + assert!(!ctx.has_requested_repaint(), "the context settled"); + ctx +} + +/// A save that waited for a dialog asks for a frame in the pass whose UI closes the dialog, since +/// its pump ran earlier in that pass and an idle app draws no other frame. +#[test] +fn a_comparison_held_by_a_dialog_asks_for_a_frame_once_the_dialog_closes() { + let (d, _path, mut app) = opened_then_put_back("compare-wake", true); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + let prompt = craft::ui::dialog::StandardPrompt::changed_on_disk("other"); + app.dialogs().unwrap().with(|h| h.open(prompt)); + io::save::wait_for_answers(&mut app); + io::save::pump(&mut app, &egui::Context::default()); + let open = settled(); + io::save::after_ui(&mut app, &open); + let while_open = open.has_requested_repaint(); + // The dialog's own pump, which runs after the save's, takes its answer. + let id = open_dialogs(&app).pop().map(|d| d.id).expect("a dialog is open"); + let window = app.ui_ctx.clone().expect("a window context"); + app.dialogs().unwrap().with(|h| { + assert!(h.cancel_by_id(&window, id)); + let _ = h.take_by_id::(id); + }); + let closed = settled(); + io::save::after_ui(&mut app, &closed); + let after_close = closed.has_requested_repaint(); + io::save::wait_for_checks(&mut app); + crate::background::wait_all(&mut app); + let _ = std::fs::remove_dir_all(d); + assert!(!while_open, "no frame is asked for while the dialog is open"); + assert!(after_close, "a frame is asked for once the dialog has closed"); +} + +/// A comparison that answers while a drag goes on in another document waits for the drag to end, +/// so making the save's document active does not cancel the drag. +#[test] +fn a_comparison_waits_while_a_drag_goes_on_in_another_document() { + let (d, path, mut app) = opened_then_put_back("compare-under-drag", true); + let before = std::fs::read(&path).unwrap(); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.begin_interaction("drag").unwrap(); + io::save::wait_for_answers(&mut app); + let ctx = egui::Context::default(); + io::save::pump(&mut app, &ctx); + let active = app.session.active_index(); + let dragging = app.session.active().is_some_and(|d| d.interaction.is_some()); + let unwritten = std::fs::read(&path).unwrap() == before; + // Once the drag ends, the save goes on and writes the file. + app.session.commit_interaction().unwrap(); + io::save::pump(&mut app, &ctx); + crate::background::wait_all(&mut app); + let written = std::fs::read(&path).unwrap() != before; + let _ = std::fs::remove_dir_all(d); + assert_eq!(active, Some(1), "the document with the drag stays active"); + assert!(dragging, "the drag is not canceled"); + assert!(unwritten, "nothing is written while the drag goes on"); + assert!(written, "the save finishes once the drag ends"); +} From d4e73489ef13f27aff14cfd7f39e171d3006fd0e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 09:07:54 -0800 Subject: [PATCH 049/115] Dependencies: craft-libs pin to main, with the opacity and edit-target workarounds removed Every craft-libs rev moves from 4f3e34d0dd, the head of craft-libs#5489, to craft-libs main. The egui and winit revs are the ones that craft-libs rev pins, unchanged. - Opacity fields (Control bar, Color Wheel, Gradient) show the stored fraction times 100 again. craft-libs#5466 makes the number field step on from a value such as 50.999999 %, so panels::shown_percent is removed. - The Blend Options Ramp and Shift sliders, the Image Trace rows and the Divider field use SliderField::edit_target (craft-libs#5024) in place of the id-salt workarounds. A value typed for one object and not yet committed is still dropped when another is selected. - CDR import: craft-libs now reads bitmaps as their own object kind. They are not placed; the warnings name them with the other objects not read, and a PowerClip frame that clips only a bitmap is named as a frame that opened empty. --- Cargo.lock | 182 +++++++++--------- Cargo.toml | 82 ++++---- apps/vectorcraft-web/Cargo.toml | 2 +- crates/engine/src/cmd/fileio/cdr.rs | 6 +- crates/engine/src/cmd/fileio/cdr/shapes.rs | 4 + crates/engine/src/cmd/fileio/tests_cdr.rs | 39 +++- crates/ui-egui/src/chrome/control_bar.rs | 2 +- crates/ui-egui/src/panels.rs | 9 - crates/ui-egui/src/panels/blend.rs | 84 +------- crates/ui-egui/src/panels/color_wheel.rs | 2 +- crates/ui-egui/src/panels/gradient.rs | 2 +- crates/ui-egui/src/panels/image_trace.rs | 5 +- crates/ui-egui/src/panels/image_trace/rows.rs | 4 +- xtask/src/pdf_deps.rs | 2 +- 14 files changed, 187 insertions(+), 238 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb23758ef6..522005f52c 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "egui", ] @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "rayon", ] @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "serde", ] @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "gif", ] @@ -1681,7 +1681,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "flate2", ] @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "winsafe", ] @@ -2470,7 +2470,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" 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=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 73e26d5375..f6b9cc431c 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 62605759eb..45c7aad7ed 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/engine/src/cmd/fileio/cdr.rs b/crates/engine/src/cmd/fileio/cdr.rs index 04aef3563a..3633d06553 100644 --- a/crates/engine/src/cmd/fileio/cdr.rs +++ b/crates/engine/src/cmd/fileio/cdr.rs @@ -112,7 +112,9 @@ pub(super) fn import(bytes: &[u8]) -> Result<(Document, Vec)> { why => err(format!("this CDR drawing can't be read ({why})")), })?; let (doc, mut warnings) = build(&d, note, PAGES_CUT); - if d.version >= FRAMES_FROM && d.warnings.iter().any(|w| matches!(w, Warning::UnsupportedObjects | Warning::TooDeep)) { + // Objects the reader or the mapping left out (bitmaps are read but not placed), or content past the reader's limits. + let left_out = warnings.iter().any(|w| w == UNSUPPORTED_OBJECTS) || d.warnings.contains(&Warning::TooDeep); + if d.version >= FRAMES_FROM && left_out { warnings.push(EMPTY_FRAMES.to_string()); } Ok((doc, warnings)) @@ -423,6 +425,8 @@ fn copy_cost(objects: &[cd::Object]) -> usize { match o { cd::Object::Group { objects: kids, .. } => stack.extend(kids), cd::Object::Shape(s) => n = n.saturating_add(shape_cost(s)), + // A bitmap is not placed, so it takes nothing past the object itself. + cd::Object::Image(_) => {} cd::Object::Clip { container, objects } => { // A container whose outline is behind its fill is built twice, as that outline // and as the clipping path, inside a group of their own. diff --git a/crates/engine/src/cmd/fileio/cdr/shapes.rs b/crates/engine/src/cmd/fileio/cdr/shapes.rs index 320fda877c..127f97d87c 100644 --- a/crates/engine/src/cmd/fileio/cdr/shapes.rs +++ b/crates/engine/src/cmd/fileio/cdr/shapes.rs @@ -74,6 +74,8 @@ impl Builder { self.learn_spot(c); } } + // Bitmaps are not placed, so their colors add no swatch. + cd::Object::Image(_) => {} cd::Object::Group { objects: kids, .. } => stack.extend(kids), cd::Object::Clip { container, objects } => { for c in container.fill.iter().chain(container.outline.iter().map(|o| &o.color)) { @@ -123,6 +125,8 @@ impl Builder { for o in objects.iter().rev() { match o { cd::Object::Shape(s) => out.extend(self.shape(s, to_doc, false).map(|n| with_flags(n, s.flags))), + // Bitmaps are left out, and the warnings name them with the other objects not read. + cd::Object::Image(_) => self.note(Warning::UnsupportedObjects), cd::Object::Group { objects: kids, flags } => { let children = self.objects_at(kids, to_doc, depth + 1); if !children.is_empty() { diff --git a/crates/engine/src/cmd/fileio/tests_cdr.rs b/crates/engine/src/cmd/fileio/tests_cdr.rs index 2e4d82822b..4728c56065 100644 --- a/crates/engine/src/cmd/fileio/tests_cdr.rs +++ b/crates/engine/src/cmd/fileio/tests_cdr.rs @@ -537,7 +537,7 @@ fn containers_open_as_clipping_groups() { assert!(children[1..].iter().all(|n| matches!(n.kind, NodeKind::Path { clipping: false, .. }))); } -/// A container whose clipped group holds only objects the reader leaves out (a bitmap here), or +/// A container whose clipped group holds only objects the reader leaves out (text here), or /// whose group holds a container of that same group, opens as a plain shape, and the warnings /// say that such frames opened empty. #[test] @@ -554,7 +554,7 @@ fn containers_whose_contents_were_left_out_are_named_in_the_warnings() { super::cdr::import(&synth::riff(1100, &[chunk(b"vrsn", 1100u16.to_le_bytes().to_vec()), doc, page])).unwrap() }; let frames = "PowerClip frames whose contents were left out opened empty"; - let (doc, warnings) = open(vec![synth::object(v, 5, &[(30, v.rect(10.0, 10.0, 0.0))], None)]); + let (doc, warnings) = open(vec![synth::object(v, 4, &[(30, v.rect(10.0, 10.0, 0.0))], None)]); let p = paths(&doc); let [frame] = p.as_slice() else { panic!("{p:?}") }; assert!(matches!(frame.kind, NodeKind::Path { clipping: false, .. }), "{:?}", frame.kind); @@ -566,6 +566,41 @@ fn containers_whose_contents_were_left_out_are_named_in_the_warnings() { assert!(warnings.iter().any(|w| w.contains(frames)), "{warnings:?}"); } +/// A bitmap the reader decodes is not placed: the drawing opens without it, and the warnings name +/// the bitmaps left out. A container that clips only a bitmap opens with its clipping path alone, +/// and the warnings say that such frames opened empty. +#[test] +fn bitmaps_are_left_out_and_named_in_the_warnings() { + let v = V(1300); + let gray = synth::Bitmap { model: 5, bpp: 8, width: 3, height: 2, palette: vec![], rows: vec![vec![0; 3], vec![0; 3]] }; + let open = |bitmaps: Vec, objects: Vec| { + let body = vec![ + chunk(b"vrsn", 1300u16.to_le_bytes().to_vec()), + list(b"bmpt", bitmaps), + synth::page(false, vec![synth::layer(v, [0, 0, 0, 0x98], "Art", objects)]), + ]; + super::cdr::import(&synth::riff(1300, &body)).unwrap() + }; + let rect = || synth::object(v, 1, &[(30, v.rect(40.0, 40.0, 0.0))], None); + let frames = "PowerClip frames whose contents were left out opened empty"; + + let (doc, warnings) = open(vec![synth::bmp(v, 1, &gray, None)], vec![synth::bitmap_object(v, 1, (0.0, 2.0), (3.0, 0.0), None), rect()]); + let p = paths(&doc); + let [shape] = p.as_slice() else { panic!("{p:?}") }; + assert!(matches!(shape.kind, NodeKind::Path { clipping: false, .. }), "{:?}", shape.kind); + assert!(warnings.iter().any(|w| w.contains("text, bitmaps")), "{warnings:?}"); + assert!(warnings.iter().any(|w| w.contains(frames)), "{warnings:?}"); + + let clipped = synth::clpt(vec![(0x77, vec![synth::bitmap_object(v, 1, (0.0, 2.0), (3.0, 0.0), None)])]); + let container = synth::object(v, 1, &[(30, v.rect(40.0, 40.0, 0.0)), synth::container(0x77)], None); + let (doc, warnings) = open(vec![synth::bmp(v, 1, &gray, None), clipped], vec![container]); + let p = paths(&doc); + let [frame] = p.as_slice() else { panic!("{p:?}") }; + assert!(matches!(frame.kind, NodeKind::Path { clipping: true, .. }), "{:?}", frame.kind); + assert!(warnings.iter().any(|w| w.contains("text, bitmaps")), "{warnings:?}"); + assert!(warnings.iter().any(|w| w.contains(frames)), "{warnings:?}"); +} + /// An object with a lens or transparency opens opaque, and the warnings say so. #[test] fn lenses_and_transparency_are_named_in_the_warnings() { diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 266726909a..0c02c32828 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -289,7 +289,7 @@ fn opacity_field(app: &mut VectorcraftApp, ui: &mut Ui, opacity: f32, selected: let target = crate::panels::transparency_target(app); group(ui, rank::OPACITY, |ui| { Field::new(label).side(SideLabel::new().link().scrub(true)).show(ui, |ui, _| { - let number = NumberField::new(label, Bind::given(Some(crate::panels::shown_percent(opacity)))) + let number = NumberField::new(label, Bind::given(Some(f64::from(opacity) * 100.0))) .range(0.0..=100.0) .unit("%") .scrub_by_label() diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index cf129bf26c..689e9a7254 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -1264,15 +1264,6 @@ pub(crate) fn whole_steps(range: std::ops::RangeInclusive) -> ChannelRule { rule } -/// An opacity stored as an f32 fraction (0 to 1), as the percent an Opacity field shows: the whole percent when it -/// stores as the same f32, so that an arrow key steps on from it, and the exact percent otherwise. 51 % stores as -/// 0.51f32, which reads back as 50.999999 %; an Up press from there would step to 51 % again. -pub(crate) fn shown_percent(fraction: f32) -> f64 { - let percent = f64::from(fraction) * 100.0; - let whole = percent.round(); - if (whole / 100.0) as f32 == fraction { whole } else { percent } -} - /// A section of a panel or dialog under its heading in label text: the reference app's section headings are regular /// weight, not bold. pub(crate) fn section<'a>(title: impl Into