mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 11:45:55 +00:00
Merge remote-tracking branch 'origin/main' into docs-8312-3d-status
# Conflicts: # docs/gaps.md
This commit is contained in:
@@ -480,6 +480,28 @@ impl Selection {
|
||||
}
|
||||
self.target = None;
|
||||
}
|
||||
/// Shift-clicking a range of target circles: the art of every row in `ids` (a layer: its
|
||||
/// visible, unlocked art, its sublayers' too; anything else: itself) is selected, or joins the
|
||||
/// selection when `add` is set. Several objects are then selected, none targeted. Art on a
|
||||
/// locked artboard is left out, as [`Selection::toggle_target`] leaves it out.
|
||||
pub fn target_range(&mut self, doc: &Document, ids: &[NodeId], add: bool) {
|
||||
let locks = doc.locked_artboards();
|
||||
let mut art = Vec::new();
|
||||
for &id in ids {
|
||||
match doc.node(id) {
|
||||
Some(n) if n.is_layer() => art.extend(n.layer_art(true)),
|
||||
Some(_) => art.push(id),
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
art.retain(|i| !locks.holds_id(*i));
|
||||
if add {
|
||||
self.add_all(art);
|
||||
} else {
|
||||
self.set(art);
|
||||
}
|
||||
self.target = None;
|
||||
}
|
||||
/// What appearance and transparency edits act on: the targeted object, group or layer, else
|
||||
/// the selected objects.
|
||||
pub fn subjects(&self) -> &[NodeId] {
|
||||
|
||||
@@ -192,7 +192,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Target",
|
||||
[],
|
||||
None,
|
||||
"{id, add?: bool (Shift-click: the item joins the selection, or leaves it when all selected; nothing is targeted)} target a layer, group or object as clicking its target circle in the Layers panel does: a layer gets its visible, unlocked art (its sublayers' too) selected and becomes the current layer, and appearance.*, effect.*, transparency.* and the opacity-mask commands without `ids` then act on the layer itself; anything else is selected. Any other selection change ends the targeting (`document.inspect` → target) → {id, selected: [..]}",
|
||||
"{id, add?: bool} or {range: [id…], add?: bool} target a layer, group or object as clicking its target circle in the Layers panel does: a layer gets its visible, unlocked art (its sublayers' too) selected and becomes the current layer, and appearance.*, effect.*, transparency.* and the opacity-mask commands without `ids` then act on the layer itself; anything else is selected. `add` (Ctrl/Cmd-click): the item joins the selection, or leaves it when all selected; nothing is targeted. `range` (Shift-click, the rows from the last circle clicked to this one): the art of every listed row that is visible, unlocked and inside the isolated group is selected, or added to the selection with `add` (Shift+Ctrl/Cmd-click); nothing is targeted. Any other selection change ends the targeting (`document.inspect` → target) → {id, selected: [..]} (with `range`: {range, selected})",
|
||||
has_doc,
|
||||
target
|
||||
),
|
||||
@@ -433,6 +433,9 @@ fn paste_remembers_layers(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
/// The Layers panel's target circle.
|
||||
fn target(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const C: &str = "layer.target";
|
||||
if let Some(ids) = ids_param(p, "range", C)? {
|
||||
return target_range(s, p, ids);
|
||||
}
|
||||
let id = object_param(p, "id", C)?.ok_or_else(|| bad(C, "missing id"))?;
|
||||
let st = s.doc()?;
|
||||
let n = st.doc.node(id).ok_or(EngineError::NoNode(id))?;
|
||||
@@ -458,6 +461,31 @@ fn target(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(json!({ "id": id.0, "selected": st.selection.objects.iter().map(|i| i.0).collect::<Vec<_>>() }))
|
||||
}
|
||||
|
||||
/// `layer.target` with `range`, a Shift-click range of target circles: the art of every listed row
|
||||
/// that is visible, unlocked and inside the isolated group is selected, or added to the selection
|
||||
/// with `add`. Nothing is targeted, and the highlighted rows stay. The current layer follows the
|
||||
/// selection, as with any selection change ([`Session::select`]).
|
||||
fn target_range(s: &mut Session, p: &Value, mut ids: Vec<NodeId>) -> Result<Value> {
|
||||
const C: &str = "layer.target";
|
||||
ids.truncate(MAX_ROWS);
|
||||
let add = switch_or(p, "add", false, C)?;
|
||||
let rows = {
|
||||
let st = s.doc()?;
|
||||
// Measures the locked artboards once for every row, not once per row.
|
||||
let editable = st.doc.editable();
|
||||
ids.retain(|id| st.doc.node(*id).is_some() && editable(*id) && in_isolation(&st.doc, st.isolation, *id));
|
||||
st.layer_rows.clone()
|
||||
};
|
||||
if ids.is_empty() {
|
||||
return Err(bad(C, "no row in the range is visible, unlocked and inside the isolated group"));
|
||||
}
|
||||
s.select(|d, sel| sel.target_range(d, &ids, add))?;
|
||||
let st = s.doc_mut()?;
|
||||
// Targeting doesn't change which rows are highlighted.
|
||||
st.layer_rows = rows;
|
||||
Ok(json!({ "range": ids.iter().map(|i| i.0).collect::<Vec<_>>(), "selected": st.selection.objects.iter().map(|i| i.0).collect::<Vec<_>>() }))
|
||||
}
|
||||
|
||||
/// The Layers panel's clipping mask button: the top object of a layer (or group) clips the rest,
|
||||
/// or the clipping mask is released.
|
||||
fn clip_toggle(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
|
||||
@@ -331,6 +331,72 @@ fn many_repeats_keep_their_places_in_a_smooth_shading() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Level 3 smooth shadings handle two-stop (`FunctionType 2`), hard-edge (duplicate offset),
|
||||
/// zero-span (solid fallback), and degenerate zero-length linear/radial gradients cleanly.
|
||||
#[test]
|
||||
fn smooth_shadings_handle_two_stop_hard_edge_and_degenerate_gradients() {
|
||||
use vectorcraft_color::GradientGeom;
|
||||
|
||||
// Two-stop linear gradient emits a single FunctionType 2 (no stitching FunctionType 3).
|
||||
let two_stop = Gradient::new(
|
||||
GradientKind::Linear,
|
||||
vec![GradientStop::new(0.0, Color::rgb(1.0, 0.0, 0.0)), GradientStop::new(1.0, Color::rgb(0.0, 0.0, 1.0))],
|
||||
);
|
||||
let two_doc = doc_with(|d| {
|
||||
vec![path(
|
||||
d,
|
||||
shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 120.0)),
|
||||
Paint::Gradient(Box::new(GradientPaint::new(two_stop))),
|
||||
Paint::None,
|
||||
0.0,
|
||||
)]
|
||||
});
|
||||
let two_page = page_of(&two_doc, &opts(&two_doc));
|
||||
assert!(two_page.contains("/ShadingType 2") && two_page.contains("/FunctionType 2"), "{two_page}");
|
||||
assert!(!two_page.contains("/FunctionType 3"), "{two_page}");
|
||||
|
||||
// Hard-edge gradient (two stops at offset 0.5) skips the zero-width segment and stitches at 0.5.
|
||||
let hard = Gradient::new(
|
||||
GradientKind::Linear,
|
||||
vec![
|
||||
GradientStop::new(0.0, Color::rgb(1.0, 0.0, 0.0)),
|
||||
GradientStop::new(0.5, Color::rgb(1.0, 0.0, 0.0)),
|
||||
GradientStop::new(0.5, Color::rgb(0.0, 0.0, 1.0)),
|
||||
GradientStop::new(1.0, Color::rgb(0.0, 0.0, 1.0)),
|
||||
],
|
||||
);
|
||||
let hard_doc = doc_with(|d| {
|
||||
vec![path(d, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 120.0)), Paint::Gradient(Box::new(GradientPaint::new(hard))), Paint::None, 0.0)]
|
||||
});
|
||||
let hard_page = page_of(&hard_doc, &opts(&hard_doc));
|
||||
assert!(hard_page.contains("/FunctionType 3") && hard_page.contains("/Bounds [0.5 ] /Encode [0 1 0 1 ]"), "{hard_page}");
|
||||
|
||||
// Two stops at the same interior offset pad to 0 and 1, emitting a hard-edge stitch at 0.5.
|
||||
let flat = Gradient::new(
|
||||
GradientKind::Linear,
|
||||
vec![GradientStop::new(0.5, Color::rgb(1.0, 0.0, 0.0)), GradientStop::new(0.5, Color::rgb(0.0, 0.0, 1.0))],
|
||||
);
|
||||
let flat_doc = doc_with(|d| {
|
||||
vec![path(d, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 120.0)), Paint::Gradient(Box::new(GradientPaint::new(flat))), Paint::None, 0.0)]
|
||||
});
|
||||
let flat_page = page_of(&flat_doc, &opts(&flat_doc));
|
||||
assert!(flat_page.contains("/FunctionType 3") && flat_page.contains("/Bounds [0.5 ] /Encode [0 1 0 1 ]"), "{flat_page}");
|
||||
assert!(flat_page.contains("/C0 [1 0 0] /C1 [1 0 0]") && flat_page.contains("/C0 [0 0 1] /C1 [0 0 1]"), "{flat_page}");
|
||||
|
||||
// Zero-length linear and radial gradients still emit valid shfill geometry.
|
||||
for kind in [GradientKind::Linear, GradientKind::Radial] {
|
||||
let mut gp = GradientPaint::new(Gradient::new(
|
||||
kind,
|
||||
vec![GradientStop::new(0.0, Color::rgb(1.0, 0.0, 0.0)), GradientStop::new(1.0, Color::rgb(0.0, 0.0, 1.0))],
|
||||
));
|
||||
gp.geom = Some(GradientGeom { start: Point::new(50.0, 50.0), end: Point::new(50.0, 50.0), aspect: 1.0, focal: None });
|
||||
let deg_doc =
|
||||
doc_with(|d| vec![path(d, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 120.0)), Paint::Gradient(Box::new(gp)), Paint::None, 0.0)]);
|
||||
let deg_page = page_of(°_doc, &opts(°_doc));
|
||||
assert!(deg_page.contains("shfill"), "{kind:?}: {deg_page}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strokes_keep_their_caps_joins_and_dashes() {
|
||||
let d = doc_with(|d| {
|
||||
|
||||
@@ -462,6 +462,20 @@ fn edit_tip(resp: egui::Response, name: &egui::Response) -> egui::Response {
|
||||
if name.hovered() { resp } else { resp.on_hover_text(tl!("Double-click to edit")) }
|
||||
}
|
||||
|
||||
/// Does any selected subject have a non-basic appearance that can be reduced?
|
||||
fn any_subject_needs_reduction(app: &VectorcraftApp) -> bool {
|
||||
let Some(st) = app.session.active() else { return false };
|
||||
st.selection.subjects().iter().any(|id| {
|
||||
let target_node = st
|
||||
.doc
|
||||
.parent_of(*id)
|
||||
.and_then(|p| st.doc.node(p))
|
||||
.filter(|p| matches!(p.kind, vectorcraft_doc::NodeKind::Compound { .. }))
|
||||
.or_else(|| st.doc.node(*id));
|
||||
target_node.is_some_and(|n| !n.appearance.is_basic())
|
||||
})
|
||||
}
|
||||
|
||||
/// The Appearance panel: the object row, the stack of the selected object (or of new art with nothing selected) and the bottom bar; Delete/Backspace after a row click remove the highlighted rows.
|
||||
pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
@@ -475,6 +489,24 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
if resp.clicked() && sel != Sel::None {
|
||||
select_row(app, ui.ctx(), Sel::None);
|
||||
}
|
||||
if resp.secondary_clicked() {
|
||||
super::set_row_keys(ui.ctx(), ROW_KEYS, true);
|
||||
if sel != Sel::None {
|
||||
select_row(app, ui.ctx(), Sel::None);
|
||||
}
|
||||
}
|
||||
resp.context_menu(|ui| {
|
||||
let has = node.is_some();
|
||||
if menu_item(ui, tl!("Clear Appearance"), has, false) {
|
||||
app.run("appearance.clear", json!({})).ok();
|
||||
ui.close();
|
||||
}
|
||||
let can_reduce = any_subject_needs_reduction(app);
|
||||
if menu_item(ui, tl!("Reduce to Basic Appearance"), can_reduce, false) {
|
||||
app.run("appearance.reduceToBasic", json!({})).ok();
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
ui.painter().line_segment([r.left_bottom(), r.right_bottom()], Stroke::new(1.0, t.input_border));
|
||||
let summary = summary(app, ui.ctx());
|
||||
let mix = summary.as_ref().and_then(|s| s.mixed(app));
|
||||
@@ -731,6 +763,58 @@ enum Slot {
|
||||
Contents,
|
||||
}
|
||||
|
||||
/// Context menu and right-click selection for a stroke or fill row.
|
||||
fn item_row_context(
|
||||
app: &mut VectorcraftApp,
|
||||
ui: &mut Ui,
|
||||
n: &Node,
|
||||
resps: (&egui::Response, &egui::Response),
|
||||
i: usize,
|
||||
it: &AppearanceItem,
|
||||
items: &[usize],
|
||||
) {
|
||||
let (resp, name) = resps;
|
||||
if resp.secondary_clicked() || name.secondary_clicked() {
|
||||
super::set_row_keys(ui.ctx(), ROW_KEYS, true);
|
||||
if !items.contains(&i) {
|
||||
select_row(app, ui.ctx(), Sel::Item(i));
|
||||
}
|
||||
}
|
||||
let is_stroke = matches!(it, AppearanceItem::Stroke(_));
|
||||
let visible = it.visible();
|
||||
let vis_label = if is_stroke {
|
||||
if visible { tl!("Hide Stroke") } else { tl!("Show Stroke") }
|
||||
} else {
|
||||
if visible { tl!("Hide Fill") } else { tl!("Show Fill") }
|
||||
};
|
||||
let mut menu = |ui: &mut Ui| {
|
||||
let sel = current_sel(app, ui.ctx(), Some(n));
|
||||
let sel_items = selected_items(ui.ctx(), Some(n), sel);
|
||||
let multi = sel_items.len() > 1;
|
||||
let (dup_label, del_label) = if multi {
|
||||
(tl!("Duplicate Items"), tl!("Delete Items"))
|
||||
} else if is_stroke {
|
||||
(tl!("Duplicate Stroke"), tl!("Delete Stroke"))
|
||||
} else {
|
||||
(tl!("Duplicate Fill"), tl!("Delete Fill"))
|
||||
};
|
||||
if menu_item(ui, dup_label, true, false) {
|
||||
duplicate_selected(app, ui, Some(n), sel);
|
||||
ui.close();
|
||||
}
|
||||
if menu_item(ui, del_label, true, false) {
|
||||
delete_selected(app, ui, Some(n), sel);
|
||||
ui.close();
|
||||
}
|
||||
if menu_item(ui, vis_label, true, false) {
|
||||
app.run("appearance.setItem", aligned(app, json!({"index": i, "visible": !visible}))).ok();
|
||||
ui.close();
|
||||
}
|
||||
};
|
||||
resp.context_menu(&mut menu);
|
||||
name.context_menu(&mut menu);
|
||||
}
|
||||
|
||||
/// The rows of object `n` (fills/strokes with their Opacity and effect rows, the Contents row, the object's effects and Opacity) with the click rules, row drags and drop markers; `sel` is the active row.
|
||||
/// `only`: a mixed selection (`n` its first object): only the rows its objects share are listed,
|
||||
/// and rows aren't dragged (where one would go in each of the different stacks isn't one place).
|
||||
@@ -786,7 +870,8 @@ fn stack(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, sel: Sel, object_row:
|
||||
// The label edits the row (the Stroke or Color panel); the empty space only takes the click
|
||||
// rules.
|
||||
let label = if is_stroke { tl!("Stroke:") } else { tl!("Fill:") };
|
||||
if name_link(ui, pos2(lx, r.center().y), ("ap-link", i), label).clicked() {
|
||||
let name = name_link(ui, pos2(lx, r.center().y), ("ap-link", i), label);
|
||||
if name.clicked() {
|
||||
select_row(app, ui.ctx(), Sel::Item(i));
|
||||
// The panel has the keyboard (Delete removes this row, not the art).
|
||||
super::set_row_keys(ui.ctx(), ROW_KEYS, true);
|
||||
@@ -800,12 +885,13 @@ fn stack(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, sel: Sel, object_row:
|
||||
let m = ui.input(|inp| inp.modifiers);
|
||||
click_row(app, ui.ctx(), n, sel, Rows::Items, i, m);
|
||||
}
|
||||
item_row_context(app, ui, n, (&resp, &name), i, it, &items);
|
||||
track(&resp, Dragged::Item(i));
|
||||
if open {
|
||||
let r = opacity_row(app, ui, Some(i), it.opacity(), it.blend(), sel, false);
|
||||
rows.push((Slot::Item { index: i, sub: true }, r));
|
||||
for (k, e) in it.effects().iter().enumerate() {
|
||||
let (r, resp) = effect_row(app, ui, Some(i), k, e, lit(Some(i), k));
|
||||
let (r, resp) = effect_row(app, ui, n, Some(i), k, e, lit(Some(i), k));
|
||||
if resp.clicked() {
|
||||
let m = ui.input(|inp| inp.modifiers);
|
||||
click_row(app, ui.ctx(), n, sel, Rows::Effects(Some(i)), k, m);
|
||||
@@ -825,7 +911,7 @@ fn stack(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, sel: Sel, object_row:
|
||||
if only.is_some_and(|m| !m.shared.has_effect(k)) {
|
||||
continue;
|
||||
}
|
||||
let (r, resp) = effect_row(app, ui, None, k, e, lit(None, k));
|
||||
let (r, resp) = effect_row(app, ui, n, None, k, e, lit(None, k));
|
||||
if resp.clicked() {
|
||||
let m = ui.input(|inp| inp.modifiers);
|
||||
click_row(app, ui.ctx(), n, sel, Rows::Effects(None), k, m);
|
||||
@@ -1197,7 +1283,7 @@ fn opacity_row(app: &mut VectorcraftApp, ui: &mut Ui, item: Option<usize>, opaci
|
||||
/// An effect row: of the object (`item: None`) or, indented under it, of fill/stroke `item`.
|
||||
/// Clicking the name opens the effect's dialog to edit it (the disclosure: an inline editor).
|
||||
/// Returns the row's rect and response (for dragging).
|
||||
fn effect_row(app: &mut VectorcraftApp, ui: &mut Ui, item: Option<usize>, k: usize, e: &Effect, selected: bool) -> (Rect, egui::Response) {
|
||||
fn effect_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, item: Option<usize>, k: usize, e: &Effect, selected: bool) -> (Rect, egui::Response) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let open_key = format!("ap-fx-open-{item:?}-{k}");
|
||||
let open: bool = pstate(ui.ctx(), &open_key);
|
||||
@@ -1232,6 +1318,44 @@ fn effect_row(app: &mut VectorcraftApp, ui: &mut Ui, item: Option<usize>, k: usi
|
||||
set_pstate(ui.ctx(), &open_key, !open);
|
||||
}
|
||||
}
|
||||
if resp.secondary_clicked() || name.secondary_clicked() {
|
||||
super::set_row_keys(ui.ctx(), ROW_KEYS, true);
|
||||
if !selected {
|
||||
select_row(app, ui.ctx(), this);
|
||||
}
|
||||
}
|
||||
let mut menu = |ui: &mut Ui| {
|
||||
if menu_item(ui, tl!("Edit Effect…"), true, false) {
|
||||
select_row(app, ui.ctx(), this);
|
||||
super::set_row_keys(ui.ctx(), ROW_KEYS, true);
|
||||
if has_options(&e.id) {
|
||||
app.run("effect.dialog", aligned(app, json!({"effect": e.id, "index": k, "item": item}))).ok();
|
||||
} else {
|
||||
set_pstate(ui.ctx(), &open_key, !open);
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
let sel = current_sel(app, ui.ctx(), Some(n));
|
||||
let sel_fx = selected_effects(ui.ctx(), Some(n), sel);
|
||||
let multi = sel_fx.as_ref().is_some_and(|(list, ks)| *list == item && ks.len() > 1);
|
||||
let dup_label = if multi { tl!("Duplicate Effects") } else { tl!("Duplicate Effect") };
|
||||
let del_label = if multi { tl!("Delete Effects") } else { tl!("Delete Effect") };
|
||||
if menu_item(ui, dup_label, true, false) {
|
||||
duplicate_selected(app, ui, Some(n), sel);
|
||||
ui.close();
|
||||
}
|
||||
if menu_item(ui, del_label, true, false) {
|
||||
delete_selected(app, ui, Some(n), sel);
|
||||
ui.close();
|
||||
}
|
||||
let vis_label = if e.visible { tl!("Hide Effect") } else { tl!("Show Effect") };
|
||||
if menu_item(ui, vis_label, true, false) {
|
||||
app.run("effect.setParams", aligned(app, json!({"item": item, "index": k, "visible": !e.visible}))).ok();
|
||||
ui.close();
|
||||
}
|
||||
};
|
||||
resp.context_menu(&mut menu);
|
||||
name.context_menu(&mut menu);
|
||||
icons::paint(ui, "dc-fx", Rect::from_center_size(r.right_center() - vec2(14.0, 0.0), vec2(16.0, 16.0)), t.icon);
|
||||
if open {
|
||||
effect_editor(app, ui, item, k, e);
|
||||
@@ -1737,7 +1861,8 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
if menu_item(ui, tl!("Clear Appearance"), has, false) {
|
||||
app.run("appearance.clear", json!({})).ok();
|
||||
}
|
||||
if menu_item(ui, tl!("Reduce to Basic Appearance"), has && !node.as_ref().is_some_and(|n| n.appearance.is_basic()), false) {
|
||||
let can_reduce = any_subject_needs_reduction(app);
|
||||
if menu_item(ui, tl!("Reduce to Basic Appearance"), can_reduce, false) {
|
||||
app.run("appearance.reduceToBasic", json!({})).ok();
|
||||
}
|
||||
ui.separator();
|
||||
|
||||
@@ -31,9 +31,12 @@
|
||||
//! Backspace) asks first when a layer or sublayer among them holds art ([`delete`]).
|
||||
//! - The triangle opens or closes a row; Alt-click does the same to everything inside it.
|
||||
//! - Double-clicking a name renames it; double-clicking elsewhere on a row opens its options.
|
||||
//! - A target circle targets its layer, group or object (`layer.target`); dragging it onto another
|
||||
//! row's circle moves the appearance there (Alt copies it, `appearance.transfer`) and dropping it
|
||||
//! on the trash reduces it to basic appearance (`appearance.reduceToBasic`) without deleting it.
|
||||
//! - A target circle targets its layer, group or object (`layer.target`). Its modifier keys
|
||||
//! follow the names' rules: Ctrl/Cmd adds the item to the selection or takes it out, Shift
|
||||
//! selects the art of every row from the last circle clicked to this one, and Shift+Ctrl/Cmd
|
||||
//! adds that art (#8639). Dragging a circle onto another row's circle moves the appearance there
|
||||
//! (Alt copies it, `appearance.transfer`) and dropping it on the trash reduces it to basic
|
||||
//! appearance (`appearance.reduceToBasic`) without deleting it.
|
||||
//! - Search All and the Filter button at its right (`ui.layersFilter`, lit while a filter is on)
|
||||
//! narrow the rows, and every row that holds others shows open while they do. A row stays when
|
||||
//! its name holds the text typed, it is one of the object kinds ticked under By Object and it is
|
||||
@@ -74,7 +77,7 @@ pub use model::{Filter, ObjectKind, RowState};
|
||||
#[cfg(test)]
|
||||
use model::{Row, list_rows, painted_name};
|
||||
use model::{isolated_root, push_rows, rows_of_doc};
|
||||
use rows::{drag_ghost, key, rename_id, resolve_click, row};
|
||||
use rows::{drag_ghost, key, rename_id, resolve_click, resolve_target_click, row};
|
||||
#[cfg(test)]
|
||||
use thumbs::THUMBS;
|
||||
pub(crate) use thumbs::{ThumbSource, node_arc, real_thumb, retain_open_thumbs, show_thumbs_of, thumb_options};
|
||||
@@ -184,6 +187,8 @@ struct Out {
|
||||
actions: Vec<(String, Value)>,
|
||||
/// A row clicked with these modifiers (resolved once every row is listed).
|
||||
click: Option<(NodeId, egui::Modifiers)>,
|
||||
/// A target circle clicked with these modifiers (resolved once every row is listed).
|
||||
target_click: Option<(NodeId, egui::Modifiers)>,
|
||||
/// The column drag after this frame (`Some(None)`: it ended).
|
||||
column: Option<Option<ColumnDrag>>,
|
||||
/// Rows to open or close, and whether to open them.
|
||||
@@ -220,6 +225,8 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
ui.data_mut(|d| {
|
||||
if before.is_some() {
|
||||
d.remove::<(u64, String)>(rename_id());
|
||||
// So is the target circles' Shift-click anchor: it could name another row here.
|
||||
d.remove::<NodeId>(key("target-anchor"));
|
||||
}
|
||||
d.insert_temp(shown_doc, st.uid);
|
||||
});
|
||||
@@ -368,6 +375,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
});
|
||||
let list_rect = scrolled.inner.inner_rect;
|
||||
resolve_click(ui, &view, &list, &mut out);
|
||||
resolve_target_click(ui, &view, &list, &mut out);
|
||||
if let Some(st) = app.session.active_mut() {
|
||||
for (id, open) in out.toggle.drain(..) {
|
||||
st.layers_open.set(id, open);
|
||||
|
||||
@@ -110,6 +110,29 @@ pub(super) fn resolve_click(ui: &Ui, view: &View, list: &[Row], out: &mut Out) {
|
||||
});
|
||||
}
|
||||
|
||||
/// Resolve the target circle clicked this frame by the rules of a row name click
|
||||
/// ([`widgets::row_click`], #8639): plain targets it, Ctrl/Cmd adds it to the selection or takes
|
||||
/// it out, Shift selects the art of every row from the last circle clicked (else the targeted row)
|
||||
/// to it, and Shift+Ctrl/Cmd adds that art to the selection.
|
||||
pub(super) fn resolve_target_click(ui: &Ui, view: &View, list: &[Row], out: &mut Out) {
|
||||
let Some((id, m)) = out.target_click.take() else { return };
|
||||
let anchor = ui.data(|d| d.get_temp::<NodeId>(key("target-anchor"))).or(view.target);
|
||||
let order: Vec<NodeId> = list.iter().map(|r| r.node.id).collect();
|
||||
// The circles have no highlighted rows of their own: a range starts only at the anchor.
|
||||
let click = widgets::row_click(&order, &[], anchor, id, m);
|
||||
if click.moves_anchor() {
|
||||
ui.data_mut(|d| d.insert_temp(key("target-anchor"), id));
|
||||
}
|
||||
let ids = |rows: &[NodeId]| rows.iter().map(|r| r.0).collect::<Vec<_>>();
|
||||
let params = match click {
|
||||
widgets::RowClick::Only(id) => json!({"id": id.0}),
|
||||
widgets::RowClick::Toggle(id) => json!({"id": id.0, "add": true}),
|
||||
widgets::RowClick::Range(rows) => json!({"range": ids(&rows)}),
|
||||
widgets::RowClick::AddRange(rows) => json!({"range": ids(&rows), "add": true}),
|
||||
};
|
||||
out.actions.push(("layer.target".into(), params));
|
||||
}
|
||||
|
||||
/// Whether row `n` can take `drag` (the rows or objects `moving`) inside it. A group or an
|
||||
/// Intertwine group takes objects; an Intertwine group, or a group in one, only objects that can
|
||||
/// be intertwined.
|
||||
@@ -515,7 +538,7 @@ pub(super) fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) {
|
||||
let m = ui.input(|i| i.modifiers);
|
||||
let on_name = ui.input(|i| i.pointer.interact_pos()).is_some_and(|p| p.x <= name_end.max(name_rect.left() + 20.0) && p.x >= name_rect.left());
|
||||
if tresp.clicked() {
|
||||
out.actions.push(("layer.target".into(), json!({"id": n.id.0, "add": m.shift})));
|
||||
out.target_click = Some((n.id, m));
|
||||
} else if sq_resp.clicked() {
|
||||
out.actions.push(("layer.selectAll".into(), json!({"id": n.id.0, "add": m.shift})));
|
||||
} else if resp.clicked() {
|
||||
|
||||
@@ -400,15 +400,76 @@ fn clicking_a_target_circle_targets_the_layer() {
|
||||
}
|
||||
let st = app.session.active().unwrap();
|
||||
assert_eq!((st.selection.target, st.selection.objects.clone()), (Some(a), vec![a]));
|
||||
// Shift-clicking another object's circle adds it to the selection (#901), and again takes
|
||||
// it out; nothing is targeted meanwhile.
|
||||
click_with(&mut app, &ctx, c[1], egui::Modifiers::SHIFT);
|
||||
// Ctrl/Cmd-clicking another object's circle adds it to the selection, as Ctrl/Cmd-clicking a
|
||||
// name adds the row (#901, #8639), and again takes it out; nothing is targeted meanwhile.
|
||||
click_with(&mut app, &ctx, c[1], egui::Modifiers::COMMAND);
|
||||
let st = app.session.active().unwrap();
|
||||
assert_eq!((st.selection.target, st.selection.objects.clone()), (None, vec![a, b]));
|
||||
click_with(&mut app, &ctx, c[1], egui::Modifiers::SHIFT);
|
||||
click_with(&mut app, &ctx, c[1], egui::Modifiers::COMMAND);
|
||||
assert_eq!(app.session.active().unwrap().selection.objects, vec![a]);
|
||||
}
|
||||
|
||||
/// Shift-clicking a target circle selects the art of every row from the last circle clicked to
|
||||
/// it, as Shift-clicking a name highlights a range of rows (#8639); Shift+Ctrl/Cmd adds a range to
|
||||
/// the selection. Nothing is targeted, and hidden art in the range is left out.
|
||||
#[test]
|
||||
fn shift_clicking_a_target_circle_selects_a_range_of_rows() {
|
||||
let (mut app, _, [a, b]) = two_rects();
|
||||
let run = |app: &mut VectorcraftApp, id: &str, p: serde_json::Value| app.session.execute(id, &p).unwrap();
|
||||
let c3 = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 0, "width": 50, "height": 50}))["id"].as_u64().unwrap());
|
||||
let d = NodeId(run(&mut app, "shape.rectangle", json!({"x": 0, "y": 60, "width": 50, "height": 50}))["id"].as_u64().unwrap());
|
||||
run(&mut app, "select.none", json!({}));
|
||||
let ctx = egui::Context::default();
|
||||
// Rows top down: the layer, d, c3, b, a.
|
||||
let (c, _) = frame(&mut app, &ctx, vec![], false);
|
||||
assert_eq!(c.len(), 5);
|
||||
let selected = |app: &VectorcraftApp| {
|
||||
let st = app.session.active().unwrap();
|
||||
let mut ids = st.selection.objects.clone();
|
||||
ids.sort();
|
||||
(st.selection.target, ids)
|
||||
};
|
||||
// From c3 down to a: b in between is selected too.
|
||||
click_with(&mut app, &ctx, c[2], egui::Modifiers::NONE);
|
||||
assert_eq!(selected(&app), (Some(c3), vec![c3]));
|
||||
click_with(&mut app, &ctx, c[4], egui::Modifiers::SHIFT);
|
||||
assert_eq!(selected(&app), (None, vec![a, b, c3]));
|
||||
// A Shift range starts at the last circle clicked, not at the end of the last range.
|
||||
click_with(&mut app, &ctx, c[3], egui::Modifiers::SHIFT);
|
||||
assert_eq!(selected(&app), (None, vec![b, c3]));
|
||||
// Shift+Ctrl/Cmd adds a range: from c3 up to d.
|
||||
click_with(&mut app, &ctx, c[1], egui::Modifiers::SHIFT | egui::Modifiers::COMMAND);
|
||||
assert_eq!(selected(&app), (None, vec![b, c3, d]));
|
||||
// Hidden art in a range stays unselected.
|
||||
run(&mut app, "select.set", json!({"ids": [b.0]}));
|
||||
run(&mut app, "object.hide", json!({}));
|
||||
click_with(&mut app, &ctx, c[2], egui::Modifiers::NONE);
|
||||
click_with(&mut app, &ctx, c[4], egui::Modifiers::SHIFT);
|
||||
assert_eq!(selected(&app), (None, vec![a, c3]));
|
||||
}
|
||||
|
||||
/// The Shift-click anchor of the target circles belongs to the document it was clicked in: node
|
||||
/// ids are per document, so in another document a Shift-click with no circle clicked there yet
|
||||
/// targets only its own row, never a range from a row that has the old anchor's id.
|
||||
#[test]
|
||||
fn the_target_circle_anchor_does_not_carry_over_to_another_document() {
|
||||
let (mut app, _, [a, _]) = two_rects();
|
||||
let ctx = egui::Context::default();
|
||||
let (c, _) = frame(&mut app, &ctx, vec![], false);
|
||||
// Rows top down: the layer, b, a. The anchor is a.
|
||||
click_with(&mut app, &ctx, c[2], egui::Modifiers::NONE);
|
||||
let run = |app: &mut VectorcraftApp, id: &str, p: serde_json::Value| app.session.execute(id, &p).unwrap();
|
||||
run(&mut app, "file.new", json!({"width": 200, "height": 200}));
|
||||
let a2 = NodeId(run(&mut app, "shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50}))["id"].as_u64().unwrap());
|
||||
let b2 = NodeId(run(&mut app, "shape.rectangle", json!({"x": 60, "y": 0, "width": 50, "height": 50}))["id"].as_u64().unwrap());
|
||||
run(&mut app, "select.none", json!({}));
|
||||
assert_eq!(a2, a, "the new document reuses the old anchor's id, so a stale anchor would find a row");
|
||||
let (c, _) = frame(&mut app, &ctx, vec![], false);
|
||||
click_with(&mut app, &ctx, c[1], egui::Modifiers::SHIFT);
|
||||
let st = app.session.active().unwrap();
|
||||
assert_eq!((st.selection.target, st.selection.objects.clone()), (Some(b2), vec![b2]));
|
||||
}
|
||||
|
||||
/// The rows whose target circle shows as targeted (its inner ring drawn), as indexes into the
|
||||
/// circles [`frame`] returns.
|
||||
fn targeted_rows(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec<usize> {
|
||||
|
||||
@@ -69,6 +69,14 @@ pub(super) fn click(ctx: &egui::Context, app: &mut VectorcraftApp, pos: egui::Po
|
||||
}
|
||||
}
|
||||
|
||||
/// Right-click at `pos` over three frames of `f` (hover, press, release).
|
||||
pub(super) fn right_click(ctx: &egui::Context, app: &mut VectorcraftApp, pos: egui::Pos2, mut f: impl FnMut(&mut VectorcraftApp, &mut egui::Ui)) {
|
||||
let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Secondary, pressed, modifiers: Default::default() };
|
||||
for e in [egui::Event::PointerMoved(pos), button(true), button(false)] {
|
||||
frame_events(ctx, app, vec![e], &mut f);
|
||||
}
|
||||
}
|
||||
|
||||
/// The rect of the first drawn text equal to `s`.
|
||||
pub(super) fn text_rect(texts: &[(String, egui::Rect)], s: &str) -> egui::Rect {
|
||||
texts.iter().find(|(t, _)| t == s).unwrap_or_else(|| panic!("`{s}` not drawn: {texts:?}")).1
|
||||
@@ -2110,3 +2118,191 @@ fn panels_show_the_selected_object_after_an_edit_and_after_undo() {
|
||||
run(&mut app, "edit.undo", json!({}));
|
||||
shows(&mut app, "60%", "35%");
|
||||
}
|
||||
|
||||
/// Right-clicking a stroke row selects it and exposes the context menu.
|
||||
#[test]
|
||||
fn right_clicking_a_stroke_row_selects_it_and_exposes_context_menu() {
|
||||
let mut app = app_with_rect();
|
||||
let ctx = egui::Context::default();
|
||||
assert_eq!(app.session.appearance_item(), None);
|
||||
let stroke = row_point(&ctx, &mut app, "Stroke:", 0);
|
||||
right_click(&ctx, &mut app, stroke, appearance::show);
|
||||
assert_eq!(app.session.appearance_item(), Some(1), "right-clicking stroke row selected it");
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(texts.iter().any(|(t, _)| t == " Duplicate Stroke"), "menu has Duplicate Stroke: {texts:?}");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Delete Stroke"), "menu has Delete Stroke: {texts:?}");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Hide Stroke"), "menu has Hide Stroke: {texts:?}");
|
||||
}
|
||||
|
||||
/// Clicking "Duplicate Stroke" duplicates the stroke in one undo step.
|
||||
#[test]
|
||||
fn clicking_duplicate_stroke_duplicates_the_stroke_with_one_undo_step() {
|
||||
let mut app = app_with_rect();
|
||||
let ctx = egui::Context::default();
|
||||
assert_eq!(stack_items(&app), [(true, None), (false, Some(1.0))]);
|
||||
let stroke = row_point(&ctx, &mut app, "Stroke:", 0);
|
||||
right_click(&ctx, &mut app, stroke, appearance::show);
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
let dup = text_rect(&texts, " Duplicate Stroke").center();
|
||||
click(&ctx, &mut app, dup, appearance::show);
|
||||
let items = stack_items(&app);
|
||||
assert_eq!(items.len(), 3, "now 3 items: {items:?}");
|
||||
assert_eq!(items.iter().filter(|(f, _)| !*f).count(), 2, "now 2 strokes: {items:?}");
|
||||
run(&mut app, "edit.undo", json!({}));
|
||||
assert_eq!(stack_items(&app), [(true, None), (false, Some(1.0))], "undo restored original appearance stack");
|
||||
}
|
||||
|
||||
/// Clicking "Delete Effect" removes the effect from the object's appearance.
|
||||
#[test]
|
||||
fn clicking_delete_effect_removes_the_effect_from_appearance() {
|
||||
let mut app = app_with_rect();
|
||||
run(&mut app, "effect.apply", json!({"effect": "stylize.dropShadow"}));
|
||||
assert_eq!(object_effects(&app), ["stylize.dropShadow"]);
|
||||
let ctx = egui::Context::default();
|
||||
let shadow = row_point(&ctx, &mut app, "Drop Shadow", 0);
|
||||
right_click(&ctx, &mut app, shadow, appearance::show);
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(texts.iter().any(|(t, _)| t == " Edit Effect…"), "menu has Edit Effect…");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Duplicate Effect"), "menu has Duplicate Effect");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Delete Effect"), "menu has Delete Effect");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Hide Effect"), "menu has Hide Effect");
|
||||
let del = text_rect(&texts, " Delete Effect").center();
|
||||
click(&ctx, &mut app, del, appearance::show);
|
||||
assert!(object_effects(&app).is_empty(), "effect removed from appearance: {:?}", object_effects(&app));
|
||||
run(&mut app, "edit.undo", json!({}));
|
||||
assert_eq!(object_effects(&app), ["stylize.dropShadow"], "undo restored effect");
|
||||
}
|
||||
|
||||
/// Right-clicking the root object row exposes Clear Appearance and Reduce to Basic Appearance.
|
||||
#[test]
|
||||
fn right_clicking_root_object_row_exposes_clear_and_reduce_appearance() {
|
||||
let mut app = app_with_rect();
|
||||
let ctx = egui::Context::default();
|
||||
appearance::select_row(&mut app, &ctx, appearance::Sel::Item(1));
|
||||
assert_eq!(app.session.appearance_item(), Some(1));
|
||||
let root = row_point(&ctx, &mut app, "Rectangle", 0);
|
||||
right_click(&ctx, &mut app, root, appearance::show);
|
||||
assert_eq!(app.session.appearance_item(), None, "selecting root resets item selection");
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(texts.iter().any(|(t, _)| t == " Clear Appearance"), "menu has Clear Appearance: {texts:?}");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Reduce to Basic Appearance"), "menu has Reduce to Basic Appearance: {texts:?}");
|
||||
let clear = text_rect(&texts, " Clear Appearance").center();
|
||||
click(&ctx, &mut app, clear, appearance::show);
|
||||
assert_eq!(
|
||||
first_selected(&app).unwrap().appearance,
|
||||
vectorcraft_doc::Appearance::basic(vectorcraft_color::Paint::None, vectorcraft_color::Paint::None, 1.0)
|
||||
);
|
||||
// One undo step restores original appearance.
|
||||
run(&mut app, "edit.undo", json!({}));
|
||||
assert_ne!(
|
||||
first_selected(&app).unwrap().appearance,
|
||||
vectorcraft_doc::Appearance::basic(vectorcraft_color::Paint::None, vectorcraft_color::Paint::None, 1.0)
|
||||
);
|
||||
}
|
||||
|
||||
/// Right-clicking directly on a row's label link (text rectangle) selects that row and opens the context menu.
|
||||
#[test]
|
||||
fn right_clicking_item_and_effect_labels_directly_selects_row_and_opens_menu() {
|
||||
let mut app = app_with_rect();
|
||||
run(&mut app, "effect.apply", json!({"effect": "stylize.dropShadow"}));
|
||||
let ctx = egui::Context::default();
|
||||
assert_eq!(app.session.appearance_item(), None);
|
||||
|
||||
// Right-click directly on the "Stroke:" label rect.
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
let stroke_label = text_rect(&texts, "Stroke:").center();
|
||||
right_click(&ctx, &mut app, stroke_label, appearance::show);
|
||||
assert_eq!(app.session.appearance_item(), Some(1), "right-clicking stroke label selected the stroke row");
|
||||
let menu_texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(menu_texts.iter().any(|(t, _)| t == " Duplicate Stroke"), "menu contains Duplicate Stroke: {menu_texts:?}");
|
||||
|
||||
// Dismiss popup.
|
||||
let _ = frame_events(
|
||||
&ctx,
|
||||
&mut app,
|
||||
vec![egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }],
|
||||
appearance::show,
|
||||
);
|
||||
|
||||
// Right-click directly on the "Drop Shadow" effect label rect.
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
let effect_label = text_rect(&texts, "Drop Shadow").center();
|
||||
right_click(&ctx, &mut app, effect_label, appearance::show);
|
||||
let menu_texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(menu_texts.iter().any(|(t, _)| t == " Duplicate Effect"), "menu contains Duplicate Effect: {menu_texts:?}");
|
||||
assert!(menu_texts.iter().any(|(t, _)| t == " Edit Effect…"), "menu contains Edit Effect…: {menu_texts:?}");
|
||||
}
|
||||
|
||||
/// Reduce to Basic Appearance is enabled when any selected subject needs reduction.
|
||||
#[test]
|
||||
fn reduce_to_basic_enabled_when_any_selected_subject_needs_reduction() {
|
||||
let mut app = app_with_rect();
|
||||
let rect1 = first_selected(&app).unwrap().id.0;
|
||||
// Create second rect and add an extra stroke to it so it is non-basic.
|
||||
let rect2 = run(&mut app, "shape.rectangle", json!({"x": 100, "y": 100, "width": 50, "height": 50}))["id"].as_u64().unwrap();
|
||||
run(&mut app, "appearance.addStroke", json!({}));
|
||||
|
||||
// Select only rect1 (which is basic).
|
||||
run(&mut app, "select.set", json!({"ids": [rect1]}));
|
||||
let ctx = drop_ctx();
|
||||
let root = row_point(&ctx, &mut app, "Rectangle", 0);
|
||||
right_click(&ctx, &mut app, root, appearance::show);
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| appearance::show(&mut app, ui));
|
||||
out.textures_delta.clear();
|
||||
let is_disabled = out
|
||||
.platform_output
|
||||
.accesskit_update
|
||||
.as_ref()
|
||||
.and_then(|u| u.nodes.iter().find(|(_, n)| n.label().is_some_and(|l| l.contains("Reduce to Basic Appearance"))))
|
||||
.is_some_and(|(_, n)| n.is_disabled());
|
||||
assert!(is_disabled, "Reduce to Basic Appearance is disabled when all selected subjects are basic");
|
||||
// Dismiss the menu with Escape.
|
||||
let _ = frame_events(
|
||||
&ctx,
|
||||
&mut app,
|
||||
vec![egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }],
|
||||
appearance::show,
|
||||
);
|
||||
|
||||
// Select both rect1 (basic) and rect2 (non-basic). Both are rectangles so object_label is "Rectangle".
|
||||
run(&mut app, "select.set", json!({"ids": [rect1, rect2]}));
|
||||
let root = row_point(&ctx, &mut app, "Rectangle", 0);
|
||||
right_click(&ctx, &mut app, root, appearance::show);
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(texts.iter().any(|(t, _)| t == " Reduce to Basic Appearance"), "Reduce to Basic Appearance is present: {texts:?}");
|
||||
let reduce = text_rect(&texts, " Reduce to Basic Appearance").center();
|
||||
click(&ctx, &mut app, reduce, appearance::show);
|
||||
|
||||
// Both rectangles should now have basic appearance.
|
||||
let doc = &app.session.active().unwrap().doc;
|
||||
assert!(doc.node(vectorcraft_doc::NodeId(rect1)).unwrap().appearance.is_basic(), "rect1 reduced to basic");
|
||||
assert!(doc.node(vectorcraft_doc::NodeId(rect2)).unwrap().appearance.is_basic(), "rect2 reduced to basic");
|
||||
}
|
||||
|
||||
/// Right-clicking an active multi-selection of appearance items shows plural "Duplicate Items" and "Delete Items".
|
||||
#[test]
|
||||
fn right_clicking_multi_selected_items_shows_plural_duplicate_and_delete() {
|
||||
let mut app = app_with_rect();
|
||||
let ctx = egui::Context::default();
|
||||
frame_in(&ctx, &mut app, appearance::show);
|
||||
|
||||
let stroke = row_point(&ctx, &mut app, "Stroke:", 0);
|
||||
let fill = row_point(&ctx, &mut app, "Fill:", 0);
|
||||
|
||||
// Multi-select both stroke (item 1) and fill (item 0) using Command-click.
|
||||
click_mod(&ctx, &mut app, stroke, egui::Modifiers::NONE);
|
||||
click_mod(&ctx, &mut app, fill, egui::Modifiers::COMMAND);
|
||||
|
||||
right_click(&ctx, &mut app, stroke, appearance::show);
|
||||
let texts = frame_events(&ctx, &mut app, vec![], appearance::show);
|
||||
assert!(texts.iter().any(|(t, _)| t == " Duplicate Items"), "shows Duplicate Items: {texts:?}");
|
||||
assert!(texts.iter().any(|(t, _)| t == " Delete Items"), "shows Delete Items: {texts:?}");
|
||||
|
||||
// Clicking Duplicate Items duplicates both items in one undo step.
|
||||
let dup = text_rect(&texts, " Duplicate Items").center();
|
||||
click(&ctx, &mut app, dup, appearance::show);
|
||||
assert_eq!(stack_items(&app).len(), 4, "both items duplicated");
|
||||
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(stack_items(&app).len(), 2, "undo restores 2 items");
|
||||
}
|
||||
|
||||
+6
-1
File diff suppressed because one or more lines are too long
+4
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -70,6 +70,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-20 | minor | G12: Appearance panel row context menus (Duplicate Stroke/Fill, Delete Stroke/Fill, Hide/Show Stroke/Fill, Edit Effect…, Duplicate Effect, Delete Effect, Hide/Show Effect, Clear Appearance, Reduce to Basic Appearance); right-clicking an unselected row targets that row first. Headless regressions: `panels::tests_appearance`. Scores and estimates unchanged. |
|
||||
| 2026-11-19 | minor | G12: Character Styles and Paragraph Styles panels item context menus (Options…, Duplicate, Delete, Redefine, Clear Overrides); regression tests in crates/ui-egui/src/panels/text_styles/tests.rs; scores and estimates unchanged. |
|
||||
| 2026-11-19 | minor | G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s (part of #5930, `file.cancelPlace`); indeterminate moving bar, Cancel (Esc) leaves the document unmodified without undo steps; scores and estimates unchanged. |
|
||||
| 2026-11-18 | minor | Layers panel: right-clicking a ruler guide row or a blend spine row shows its context menu (#8592): Hide/Show, Lock/Unlock, Release Guides, Delete and Locate Object on guide rows; Select, Blend Options…, Reverse Spine, Reverse Front to Back, Expand, Release and Locate Object on blend spine rows. Scores unchanged. |
|
||||
@@ -513,6 +514,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Layers panel row context menu | done | Right-clicking a layer/group/object row shows a context menu with Options…, Duplicate, Delete, Lock/Hide Others, Locate Object, and Collect for Export; right-clicking a ruler guide row shows Hide/Show, Lock/Unlock, Release Guides, Delete and Locate Object; right-clicking a blend spine row shows Select, Blend Options…, Reverse Spine, Reverse Front to Back, Expand, Release and Locate Object (#8592). |
|
||||
| Swatches item context menu (G12) | done | List and thumbnail items offer Swatch Options…, Duplicate Swatch and Delete Swatch for the clicked item. Right-click selects without applying paint; reserved/missing items disable actions. All 39 Swatches tests pass, including all five views and Undo; the regression fails with the menu hooks removed. Rendered headless menus inspected. Full workspace CI passed on Linux/WSL on the merged branch (all 13 gates), including the test-helper correction for the upstream compile error tracked in #7727; native Windows full CI has two unchanged engine-test failures. |
|
||||
| Links panel row context menu (G12) | done | Right-clicking a link row presents an item context menu offering Relink…, Go To Link, Update Link, Edit Original, Show in Folder, and Embed Image / Unembed…; right-clicking an unselected row selects it first, preserving selection if already part of a multi-selection. Tests: `panels::tests_links::right_click_context_menu_in_links_panel`. |
|
||||
| Appearance panel row context menu (G12) | done | Right-clicking a stroke or fill row offers Duplicate Stroke / Duplicate Fill, Delete Stroke / Delete Fill, and Hide/Show Stroke / Fill; effect rows offer Edit Effect…, Duplicate Effect, Delete Effect, and Hide/Show Effect; root object row offers Clear Appearance and Reduce to Basic Appearance. Right-clicking an unselected row targets it first before opening the context menu. Tests: `panels::tests_appearance::right_clicking_a_stroke_row_selects_it_and_exposes_context_menu`, `panels::tests_appearance::clicking_duplicate_stroke_duplicates_the_stroke_with_one_undo_step`, `panels::tests_appearance::clicking_delete_effect_removes_the_effect_from_appearance`, `panels::tests_appearance::right_clicking_root_object_row_exposes_clear_and_reduce_appearance`. |
|
||||
| SVG Interactivity panel: JavaScript for each object's events and the document's linked JavaScript files, written to SVG and read back as text | done | `svgInteractivity.*`, `ui.javascriptFilesDialog` |
|
||||
| Retype panel | partial | Window › Retype lists the fonts whose glyphs exactly match at least one selected outlined shape, ranked by how many shapes each matches, ten and then five more, with samples in three sizes and the user's own text; a click sets the font on selected live type (`retype.find`, `type.retypeFonts`). Opening it from the Type menu, the context menu, and the Properties panel for outlined shapes (the Properties panel Quick Action opens it for text selections only), filtering by font source and favorites, near matches, installed fonts not yet loaded and text in images are missing (#4934) |
|
||||
| Comments, Version History panels | missing | cloud features (out of scope) |
|
||||
@@ -627,6 +629,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-20 | minor | G12: Appearance panel row context menus (Duplicate Stroke/Fill, Delete Stroke/Fill, Hide/Show Stroke/Fill, Edit Effect…, Duplicate Effect, Delete Effect, Hide/Show Effect, Clear Appearance, Reduce to Basic Appearance); right-clicking an unselected row targets that row first. Headless regressions: `panels::tests_appearance`. Scores and estimates unchanged. |
|
||||
| 2026-11-19 | minor | Layers: a target circle whose item is targeted and has an appearance of its own keeps its inner ring visible, with a smaller appearance dot inside it and a gap between them, so not targeted, targeted, with an appearance and both look different, as the target icons in [Appearance attributes](https://helpx.adobe.com/illustrator/using/appearance-attributes.html) (Targeting items for appearance attributes) do. Before, the dot covered the ring and a targeted item with an appearance looked untargeted, #8711. Scores and estimates unchanged. |
|
||||
| 2026-11-19 | minor | View › 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 until it is off; the choices come back as they were and the rulers stay, though dragging or double-clicking them makes no guide meanwhile (#8363). Scores and estimates unchanged. |
|
||||
| 2026-11-19 | minor | Scissors previews its actual anchor or curve cut point with a native point marker while hovering, retaining existing snapping, Alt Add Anchor and cut behavior (#8655). Scores and estimates unchanged. |
|
||||
|
||||
Reference in New Issue
Block a user