Integrate canvas and panel repairs with the framework version used on main

This commit is contained in:
Codex committed 2026-11-30 14:36:46 +01:00
commit 5c2a554dcb
14 files changed
+413 -278

No files matched your search

Generated
+181 -179
View File
File diff suppressed because it is too large. Load diff
+51 -51
View File
@@ -4,57 +4,57 @@ members = ["crates/*", "apps/*", "xtask"]
default-members = ["crates/*", "apps/vectorcraft", "apps/vectorcraft-cli", "xtask"]
[workspace.package]
version = "0.25.0"
version = "0.25.1"
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.95"
[workspace.dependencies]
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130", default-features = false, features = ["interpret", "write"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3", default-features = false, features = ["interpret", "write"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# Language packs: the Craft apps' shared font store installs them (#4936).
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# 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 = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile.
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130", features = ["pcraft-pixels"] }
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3", features = ["pcraft-pixels"] }
# Native Affinity documents (craft-libs#914).
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778).
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# SVG parsing, limits, SVGZ and writer (craft-libs#778).
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130", features = ["tree"] }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3", features = ["tree"] }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# EPS container, previews, ASCII85 and DSC comments (craft-libs#778).
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# DXF tags, reader and writer (craft-libs#778, #926, #927).
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# WMF, EMF and EMF+ reader (craft-libs#778).
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130", default-features = false, features = ["read", "write"] }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3", default-features = false, features = ["read", "write"] }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# 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 = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# 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 = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# Nightly profile isolation, launch protocol, and security fence.
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "1f6c3a21f85ed96f8fd4ddd5a959d4e1edbedb24" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
# internal
vectorcraft-geom = { path = "crates/geom" }
vectorcraft-color = { path = "crates/color" }
@@ -194,22 +194,22 @@ lto = "thin"
codegen-units = 1
[patch.crates-io]
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "9b96acd30cb70dab3083de8513229fe162dc9130" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
emath = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
egui = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
eframe = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" }
winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
egui = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
eframe = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
winit = { git = "https://github.com/storytold/winit.git", rev = "0dfcec0eb62fda5904137a63a6dd0c3d83295f45" }
+1 -1
View File
@@ -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 = "186a229c8da8db5916f8a863dfd894f1879af735", version = "0.1.0" }
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "1afc2e1f0afeaecea3028fa928664c61667890b3", version = "0.1.0" }
wasm-bindgen = "0.2"
serde_json = { workspace = true }
+1 -1
View File
@@ -801,7 +801,7 @@ fn digits_unnamed(text: &str) -> Vec<u8> {
out
}
/// #708, #811: a glyph whose ToUnicode value is U+FFFD isn't type showing "�". This subset font
/// #708, #811: a glyph whose ToUnicode value is U+FFFD isn't type showing `\u{FFFD}`. This subset font
/// has no character map of its own, but the font is installed: each digit is found by its outline
/// there, so the whole text stays one type object, with no outlines left behind.
#[test]
-30
View File
@@ -8,35 +8,5 @@
startup | Noto Sans Arabic | Regular
startup | Noto Sans Thai | Regular
startup | Noto Sans Georgian | Regular
background | Cairo | Regular
background | Tajawal | ExtraLight
background | Tajawal | Light
background | Tajawal | Regular
background | Tajawal | Medium
background | Tajawal | Bold
background | Tajawal | ExtraBold
background | Tajawal | Black
background | Almarai | Light
background | Almarai | Regular
background | Almarai | Bold
background | Almarai | ExtraBold
background | IBM Plex Sans Arabic | Thin
background | IBM Plex Sans Arabic | ExtraLight
background | IBM Plex Sans Arabic | Light
background | IBM Plex Sans Arabic | Regular
background | IBM Plex Sans Arabic | Medium
background | IBM Plex Sans Arabic | SemiBold
background | IBM Plex Sans Arabic | Bold
background | Noto Kufi Arabic | Regular
background | Amiri | Regular
background | Amiri | Italic
background | Amiri | Bold
background | Amiri | Bold Italic
background | Alexandria | Regular
background | Fustat | Regular
background | Reem Kufi | Regular
background | Aref Ruqaa | Regular
background | Aref Ruqaa | Bold
background | Gulzar | Regular
demand | NanumGothic | Regular
demand | Noto Sans Devanagari | Regular
@@ -158,7 +158,7 @@ pub(crate) fn step_place(step: usize, in_batch: Option<usize>) -> String {
}
}
/// `text` as a status message shows it: control characters become `�`, and text past 80
/// `text` as a status message shows it: control characters become `\u{FFFD}`, and text past 80
/// characters ends in `…`.
pub(crate) fn shown_text(text: &str) -> String {
const MAX: usize = 80;
+6
View File
@@ -59,6 +59,12 @@ pub(crate) fn copy_value(ui: &mut Ui, label: &str, value: &str, mono: bool) -> b
/// The same guarded full-value copy for an already shown readout. An elided path remains
/// static text: selection indices must describe the text actually shown by the framework.
pub(crate) fn copy_shown(ui: &mut Ui, shown: &egui::Response, value: &str) -> bool {
// A container's measuring run shows the readout in an invisible sizing pass before the frame's real run, with the
// same id and the same input. It neither copies nor reads or clears the remembered press: clearing it there would
// leave the real run's release without its press.
if ui.is_sizing_pass() {
return false;
}
// The click's own position and keys: a move or a key change after the release in the same
// frame leaves the pointer and the held keys elsewhere. A frame with more than one release
// copies nothing, since the click flags below do not say which release they describe.
+18 -7
View File
@@ -182,8 +182,9 @@ pub struct LayersUi {
/// The selection square clicked last in each open document, by the document's `uid`: where a Shift-click on another
/// square starts.
pub art_anchors: HashMap<u64, NodeId>,
/// The active document's rows with the [`LayerRows::key`] they were listed at.
rows: Option<(u64, Tracked<LayerRows>)>,
/// The active document's rows with the [`LayerRows::key`] they were listed at and the document's `uid` and
/// `reverts`.
rows: Option<(u64, (u64, u64), Tracked<LayerRows>)>,
}
impl Default for LayersUi {
@@ -223,7 +224,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
thumbnails.hold(app.session.active().is_some_and(|st| st.interaction.is_some()) || app.session.tool_busy());
let settings = app.ui.layers_panel.settings();
refresh_rows(app);
let (Some(st), Some((_, kept))) = (app.session.active(), &app.ui.layers_ui.rows) else { return };
let (Some(st), Some((_, _, kept))) = (app.session.active(), &app.ui.layers_ui.rows) else { return };
let tree = DocLayers::of(st, kept);
let source = thumbs::LayerThumbs { doc: &st.doc };
let mut panel = LayersPanel::new(kept)
@@ -294,13 +295,23 @@ fn unrevealed<T>(app: &mut VectorcraftApp, f: impl FnOnce(&mut VectorcraftApp) -
r
}
/// Lists the active document's rows again when what they are listed from changed.
/// Lists the active document's rows again when what they are listed from changed. The new rows go into the kept
/// [`Tracked`] while the document is the same, so the panel keeps its display order when the
/// [order revision](LayerRows::order_of) stays; another document, or the same one after File › Revert, gets a new one.
fn refresh_rows(app: &mut VectorcraftApp) {
let Some(st) = app.session.active() else { return };
let key = LayerRows::key(app, st);
if app.ui.layers_ui.rows.as_ref().is_none_or(|(kept, _)| *kept != key) {
let rows = Tracked::new(LayerRows::new(app, st));
app.ui.layers_ui.rows = Some((key, rows));
let doc = (st.uid, st.reverts);
if app.ui.layers_ui.rows.as_ref().is_some_and(|(kept, _, _)| *kept == key) {
return;
}
let new = LayerRows::new(app, st);
match &mut app.ui.layers_ui.rows {
Some((kept, of, rows)) if *of == doc => {
rows.edit(|rows| *rows = new);
*kept = key;
}
slot => *slot = Some((key, doc, Tracked::new(new))),
}
}
+28 -1
View File
@@ -202,6 +202,14 @@ pub(super) struct LayerRows {
/// In isolation mode, the isolated node: the top row.
#[plain_data(assume = "a node id is an integer")]
root: Option<NodeId>,
/// What the display order is built from ([`LayerRows::order_of`]).
order: u64,
}
#[cfg(test)]
thread_local! {
/// How many times [`LayerRows::children`] was asked on this thread.
pub(super) static CHILDREN_CALLS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
}
/// [`LayerRows`] with the editing state of their document, for the panel's host code in one pass.
@@ -243,7 +251,9 @@ impl LayerRows {
let guide_rows = ruler.iter().enumerate().filter_map(|(i, g)| Some((g.id?, i))).collect();
let blends = st.selection.objects.iter().copied().filter(|id| doc.node(*id).is_some_and(|n| matches!(n.kind, NodeKind::Blend { .. })));
let selected: HashSet<NodeId> = st.selection.objects.iter().copied().collect();
let root = st.isolation.and_then(|i| isolated_root(doc, i)).map(|(n, ..)| n.id);
Self {
order: Self::order_of(doc, &st.layers_open, app.ui.layers_panel.layers_only, root),
doc: doc.clone(),
opts: app.ui.layers_panel.clone(),
xml_id: by_xml_id(app),
@@ -258,10 +268,20 @@ impl LayerRows {
holding: super::rows::holding(doc, &selected),
selected,
blends: blends.collect(),
root: st.isolation.and_then(|i| isolated_root(doc, i)).map(|(n, ..)| n.id),
root,
}
}
/// A hash of everything the display order reads ([`LayerTree::children`] and [`LayerTree::is_open`]): the
/// document, which an edit replaces and a selection change keeps (its ruler guides and an opacity mask being
/// edited are in it), the open rows, Show Layers Only and the isolated node. The selection, the highlighted rows,
/// the current layer, the names and the other Panel Options are not in it.
fn order_of(doc: &Arc<Document>, open: &OpenRows, layers_only: bool, root: Option<NodeId>) -> u64 {
let mut hasher = DefaultHasher::new();
(Arc::as_ptr(doc) as usize, open.generation(), layers_only, root).hash(&mut hasher);
hasher.finish()
}
/// What the rows of `st` are listed from: the document and its revision (which every edit and
/// selection change moves), the open rows, isolation mode, the highlighted rows and the current
/// layer, the Panel Options, Identify Objects By and the language.
@@ -461,6 +481,8 @@ impl LayerTree for LayerRows {
/// The top rows are the layers (only the opacity mask's while one is edited), or in isolation
/// mode the isolated layer, sublayer, group or object.
fn children(&self, parent: Option<&RowId>) -> Vec<RowId> {
#[cfg(test)]
CHILDREN_CALLS.with(|c| c.set(c.get() + 1));
match parent {
None => match self.root {
Some(root) => vec![RowId::Node(root)],
@@ -491,6 +513,11 @@ impl LayerTree for LayerRows {
false
}
/// The display order changes only with what [`LayerRows::order_of`] hashes: a selection change keeps it.
fn order_revision(&self) -> Option<u64> {
Some(self.order)
}
fn info(&self, id: &RowId) -> LayerInfo {
match *id {
RowId::Node(id) => match self.doc.node(id) {
+75
View File
@@ -1352,3 +1352,78 @@ fn idle_frames_walk_no_node_for_the_selection_squares() {
}
assert!((1..=12).contains(&(visits() - before)), "a new selection walks the tree once: {}", visits() - before);
}
/// A selection change keeps the panel's display order: no row is asked for the rows inside it. Closing a row, Show
/// Layers Only and an edit build the order again, and the rows follow.
#[test]
fn a_selection_change_keeps_the_display_order() {
use crate::tests::panel_harness::Panel;
let calls = || super::model::CHILDREN_CALLS.with(std::cell::Cell::get);
let (mut app, [_, sub, _, b, a, c]) = nested();
for (id, name) in [(sub, "Sub"), (b, "B"), (a, "A"), (c, "C")] {
name_row(&mut app, id, name);
}
app.session.execute("select.set", &json!({"ids": [b.0]})).unwrap();
let mut panel = Panel::new(app, show);
panel.frame();
let before = calls();
panel.app().session.execute("select.set", &json!({"ids": [a.0]})).unwrap();
for _ in 0..3 {
panel.frame();
}
assert_eq!(calls() - before, 0, "a selection change asks no row for its rows");
assert!(panel.shows("A") && panel.shows("B"), "the rows stay");
expand(&mut panel.app(), &json!({"ids": [sub.0], "open": false})).unwrap();
let before = calls();
panel.frame();
panel.frame();
assert!(calls() > before, "closing a row builds the order again");
assert!(!panel.shows("A") && panel.shows("Sub") && panel.shows("C"), "the closed sublayer's rows are gone");
panel.app().ui.layers_panel.layers_only = true;
panel.frame();
panel.frame();
assert!(!panel.shows("C") && panel.shows("Sub"), "Show Layers Only leaves the objects out");
panel.app().ui.layers_panel.layers_only = false;
panel.app().session.execute("object.isolate", &json!({"id": sub.0})).unwrap();
panel.frame();
panel.frame();
assert!(panel.shows("Sub") && !panel.shows("C"), "isolation mode lists only the isolated sublayer");
panel.app().session.execute("object.exitIsolation", &json!({})).unwrap();
expand(&mut panel.app(), &json!({"ids": [sub.0], "open": true})).unwrap();
let made = panel.app().session.execute("shape.rectangle", &json!({"x": 200, "y": 200, "width": 10, "height": 10})).unwrap();
let d = NodeId(made["id"].as_u64().unwrap());
name_row(&mut panel.app(), d, "D");
panel.frame();
panel.frame();
assert!(panel.shows("D") && panel.shows("C"), "an edit lists the new object");
}
/// The order revision stays through a selection change and moves with the document, the open rows, Show Layers Only
/// and isolation mode.
#[test]
fn the_order_revision_follows_what_the_display_order_reads() {
let order = |app: &VectorcraftApp| LayerRows::new(app, app.session.active().unwrap()).order_revision();
let (mut app, [_, sub, g, b, a, _]) = nested();
let first = order(&app);
assert!(first.is_some(), "the rows report an order revision");
app.session.execute("select.set", &json!({"ids": [b.0]})).unwrap();
assert_eq!(order(&app), first, "a selection change keeps it");
app.session.execute("object.isolate", &json!({"id": sub.0})).unwrap();
let isolated = order(&app);
assert_ne!(isolated, first, "isolation mode moves it");
app.session.execute("object.exitIsolation", &json!({})).unwrap();
let left = order(&app);
assert_ne!(left, isolated, "leaving isolation mode moves it");
app.ui.layers_panel.layers_only = true;
assert_ne!(order(&app), left, "Show Layers Only moves it");
app.ui.layers_panel.layers_only = false;
assert_eq!(order(&app), left, "and turning it off gives it back");
expand(&mut app, &json!({"ids": [g.0], "open": false})).unwrap();
let closed = order(&app);
assert_ne!(closed, left, "closing a row moves it");
name_row(&mut app, a, "A");
assert_ne!(order(&app), closed, "an edit moves it");
}
+14 -4
View File
@@ -355,10 +355,11 @@ fn a_control_port_cancel_of_a_dialog_preview_reads_the_menus() {
}
/// OK applies the rotation a dialog previews as one undo step: the menus are read then, with Undo
/// naming it, and not for the angles previewed before.
/// naming it, and not for the angles previewed before. Once the dialog's angle field no longer takes
/// the keys, the menus are sent once more without the text-editing gate.
#[test]
fn applying_a_dialog_preview_reads_the_menus() {
let (m, (read, synced, closed, after)) = undisturbed(|m| {
let (m, (read, synced, applied, closed, after)) = undisturbed(|m| {
m.rotate_preview();
let read = m.angles(4);
let synced = m.fake.synced();
@@ -367,12 +368,21 @@ fn applying_a_dialog_preview_reads_the_menus() {
// gone two frames later.
m.frame(vec![]);
m.frame(vec![]);
let applied = m.fake.synced();
// The frame after the field gives up the keys sets the gate.
for _ in 0..4 {
if !m.ctx.egui_wants_keyboard_input() {
break;
}
m.frame(vec![]);
}
m.frame(vec![]);
(read, synced, !m.app.session.in_interaction() && !m.app.any_dialog_open(), m.fake.synced())
(read, synced, applied, !m.app.session.in_interaction() && !m.app.any_dialog_open(), m.fake.synced())
});
assert_eq!(read, 0, "the menus weren't read while the dialog previewed the angles");
assert!(closed);
assert_eq!(after, synced + 1, "the menus were read");
assert_eq!(applied, synced + 1, "the menus were read");
assert_eq!(after, synced + 2, "and sent once more when the gate changed");
assert_eq!(find(&m.fake.last(), "edit.undo").label, "Undo Rotate");
}
@@ -73,6 +73,29 @@ try {
Clear-SigningFixtures
Write-Output 'PASS: supported-configuration-presence-without-signing'
# The unsigned message is captured here, so it does not become an annotation of this job.
$optInFile = Join-Path $root 'opt-in-sentinel.exe'
[IO.File]::WriteAllText($optInFile, 'generated sentinel, not a real executable')
$savedActions = $env:GITHUB_ACTIONS
try {
$env:GITHUB_ACTIONS = 'true'
$env:CRAFT_ALLOW_UNSIGNED = $null
$default = (& $sign $optInFile) -join "`n"
Assert-Policy ($default.Contains('::warning::Windows signing secrets not set')) "unsigned output without the opt-in must warn; got: $default"
$env:CRAFT_ALLOW_UNSIGNED = '1'
$optedIn = (& $sign $optInFile) -join "`n"
Assert-Policy ($optedIn.Contains('::notice::Windows signing secrets not set')) "opted-in unsigned output must be a notice; got: $optedIn"
Assert-Policy (-not $optedIn.Contains('::warning::')) "opted-in unsigned output must not warn; got: $optedIn"
foreach ($value in @('true', '0', 'yes')) {
$env:CRAFT_ALLOW_UNSIGNED = $value
Invoke-Refusal { & $sign $optInFile } 'CRAFT_ALLOW_UNSIGNED must be 1 or unset'
}
} finally {
$env:CRAFT_ALLOW_UNSIGNED = $null
$env:GITHUB_ACTIONS = $savedActions
}
Write-Output 'PASS: opted-in-unsigned-output-is-a-notice'
# Load the policy function without signing. These objects are not crypto evidence.
. $sign -CheckOnly
foreach ($value in @($null, [pscustomobject]@{Status='NotSigned';SignerCertificate='fixture'}, [pscustomobject]@{Status='HashMismatch';SignerCertificate='fixture'}, [pscustomobject]@{Status='Valid';SignerCertificate=$null})) {
+13 -2
View File
@@ -9,7 +9,8 @@
AZURE_SIGNING_ENDPOINT (e.g. https://eus.codesigning.azure.net),
AZURE_SIGNING_ACCOUNT, AZURE_CERT_PROFILE
With neither, it prints a warning and leaves the files unsigned (exit code 0), so test builds
still produce installers. Nightly callers require signing with -Required and can check the
still produce installers. A caller that builds unsigned on purpose sets CRAFT_ALLOW_UNSIGNED=1,
and the message is then a notice instead of a warning. Nightly callers require signing with -Required and can check the
signing configuration with -Required -CheckOnly. Compilation uses the separate
-CheckBuildEnvironment mode, which refuses any signing material without importing a key.
@@ -38,6 +39,10 @@ function Write-Warn([string] $Message) {
if ($env:GITHUB_ACTIONS) { Write-Output "::warning::$Message" } else { Write-Warning $Message }
}
function Write-Note([string] $Message) {
if ($env:GITHUB_ACTIONS) { Write-Output "::notice::$Message" } else { Write-Output $Message }
}
function Find-SignTool {
if ($env:SIGNTOOL) { return $env:SIGNTOOL }
$onPath = Get-Command signtool.exe -ErrorAction SilentlyContinue
@@ -64,6 +69,11 @@ if ($CheckBuildEnvironment) {
}
return
}
$allowUnsigned = switch -CaseSensitive ([string]$env:CRAFT_ALLOW_UNSIGNED) {
'' { $false }
'1' { $true }
default { throw "CRAFT_ALLOW_UNSIGNED must be 1 or unset, got '$env:CRAFT_ALLOW_UNSIGNED'" }
}
$haveCert = [bool]$env:WINDOWS_CERTIFICATE
$haveAzure = -not ($azureVars | Where-Object { -not [Environment]::GetEnvironmentVariable($_) })
@@ -78,7 +88,8 @@ if (-not $Files) { throw 'At least one file is required for signing' }
$Files = $Files | ForEach-Object { (Resolve-Path $_).Path }
if (-not $haveCert -and -not $haveAzure) {
Write-Warn "Windows signing secrets not set (WINDOWS_CERTIFICATE or AZURE_*): leaving unsigned: $($Files -join ', ')"
$message = "Windows signing secrets not set (WINDOWS_CERTIFICATE or AZURE_*): leaving unsigned: $($Files -join ', ')"
if ($allowUnsigned) { Write-Note $message } else { Write-Warn $message }
exit 0
}
+1 -1
View File
@@ -5,7 +5,7 @@ use std::process::Command;
use serde_json::Value;
const REV: &str = "186a229c8da8db5916f8a863dfd894f1879af735";
const REV: &str = "1afc2e1f0afeaecea3028fa928664c61667890b3";
const PACKAGES: &[(&str, &str, &str)] = &[
("craft-pdf", "0.1.0", REV),
("krilla", "0.8.2", REV),