mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 23:58:03 +00:00
Color Wheel: contrast follows isolated groups, lower rows and drags
- color.contrast carries out the alpha of an isolated level's own composite, so an isolating object in a blending group matches the canvas. - A selection whose translucent or blending rows lie over different shown rows below them has no one answer; rows with no paint do not count. - The error names `opacity` when giving it settles the difference. - The Color Wheel reads the background again when a drag moves the selection. - RatioKey has named fields. - docs: graphics has an AA result only.
This commit is contained in:
@@ -1094,7 +1094,9 @@ fn contrast(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
} else {
|
||||
(std::array::from_fn(|i| ((x.0[i] * x.1 - (1.0 - alone) * backdrop.0[i] * backdrop.1) / alone).clamp(0.0, 1.0)), alone)
|
||||
};
|
||||
let drawn = alone * step.opacity.clamp(0.0, 1.0);
|
||||
// A level that isolates its blending carries out the alpha of what it holds composited on
|
||||
// its own.
|
||||
let drawn = if step.isolate { x.1 } else { alone } * step.opacity.clamp(0.0, 1.0);
|
||||
x = composite(step.blend, source, step.opacity, backdrop);
|
||||
alone = drawn + inner * (1.0 - drawn);
|
||||
}
|
||||
@@ -1157,11 +1159,13 @@ struct Drawn {
|
||||
blend: BlendMode,
|
||||
isolate: bool,
|
||||
around: Vec<Level>,
|
||||
/// The object's shown fill and stroke rows with paint below the row, which the row draws over.
|
||||
lower: Vec<vectorcraft_doc::AppearanceItem>,
|
||||
}
|
||||
|
||||
impl Default for Drawn {
|
||||
fn default() -> Self {
|
||||
Self { opacity: 1.0, row: None, blend: BlendMode::Normal, isolate: false, around: vec![] }
|
||||
Self { opacity: 1.0, row: None, blend: BlendMode::Normal, isolate: false, around: vec![], lower: vec![] }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1194,7 +1198,8 @@ fn composite(mode: BlendMode, x: ([f32; 3], f32), opacity: f32, backdrop: ([f32;
|
||||
/// `given_opacity` (which takes the place of their opacities) the same opacities. With `below`, the
|
||||
/// levels that change what they draw must be the same objects too, since the art below each one is
|
||||
/// read with that object hidden, and the object's opacity must be the same apart from its row's,
|
||||
/// since the row draws over the object's rows below it and the object over the art behind it.
|
||||
/// since the row draws over the object's rows below it and the object over the art behind it, and a
|
||||
/// row that blends or is translucent must lie over the same shown rows.
|
||||
fn draws_alike(a: &Drawn, b: &Drawn, given_opacity: bool, below: bool) -> bool {
|
||||
let counts = |l: &&Level| l.blend != BlendMode::Normal || l.isolate || (!given_opacity && l.opacity < 1.0);
|
||||
let level = |x: &Level, y: &Level| {
|
||||
@@ -1208,7 +1213,10 @@ fn draws_alike(a: &Drawn, b: &Drawn, given_opacity: bool, below: bool) -> bool {
|
||||
// changes a row's blending.
|
||||
let row = |d: &Drawn| d.row.map(|r| r.0).filter(|m| *m != BlendMode::Normal);
|
||||
let total = |d: &Drawn| d.opacity * d.row.map_or(1.0, |r| r.1);
|
||||
// A row that blends or lets art through draws over the rows below it, read at one point.
|
||||
let over_rows = |d: &Drawn| d.row.is_some_and(|(m, o)| m != BlendMode::Normal || o < 1.0);
|
||||
row(a) == row(b)
|
||||
&& (given_opacity || !below || !(over_rows(a) || over_rows(b)) || a.lower == b.lower)
|
||||
&& a.blend == b.blend
|
||||
&& (row(a).is_none() || a.isolate == b.isolate)
|
||||
&& (given_opacity || (total(a) - total(b)).abs() < 1e-6)
|
||||
@@ -1268,6 +1276,11 @@ fn proxy_color(s: &Session, given_opacity: bool, below: bool) -> std::result::Re
|
||||
None => source()?.unwrap_or_default(),
|
||||
};
|
||||
if !drawn.iter().all(|d| draws_alike(d, &drawing, given_opacity, below)) {
|
||||
// With `opacity` given, the opacities are not compared and the background stands for the
|
||||
// art below.
|
||||
if !given_opacity && drawn.iter().all(|d| draws_alike(d, &drawing, true, below)) {
|
||||
return Err("the selected objects' colors differ: give `opacity` or `color`".into());
|
||||
}
|
||||
return Err("the selected objects' colors differ: give `color`".into());
|
||||
}
|
||||
} else {
|
||||
@@ -1341,7 +1354,14 @@ fn drawn_settings(s: &Session, n: &Node, item: Option<usize>, stroke: bool) -> s
|
||||
if masked(n) || around.iter().any(|l| l.masked) {
|
||||
return Err("the active fill or stroke is drawn through an opacity mask: give `color`".to_string());
|
||||
}
|
||||
Ok(Drawn { opacity: n.opacity, row: own.map(|o| (o.1, o.0)), blend: n.blend, isolate: n.isolate, around })
|
||||
// The rows below the row that draw, as `hide_rows` leaves them shown.
|
||||
let rows = &n.appearance.items;
|
||||
let at_row = item.or_else(|| rows.iter().rposition(|r| r.is_fill() != stroke));
|
||||
let lower = match (own, at_row) {
|
||||
(Some(_), Some(i)) => rows.iter().take(i).filter(|r| r.visible() && !r.paint().is_none()).cloned().collect(),
|
||||
_ => vec![],
|
||||
};
|
||||
Ok(Drawn { opacity: n.opacity, row: own.map(|o| (o.1, o.0)), blend: n.blend, isolate: n.isolate, around, lower })
|
||||
}
|
||||
|
||||
/// `color` as the canvas draws the picked object of a dynamic symbol instance that a fill stains
|
||||
|
||||
@@ -294,6 +294,43 @@ fn a_row_in_an_isolating_object_blends_with_the_rows_below_it() {
|
||||
assert!((ratio(&r) - drawn).abs() < 0.02, "{r} against {drawn}");
|
||||
}
|
||||
|
||||
/// An object that isolates its blending, in a Screen group over black: a 50 % white fill over an
|
||||
/// opaque white one composites to opaque white inside the object, so the group screens opaque
|
||||
/// white. With the lower fill removed, the object holds the white at 50 %.
|
||||
#[test]
|
||||
fn an_isolating_object_in_a_blending_group_carries_the_alpha_of_its_composite() {
|
||||
let mut s = session();
|
||||
let id = |v: Value| vectorcraft_doc::NodeId(v["id"].as_u64().unwrap());
|
||||
s.execute("shape.rectangle", &json!({"x": 20, "y": 20, "width": 160, "height": 160})).unwrap();
|
||||
s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap();
|
||||
s.execute("object.lock", &json!({})).unwrap();
|
||||
let square = id(s.execute("shape.rectangle", &json!({"x": 50, "y": 50, "width": 100, "height": 100})).unwrap());
|
||||
s.execute("paint.setFill", &json!({"color": "#ffffff"})).unwrap();
|
||||
s.execute("appearance.addFill", &json!({})).unwrap();
|
||||
let st = s.active().unwrap();
|
||||
let items = &st.doc.node(square).unwrap().appearance.items;
|
||||
let top = items.iter().rposition(|i| matches!(i, vectorcraft_doc::AppearanceItem::Fill(_))).unwrap();
|
||||
let lower = items.iter().position(|i| matches!(i, vectorcraft_doc::AppearanceItem::Fill(_))).unwrap();
|
||||
s.execute("appearance.setItem", &json!({"index": top, "color": "#ffffff", "opacity": 50})).unwrap();
|
||||
s.execute("appearance.setActiveItem", &json!({"index": null})).unwrap();
|
||||
s.execute("transparency.set", &json!({"item": null, "isolate": true})).unwrap();
|
||||
s.execute("object.group", &json!({})).unwrap();
|
||||
s.execute("transparency.set", &json!({"blend": "screen"})).unwrap();
|
||||
s.active_mut().unwrap().selection.objects = vec![square];
|
||||
let r = s.execute("color.contrast", &json!({})).unwrap();
|
||||
let (p, drawn) = canvas_ratio(&s, &r);
|
||||
assert!(p[0] > 252 && p[1] > 252 && p[2] > 252, "the canvas draws white: {p:?}");
|
||||
assert!((ratio(&r) - drawn).abs() < 0.02, "{r} against {drawn}");
|
||||
assert_eq!(r["normalText"], json!({"aa": true, "aaa": true}), "{r}");
|
||||
s.execute("appearance.removeItem", &json!({"index": lower})).unwrap();
|
||||
s.execute("appearance.setActiveItem", &json!({"index": null})).unwrap();
|
||||
let r = s.execute("color.contrast", &json!({})).unwrap();
|
||||
let (p, drawn) = canvas_ratio(&s, &r);
|
||||
assert!((i32::from(p[0]) - 128).abs() < 3, "the canvas draws half gray: {p:?}");
|
||||
// The canvas pixel is rounded to 8 bits, which moves a ratio near half gray by up to 0.04.
|
||||
assert!((ratio(&r) - drawn).abs() < 0.05, "{r} against {drawn}");
|
||||
}
|
||||
|
||||
/// A 50 % white fill over an opaque blue one draws over the blue, not over the red art behind it.
|
||||
#[test]
|
||||
fn a_translucent_row_draws_over_the_rows_below_it() {
|
||||
@@ -386,11 +423,17 @@ fn objects_that_draw_one_color_differently_have_no_one_answer() {
|
||||
s.execute("transparency.set", &json!({"opacity": 50})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
|
||||
let e = s.execute("color.contrast", &json!({"against": "#ffffff"})).unwrap_err().to_string();
|
||||
assert!(e.contains("the selected objects' colors differ: give `color`"), "{e}");
|
||||
assert!(e.contains("the selected objects' colors differ: give `opacity` or `color`"), "{e}");
|
||||
s.execute("color.contrast", &json!({"color": "#000000", "against": "#ffffff"})).unwrap();
|
||||
// A given opacity takes the place of the objects' own.
|
||||
let r = s.execute("color.contrast", &json!({"against": "#ffffff", "opacity": 100})).unwrap();
|
||||
assert!((ratio(&r) - 21.0).abs() < 1e-6, "{r}");
|
||||
// A blend mode that differs is not one a given opacity replaces.
|
||||
s.execute("select.set", &json!({"ids": [b]})).unwrap();
|
||||
s.execute("transparency.set", &json!({"opacity": 100, "blend": "multiply"})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
|
||||
let e = s.execute("color.contrast", &json!({"against": "#ffffff"})).unwrap_err().to_string();
|
||||
assert!(e.contains("the selected objects' colors differ: give `color`"), "{e}");
|
||||
}
|
||||
|
||||
/// A 50 % white row over a blue row in an opaque object draws over the blue; an opaque white row in
|
||||
@@ -412,13 +455,53 @@ fn a_row_and_an_object_of_one_total_opacity_draw_differently_over_the_rows_below
|
||||
s.execute("transparency.set", &json!({"opacity": 50})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
|
||||
let e = s.execute("color.contrast", &json!({})).unwrap_err().to_string();
|
||||
assert!(e.contains("the selected objects' colors differ: give `color`"), "{e}");
|
||||
assert!(e.contains("the selected objects' colors differ: give `opacity` or `color`"), "{e}");
|
||||
// A given background stands for the rows below, so both draw the white at 50 % over it.
|
||||
let r = s.execute("color.contrast", &json!({"against": "#000000"})).unwrap();
|
||||
let gray = vectorcraft_color::wcag::contrast_ratio([0.5; 3], [0.0; 3]);
|
||||
assert!((ratio(&r) - gray).abs() < 1e-3, "{r}");
|
||||
}
|
||||
|
||||
/// Two squares with the same 50 % white top fill, one over an opaque black fill and one over an
|
||||
/// opaque white one, draw the white over different rows: no one answer. Over the same lower fill
|
||||
/// they leave one answer, also when one of them has a lower row with no paint.
|
||||
#[test]
|
||||
fn translucent_rows_over_different_lower_rows_have_no_one_answer() {
|
||||
let mut s = session();
|
||||
let id = |v: Value| v["id"].as_u64().unwrap();
|
||||
let square = |s: &mut Session, x: i32, lower: &str| {
|
||||
let n = id(s.execute("shape.rectangle", &json!({"x": x, "y": 50, "width": 50, "height": 100})).unwrap());
|
||||
s.execute("paint.setFill", &json!({"color": lower})).unwrap();
|
||||
s.execute("appearance.addFill", &json!({})).unwrap();
|
||||
let st = s.active().unwrap();
|
||||
let items = &st.doc.node(vectorcraft_doc::NodeId(n)).unwrap().appearance.items;
|
||||
let top = items.iter().rposition(|i| matches!(i, vectorcraft_doc::AppearanceItem::Fill(_))).unwrap();
|
||||
s.execute("appearance.setItem", &json!({"index": top, "color": "#ffffff", "opacity": 50})).unwrap();
|
||||
s.execute("appearance.setActiveItem", &json!({"index": null})).unwrap();
|
||||
n
|
||||
};
|
||||
let a = square(&mut s, 50, "#000000");
|
||||
let b = square(&mut s, 100, "#ffffff");
|
||||
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
|
||||
let e = s.execute("color.contrast", &json!({})).unwrap_err().to_string();
|
||||
assert!(e.contains("the selected objects' colors differ"), "{e}");
|
||||
let c = square(&mut s, 150, "#000000");
|
||||
s.execute("select.set", &json!({"ids": [a, c]})).unwrap();
|
||||
s.execute("color.contrast", &json!({})).unwrap();
|
||||
// A row with no paint draws nothing, so it does not count among the rows below.
|
||||
s.execute("select.set", &json!({"ids": [c]})).unwrap();
|
||||
s.execute("appearance.addFill", &json!({})).unwrap();
|
||||
let st = s.active().unwrap();
|
||||
let items = &st.doc.node(vectorcraft_doc::NodeId(c)).unwrap().appearance.items;
|
||||
let fills: Vec<usize> = items.iter().enumerate().filter(|(_, i)| i.is_fill()).map(|(k, _)| k).collect();
|
||||
let (middle, top) = (fills[fills.len() - 2], fills[fills.len() - 1]);
|
||||
s.execute("appearance.setItem", &json!({"ids": [c], "index": top, "color": "#ffffff", "opacity": 50})).unwrap();
|
||||
s.execute("appearance.setItem", &json!({"ids": [c], "index": middle, "none": true})).unwrap();
|
||||
s.execute("appearance.setActiveItem", &json!({"index": null})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [a, c]})).unwrap();
|
||||
s.execute("color.contrast", &json!({})).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_selected_group_whose_objects_draw_one_color_differently_has_no_one_answer() {
|
||||
let mut s = session();
|
||||
@@ -434,7 +517,7 @@ fn a_selected_group_whose_objects_draw_one_color_differently_has_no_one_answer()
|
||||
s.execute("transparency.set", &json!({"opacity": 50})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [g]})).unwrap();
|
||||
let e = s.execute("color.contrast", &json!({"against": "#ffffff"})).unwrap_err().to_string();
|
||||
assert!(e.contains("the selected objects' colors differ: give `color`"), "{e}");
|
||||
assert!(e.contains("the selected objects' colors differ: give `opacity` or `color`"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -494,7 +577,7 @@ fn objects_in_two_groups_of_one_opacity_answer_against_a_given_color() {
|
||||
s.execute("color.contrast", &json!({"against": "#ffffff"})).unwrap();
|
||||
// Sampled, each group is hidden in turn to read what is outside it, so the two differ.
|
||||
let e = s.execute("color.contrast", &json!({})).unwrap_err().to_string();
|
||||
assert!(e.contains("the selected objects' colors differ: give `color`"), "{e}");
|
||||
assert!(e.contains("the selected objects' colors differ: give `opacity` or `color`"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -708,7 +791,7 @@ fn a_picked_mesh_point_counts_with_its_own_opacity() {
|
||||
// Both picked: one color at two opacities has no one answer, unless `opacity` is given.
|
||||
pick_points(&mut s, (40.0, 40.0), (160.0, 60.0));
|
||||
let both = s.execute("color.contrast", &json!({})).unwrap_err().to_string();
|
||||
assert!(both.contains("differ"), "{both}");
|
||||
assert!(both.contains("the selected objects' colors differ: give `opacity` or `color`"), "{both}");
|
||||
assert!(s.execute("color.contrast", &json!({"opacity": 100})).is_ok());
|
||||
}
|
||||
|
||||
|
||||
@@ -1495,7 +1495,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"ui.colorWheel",
|
||||
"Color Wheel Options",
|
||||
"",
|
||||
"{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, contrast?: bool, contrastFor?: normalText|largeText|graphics, contrastBackground?: a color, or null, vision?: bool} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, pick the box's channel, as Box Channel does, and set Show Contrast, Contrast For, Contrast Background and Show Color Vision Preview: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); contrast shows a row under the wheel or the box with the background's chip, the WCAG 2 contrast ratio cut off at two decimals and the AA and AAA results for contrastFor, as color.contrast answers them, and contrastBackground pins the background the row measures against (Contrast Background › Current Color; null: the color drawn behind the selection, Behind Selection); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out keep their values, and so do the other keys when null ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel, contrast, contrastFor, contrastBackground, vision}",
|
||||
"{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, contrast?: bool, contrastFor?: normalText|largeText|graphics, contrastBackground?: a color, or null, vision?: bool} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, pick the box's channel, as Box Channel does, and set Show Contrast, Contrast For, Contrast Background and Show Color Vision Preview: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); contrast shows a row under the wheel or the box with the background's chip, the WCAG 2 contrast ratio cut off at two decimals and the AA and AAA results for contrastFor (AA only for graphics), as color.contrast answers them, and contrastBackground pins the background the row measures against (Contrast Background › Current Color; null: the color drawn behind the selection, Behind Selection); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out keep their values, and so do the other keys when null ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel, contrast, contrastFor, contrastBackground, vision}",
|
||||
),
|
||||
(
|
||||
"ui.savePdfDialog",
|
||||
|
||||
@@ -6789,6 +6789,7 @@ liquify-list-end {0}, {1} {0} i {1}
|
||||
@msg nothing selected no hi ha res seleccionat
|
||||
@msg `{key}` must be a color or {_1} `{key}` ha de ser un color o {_1}
|
||||
@msg the selected objects' colors differ: give `color` els colors dels objectes seleccionats són diferents: indiqueu `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` els colors dels objectes seleccionats són diferents: indiqueu `opacity` o `color`
|
||||
@msg the active fill or stroke has no color: give `color` l’emplenament o el traç actiu no té color: indiqueu `color`
|
||||
@msg the active fill or stroke is hidden: give `color` l’emplenament o el traç actiu està ocult: indiqueu `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` l’emplenament o el traç actiu es dibuixa a través d’una màscara d’opacitat: indiqueu `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5653,6 +5653,7 @@ liquify-list-end {0}, {1} {0} a {1}
|
||||
@msg nothing selected nic není vybráno
|
||||
@msg `{key}` must be a color or {_1} `{key}` musí být barva nebo {_1}
|
||||
@msg the selected objects' colors differ: give `color` barvy vybraných objektů se liší: zadejte `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` barvy vybraných objektů se liší: zadejte `opacity` nebo `color`
|
||||
@msg the active fill or stroke has no color: give `color` aktivní výplň nebo tah nemá barvu: zadejte `color`
|
||||
@msg the active fill or stroke is hidden: give `color` aktivní výplň nebo tah je skrytý: zadejte `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` aktivní výplň nebo tah je kreslen přes masku krytí: zadejte `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5250,6 +5250,7 @@ liquify-list-end {0}, {1} {0} und {1}
|
||||
@msg nothing selected nichts ausgewählt
|
||||
@msg `{key}` must be a color or {_1} `{key}` muss eine Farbe oder {_1} sein
|
||||
@msg the selected objects' colors differ: give `color` die Farben der ausgewählten Objekte unterscheiden sich: geben Sie `color` an
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` die Farben der ausgewählten Objekte unterscheiden sich: geben Sie `opacity` oder `color` an
|
||||
@msg the active fill or stroke has no color: give `color` die aktive Fläche oder Kontur hat keine Farbe: geben Sie `color` an
|
||||
@msg the active fill or stroke is hidden: give `color` die aktive Fläche oder Kontur ist ausgeblendet: geben Sie `color` an
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` die aktive Fläche oder Kontur wird durch eine Deckkraftmaske gezeichnet: geben Sie `color` an
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5308,6 +5308,7 @@ digits Malayalam Μαλαγιάλαμ
|
||||
@msg nothing selected δεν έχει επιλεγεί τίποτα
|
||||
@msg `{key}` must be a color or {_1} το `{key}` πρέπει να είναι χρώμα ή {_1}
|
||||
@msg the selected objects' colors differ: give `color` τα χρώματα των επιλεγμένων αντικειμένων διαφέρουν: δώστε `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` τα χρώματα των επιλεγμένων αντικειμένων διαφέρουν: δώστε `opacity` ή `color`
|
||||
@msg the active fill or stroke has no color: give `color` το ενεργό γέμισμα ή η πινελιά δεν έχει χρώμα: δώστε `color`
|
||||
@msg the active fill or stroke is hidden: give `color` το ενεργό γέμισμα ή η πινελιά είναι κρυφό: δώστε `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` το ενεργό γέμισμα ή η πινελιά σχεδιάζεται μέσα από μάσκα αδιαφάνειας: δώστε `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5363,6 +5363,7 @@ liquify-list-end {0}, {1} {0}, {1}
|
||||
@msg nothing selected no hay nada seleccionado
|
||||
@msg `{key}` must be a color or {_1} `{key}` debe ser un color o {_1}
|
||||
@msg the selected objects' colors differ: give `color` los colores de los objetos seleccionados difieren: indique `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` los colores de los objetos seleccionados difieren: indique `opacity` o `color`
|
||||
@msg the active fill or stroke has no color: give `color` el relleno o trazo activo no tiene color: indique `color`
|
||||
@msg the active fill or stroke is hidden: give `color` el relleno o trazo activo está oculto: indique `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` el relleno o trazo activo se dibuja a través de una máscara de opacidad: indique `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5573,6 +5573,7 @@ liquify-list-end {0}, {1} {0} ja {1}
|
||||
@msg nothing selected mitään ei ole valittu
|
||||
@msg `{key}` must be a color or {_1} `{key}` on oltava väri tai {_1}
|
||||
@msg the selected objects' colors differ: give `color` valittujen objektien värit eroavat: anna `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` valittujen objektien värit eroavat: anna `opacity` tai `color`
|
||||
@msg the active fill or stroke has no color: give `color` aktiivisella täytöllä tai viivalla ei ole väriä: anna `color`
|
||||
@msg the active fill or stroke is hidden: give `color` aktiivinen täyttö tai viiva on piilotettu: anna `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` aktiivinen täyttö tai viiva piirretään peittävyysmaskin läpi: anna `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5319,6 +5319,7 @@ liquify-list-end {0}, {1} {0} et {1}
|
||||
@msg nothing encoded rien n’a été encodé
|
||||
@msg nothing selected aucune sélection
|
||||
@msg `{key}` must be a color or {_1} `{key}` doit être une couleur ou {_1}
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` les couleurs des objets sélectionnés diffèrent : indiquez `opacity` ou `color`
|
||||
@msg the selected objects' colors differ: give `color` les couleurs des objets sélectionnés diffèrent : indiquez `color`
|
||||
@msg the active fill or stroke has no color: give `color` le fond ou le contour actif n’a pas de couleur : indiquez `color`
|
||||
@msg the active fill or stroke is hidden: give `color` le fond ou le contour actif est masqué : indiquez `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8417,6 +8417,7 @@ liquify-list-end {0}, {1} {0} और {1}
|
||||
@msg nothing selected कुछ भी नहीं चुना
|
||||
@msg `{key}` must be a color or {_1} `{key}` कोई रंग या {_1} होना चाहिए
|
||||
@msg the selected objects' colors differ: give `color` चुने गए ऑब्जेक्ट्स के रंग अलग-अलग हैं: `color` दें
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` चुने गए ऑब्जेक्ट्स के रंग अलग-अलग हैं: `opacity` या `color` दें
|
||||
@msg the active fill or stroke has no color: give `color` सक्रिय फ़िल या स्ट्रोक में कोई रंग नहीं है: `color` दें
|
||||
@msg the active fill or stroke is hidden: give `color` सक्रिय फ़िल या स्ट्रोक छिपा हुआ है: `color` दें
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` सक्रिय फ़िल या स्ट्रोक ओपेसिटी मास्क से होकर बनाया जाता है: `color` दें
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6036,6 +6036,7 @@ liquify-list-end {0}, {1} {0} és {1}
|
||||
@msg nothing selected nincs kijelölés
|
||||
@msg `{key}` must be a color or {_1} a(z) `{key}` értéke csak szín vagy {_1} lehet
|
||||
@msg the selected objects' colors differ: give `color` a kijelölt objektumok színei eltérnek: adja meg a `color` értékét
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` a kijelölt objektumok színei eltérnek: adja meg az `opacity` vagy a `color` értékét
|
||||
@msg the active fill or stroke has no color: give `color` az aktív kitöltésnek vagy körvonalnak nincs színe: adja meg a `color` értékét
|
||||
@msg the active fill or stroke is hidden: give `color` az aktív kitöltés vagy körvonal rejtett: adja meg a `color` értékét
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` az aktív kitöltés vagy körvonal átlátszósági maszkon keresztül rajzolódik: adja meg a `color` értékét
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5387,6 +5387,7 @@ liquify-list-end {0}, {1} {0} e {1}
|
||||
@msg nothing selected nessuna selezione
|
||||
@msg `{key}` must be a color or {_1} `{key}` deve essere un colore o {_1}
|
||||
@msg the selected objects' colors differ: give `color` i colori degli oggetti selezionati sono diversi: indica `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` i colori degli oggetti selezionati sono diversi: indica `opacity` o `color`
|
||||
@msg the active fill or stroke has no color: give `color` il riempimento o la traccia attivi non hanno colore: indica `color`
|
||||
@msg the active fill or stroke is hidden: give `color` il riempimento o la traccia attivi sono nascosti: indica `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` il riempimento o la traccia attivi sono disegnati attraverso una maschera di opacità: indica `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5837,6 +5837,7 @@ liquify-list-end {0}, {1} {0}、{1}
|
||||
@msg nothing selected 何も選択されていません
|
||||
@msg `{key}` must be a color or {_1} `{key}` はカラーまたは {_1} である必要があります
|
||||
@msg the selected objects' colors differ: give `color` 選択したオブジェクトのカラーが異なります:`color` を指定してください
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` 選択したオブジェクトのカラーが異なります:`opacity` または `color` を指定してください
|
||||
@msg the active fill or stroke has no color: give `color` アクティブな塗りまたは線にカラーがありません:`color` を指定してください
|
||||
@msg the active fill or stroke is hidden: give `color` アクティブな塗りまたは線が非表示です:`color` を指定してください
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` アクティブな塗りまたは線は不透明マスクを通して描画されます:`color` を指定してください
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7105,6 +7105,7 @@ font-technology Variable ცვლადი
|
||||
@msg nothing selected არაფერია მონიშნული
|
||||
@msg `{key}` must be a color or {_1} `{key}` უნდა იყოს ფერი ან {_1}
|
||||
@msg the selected objects' colors differ: give `color` მონიშნული ობიექტების ფერები განსხვავდება: მიუთითეთ `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` მონიშნული ობიექტების ფერები განსხვავდება: მიუთითეთ `opacity` ან `color`
|
||||
@msg the active fill or stroke has no color: give `color` აქტიურ შევსებას ან კონტურს ფერი არ აქვს: მიუთითეთ `color`
|
||||
@msg the active fill or stroke is hidden: give `color` აქტიური შევსება ან კონტური დამალულია: მიუთითეთ `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` აქტიური შევსება ან კონტური იხატება გაუმჭვირვალობის ნიღბით: მიუთითეთ `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5766,6 +5766,7 @@ liquify-list-end {0}, {1} {0} 및 {1}
|
||||
@msg nothing selected 선택된 항목이 없습니다
|
||||
@msg `{key}` must be a color or {_1} `{key}`은(는) 색상 또는 {_1}이어야 합니다
|
||||
@msg the selected objects' colors differ: give `color` 선택한 개체의 색상이 서로 다릅니다: `color`를 지정하세요
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` 선택한 개체의 색상이 서로 다릅니다: `opacity` 또는 `color`를 지정하세요
|
||||
@msg the active fill or stroke has no color: give `color` 활성 칠 또는 획에 색상이 없습니다: `color`를 지정하세요
|
||||
@msg the active fill or stroke is hidden: give `color` 활성 칠 또는 획이 숨겨져 있습니다: `color`를 지정하세요
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` 활성 칠 또는 획이 불투명 마스크를 통해 그려집니다: `color`를 지정하세요
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5688,6 +5688,7 @@ imageTrace Outline Contour
|
||||
@msg nothing selected niets geselecteerd
|
||||
@msg `{key}` must be a color or {_1} `{key}` moet een kleur of {_1} zijn
|
||||
@msg the selected objects' colors differ: give `color` de kleuren van de geselecteerde objecten verschillen: geef `color` op
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` de kleuren van de geselecteerde objecten verschillen: geef `opacity` of `color` op
|
||||
@msg the active fill or stroke has no color: give `color` de actieve vulling of lijn heeft geen kleur: geef `color` op
|
||||
@msg the active fill or stroke is hidden: give `color` de actieve vulling of lijn is verborgen: geef `color` op
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` de actieve vulling of lijn wordt door een dekkingmasker getekend: geef `color` op
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5472,6 +5472,7 @@ liquify-list-end {0}, {1} {0} i {1}
|
||||
@msg nothing selected nic nie zaznaczono
|
||||
@msg `{key}` must be a color or {_1} `{key}` musi być kolorem lub {_1}
|
||||
@msg the selected objects' colors differ: give `color` kolory zaznaczonych obiektów się różnią: podaj `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` kolory zaznaczonych obiektów się różnią: podaj `opacity` lub `color`
|
||||
@msg the active fill or stroke has no color: give `color` aktywne wypełnienie lub obrys nie ma koloru: podaj `color`
|
||||
@msg the active fill or stroke is hidden: give `color` aktywne wypełnienie lub obrys jest ukryte: podaj `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` aktywne wypełnienie lub obrys jest rysowane przez maskę krycia: podaj `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4616,6 +4616,7 @@ axis Both Ambos
|
||||
@msg nothing selected nada selecionado
|
||||
@msg `{key}` must be a color or {_1} `{key}` deve ser uma cor ou {_1}
|
||||
@msg the selected objects' colors differ: give `color` as cores dos objetos selecionados são diferentes: informe `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` as cores dos objetos selecionados são diferentes: informe `opacity` ou `color`
|
||||
@msg the active fill or stroke has no color: give `color` o preenchimento ou traçado ativo não tem cor: informe `color`
|
||||
@msg the active fill or stroke is hidden: give `color` o preenchimento ou traçado ativo está oculto: informe `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` o preenchimento ou traçado ativo é desenhado através de uma máscara de opacidade: informe `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5382,6 +5382,7 @@ liquify-list-end {0}, {1} {0} и {1}
|
||||
@msg nothing selected ничего не выделено
|
||||
@msg `{key}` must be a color or {_1} `{key}` должен быть цветом или {_1}
|
||||
@msg the selected objects' colors differ: give `color` цвета выделенных объектов различаются: укажите `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` цвета выделенных объектов различаются: укажите `opacity` или `color`
|
||||
@msg the active fill or stroke has no color: give `color` у активной заливки или обводки нет цвета: укажите `color`
|
||||
@msg the active fill or stroke is hidden: give `color` активная заливка или обводка скрыта: укажите `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` активная заливка или обводка рисуется через непрозрачную маску: укажите `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5246,6 +5246,7 @@ liquify-list-end {0}, {1} {0} och {1}
|
||||
@msg nothing selected inget markerat
|
||||
@msg `{key}` must be a color or {_1} `{key}` måste vara en färg eller {_1}
|
||||
@msg the selected objects' colors differ: give `color` de markerade objektens färger skiljer sig: ange `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` de markerade objektens färger skiljer sig: ange `opacity` eller `color`
|
||||
@msg the active fill or stroke has no color: give `color` den aktiva fyllningen eller linjen har ingen färg: ange `color`
|
||||
@msg the active fill or stroke is hidden: give `color` den aktiva fyllningen eller linjen är dold: ange `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` den aktiva fyllningen eller linjen ritas genom en opacitetsmask: ange `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5095,6 +5095,7 @@ liquify-list-end {0}, {1} {0} ve {1}
|
||||
@msg nothing selected hiçbir şey seçilmedi
|
||||
@msg `{key}` must be a color or {_1} `{key}` bir renk veya {_1} olmalıdır
|
||||
@msg the selected objects' colors differ: give `color` seçili nesnelerin renkleri farklı: `color` belirtin
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` seçili nesnelerin renkleri farklı: `opacity` veya `color` belirtin
|
||||
@msg the active fill or stroke has no color: give `color` etkin dolgu veya konturun rengi yok: `color` belirtin
|
||||
@msg the active fill or stroke is hidden: give `color` etkin dolgu veya kontur gizli: `color` belirtin
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` etkin dolgu veya kontur bir opaklık maskesi üzerinden çiziliyor: `color` belirtin
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5371,6 +5371,7 @@ liquify-list-end {0}, {1} {0} і {1}
|
||||
@msg nothing selected нічого не виділено
|
||||
@msg `{key}` must be a color or {_1} `{key}` має бути кольором або {_1}
|
||||
@msg the selected objects' colors differ: give `color` кольори виділених об’єктів відрізняються: укажіть `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` кольори виділених об’єктів відрізняються: укажіть `opacity` або `color`
|
||||
@msg the active fill or stroke has no color: give `color` активна заливка чи обведення не має кольору: укажіть `color`
|
||||
@msg the active fill or stroke is hidden: give `color` активна заливка чи обведення приховані: укажіть `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` активна заливка чи обведення малюються крізь маску непрозорості: укажіть `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5736,6 +5736,7 @@ liquify-list-end {0}, {1} {0} và {1}
|
||||
@msg nothing selected chưa chọn gì
|
||||
@msg `{key}` must be a color or {_1} `{key}` phải là một màu hoặc {_1}
|
||||
@msg the selected objects' colors differ: give `color` màu của các đối tượng đã chọn khác nhau: hãy cung cấp `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` màu của các đối tượng đã chọn khác nhau: hãy cung cấp `opacity` hoặc `color`
|
||||
@msg the active fill or stroke has no color: give `color` phần tô hoặc nét đang hoạt động không có màu: hãy cung cấp `color`
|
||||
@msg the active fill or stroke is hidden: give `color` phần tô hoặc nét đang hoạt động bị ẩn: hãy cung cấp `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` phần tô hoặc nét đang hoạt động được vẽ qua mặt nạ độ mờ: hãy cung cấp `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5502,6 +5502,7 @@ liquify-list-end {0}, {1} {0}和{1}
|
||||
@msg nothing selected 未选择任何对象
|
||||
@msg `{key}` must be a color or {_1} `{key}` 必须是颜色或 {_1}
|
||||
@msg the selected objects' colors differ: give `color` 所选对象的颜色不同:请提供 `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` 所选对象的颜色不同:请提供 `opacity` 或 `color`
|
||||
@msg the active fill or stroke has no color: give `color` 现用填色或描边没有颜色:请提供 `color`
|
||||
@msg the active fill or stroke is hidden: give `color` 现用填色或描边已隐藏:请提供 `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` 现用填色或描边通过不透明度蒙版绘制:请提供 `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2965,6 +2965,7 @@ liquify-list-end {0}, {1} {0}和{1}
|
||||
@msg nothing selected 未選取任何物件
|
||||
@msg `{key}` must be a color or {_1} `{key}` 必須是顏色或 {_1}
|
||||
@msg the selected objects' colors differ: give `color` 所選物件的顏色不同:請提供 `color`
|
||||
@msg the selected objects' colors differ: give `opacity` or `color` 所選物件的顏色不同:請提供 `opacity` 或 `color`
|
||||
@msg the active fill or stroke has no color: give `color` 作用中的填色或筆畫沒有顏色:請提供 `color`
|
||||
@msg the active fill or stroke is hidden: give `color` 作用中的填色或筆畫已隱藏:請提供 `color`
|
||||
@msg the active fill or stroke is drawn through an opacity mask: give `color` 作用中的填色或筆畫透過不透明度遮色片繪製:請提供 `color`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1496,7 +1496,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"ui.colorWheel",
|
||||
"Color Wheel Options",
|
||||
"",
|
||||
"{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, contrast?: bool, contrastFor?: normalText|largeText|graphics, contrastBackground?: a color, or null, vision?: bool} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, pick the box's channel, as Box Channel does, and set Show Contrast, Contrast For, Contrast Background and Show Color Vision Preview: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); contrast shows a row under the wheel or the box with the background's chip, the WCAG 2 contrast ratio cut off at two decimals and the AA and AAA results for contrastFor, as color.contrast answers them, and contrastBackground pins the background the row measures against (Contrast Background › Current Color; null: the color drawn behind the selection, Behind Selection); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out keep their values, and so do the other keys when null ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel, contrast, contrastFor, contrastBackground, vision}",
|
||||
"{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, contrast?: bool, contrastFor?: normalText|largeText|graphics, contrastBackground?: a color, or null, vision?: bool} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, pick the box's channel, as Box Channel does, and set Show Contrast, Contrast For, Contrast Background and Show Color Vision Preview: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); contrast shows a row under the wheel or the box with the background's chip, the WCAG 2 contrast ratio cut off at two decimals and the AA and AAA results for contrastFor (AA only for graphics), as color.contrast answers them, and contrastBackground pins the background the row measures against (Contrast Background › Current Color; null: the color drawn behind the selection, Behind Selection); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out keep their values, and so do the other keys when null ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel, contrast, contrastFor, contrastBackground, vision}",
|
||||
),
|
||||
(
|
||||
"ui.savePdfDialog",
|
||||
|
||||
@@ -329,25 +329,30 @@ const CHIP: f32 = 16.0;
|
||||
/// objects, the picked object of a dynamic symbol instance, the on-screen Appearance of Black and
|
||||
/// the color settings ([`under`]).
|
||||
type BehindKey = (u64, u64, Vec<NodeId>, Option<Vec<u32>>, String, Under);
|
||||
/// What the contrast row's answer depends on: the background, the active proxy's paint (with nothing
|
||||
/// selected it is the default for new art, which no revision counts), the document, its revision,
|
||||
/// the selection and its picked symbol object, the proxy, the appearance item, the selected
|
||||
/// gradient stop and freeform point, the on-screen Appearance of Black, the color settings and the
|
||||
/// picked gradient mesh points, which the active tool keeps without a revision.
|
||||
pub(super) type RatioKey = (
|
||||
String,
|
||||
String,
|
||||
Option<(u64, u64)>,
|
||||
Vec<NodeId>,
|
||||
Option<Vec<u32>>,
|
||||
bool,
|
||||
Option<usize>,
|
||||
Option<usize>,
|
||||
Option<usize>,
|
||||
String,
|
||||
Under,
|
||||
Vec<(NodeId, Vec<usize>)>,
|
||||
);
|
||||
/// What the contrast row's answer depends on.
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub(super) struct RatioKey {
|
||||
/// The pinned background, or `below` for the color behind the selection.
|
||||
pub(super) background: String,
|
||||
/// The active proxy's paint; with nothing selected it is the default for new art, which no
|
||||
/// revision counts.
|
||||
pub(super) paint: String,
|
||||
/// The document and its revision.
|
||||
pub(super) doc: Option<(u64, u64)>,
|
||||
pub(super) selection: Vec<NodeId>,
|
||||
/// The picked object of a dynamic symbol instance.
|
||||
pub(super) symbol_part: Option<Vec<u32>>,
|
||||
/// Whether the Fill proxy is active.
|
||||
pub(super) fill_active: bool,
|
||||
pub(super) appearance_item: Option<usize>,
|
||||
pub(super) stop: Option<usize>,
|
||||
pub(super) freeform_point: Option<usize>,
|
||||
/// The on-screen Appearance of Black.
|
||||
pub(super) black_on_screen: String,
|
||||
pub(super) under: Under,
|
||||
/// The picked gradient mesh points, which the active tool keeps without a revision.
|
||||
pub(super) mesh_points: Vec<(NodeId, Vec<usize>)>,
|
||||
}
|
||||
|
||||
/// The active color settings and profiles generation, which change how a color displays without
|
||||
/// a document revision (Edit › Color Settings, a document's assigned profiles).
|
||||
@@ -363,20 +368,16 @@ fn picked_part(st: &vectorcraft_engine::DocState) -> Option<Vec<u32>> {
|
||||
}
|
||||
|
||||
/// The background the contrast row measures against: the pinned color, else the color
|
||||
/// `color.contrast` reads behind the selection, kept per document revision and selection, and kept
|
||||
/// as it is while an interaction is in progress (the selection being dragged is hidden from it).
|
||||
/// None with nothing selected.
|
||||
/// `color.contrast` reads behind the selection, kept per document revision and selection, so a
|
||||
/// drag that moves the selection reads it again. None with nothing selected.
|
||||
fn background(app: &mut VectorcraftApp, ui: &Ui) -> Option<Color> {
|
||||
if let Some(c) = app.ui.color_wheel.contrast_background {
|
||||
return Some(c);
|
||||
}
|
||||
let st = app.session.active()?;
|
||||
let key: BehindKey = (st.uid, st.revision, st.selection.objects.clone(), picked_part(st), app.session.prefs.black_on_screen.clone(), under());
|
||||
// During an interaction only the revision may differ: another document, selection or setting is
|
||||
// read again.
|
||||
let same_but_revision = |k: &BehindKey| k.0 == key.0 && k.2 == key.2 && k.3 == key.3 && k.4 == key.4 && k.5 == key.5;
|
||||
let hex = match pstate::<Option<(BehindKey, Option<String>)>>(ui.ctx(), BEHIND) {
|
||||
Some((k, hex)) if k == key || (app.session.in_interaction() && same_but_revision(&k)) => hex,
|
||||
Some((k, hex)) if k == key => hex,
|
||||
_ => {
|
||||
// Any opaque color reads the background; only `against` is used.
|
||||
let r = app.session.execute("color.contrast", &json!({ "color": "#000000" })).ok();
|
||||
@@ -393,20 +394,20 @@ fn background(app: &mut VectorcraftApp, ui: &Ui) -> Option<Color> {
|
||||
/// (`against: "below"`), kept per [`RatioKey`].
|
||||
fn ratio_answer(app: &mut VectorcraftApp, ui: &Ui, pinned: Option<Color>) -> Option<Value> {
|
||||
let st = app.session.active();
|
||||
let key: RatioKey = (
|
||||
pinned.map_or_else(|| "below".to_string(), |bg| format!("{bg:?}")),
|
||||
format!("{:?}", super::active_paint(app)),
|
||||
st.map(|d| (d.uid, d.revision)),
|
||||
st.map(|d| d.selection.objects.clone()).unwrap_or_default(),
|
||||
st.and_then(picked_part),
|
||||
app.session.fill_active,
|
||||
app.session.appearance_item(),
|
||||
app.session.selected_stop(),
|
||||
app.session.selected_freeform_point(),
|
||||
app.session.prefs.black_on_screen.clone(),
|
||||
under(),
|
||||
app.session.fill_mesh_points(),
|
||||
);
|
||||
let key = RatioKey {
|
||||
background: pinned.map_or_else(|| "below".to_string(), |bg| format!("{bg:?}")),
|
||||
paint: format!("{:?}", super::active_paint(app)),
|
||||
doc: st.map(|d| (d.uid, d.revision)),
|
||||
selection: st.map(|d| d.selection.objects.clone()).unwrap_or_default(),
|
||||
symbol_part: st.and_then(picked_part),
|
||||
fill_active: app.session.fill_active,
|
||||
appearance_item: app.session.appearance_item(),
|
||||
stop: app.session.selected_stop(),
|
||||
freeform_point: app.session.selected_freeform_point(),
|
||||
black_on_screen: app.session.prefs.black_on_screen.clone(),
|
||||
under: under(),
|
||||
mesh_points: app.session.fill_mesh_points(),
|
||||
};
|
||||
match pstate::<Option<(RatioKey, Option<Value>)>>(ui.ctx(), RATIO) {
|
||||
Some((k, r)) if k == key => r,
|
||||
_ => {
|
||||
|
||||
@@ -69,7 +69,7 @@ fn an_answer_kept_under_other_color_settings_is_asked_again() {
|
||||
let (mut key, answer) = pstate::<Kept>(&h.ctx, "color-wheel-ratio").expect("the row keeps its answer");
|
||||
let mut stale = answer.expect("an answer");
|
||||
stale["ratio"] = json!(1.0);
|
||||
key.10.1 = u64::MAX;
|
||||
key.under.1 = u64::MAX;
|
||||
super::set_pstate(&h.ctx, "color-wheel-ratio", Some((key, Some(stale))));
|
||||
h.run_steps(2);
|
||||
assert!(shows(&h, "21.00:1"), "the answer is asked again under the current settings");
|
||||
@@ -183,7 +183,7 @@ fn a_drag_on_the_wheel_reads_the_background_only_with_the_ratio() {
|
||||
}
|
||||
|
||||
/// With no color to measure the row has no ratio, and the chip still shows the background, read on
|
||||
/// its own; during an interaction that is kept only for the same document and selection.
|
||||
/// its own, and read again for another selection during an interaction.
|
||||
#[test]
|
||||
fn a_paint_with_no_color_still_shows_the_background() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
@@ -207,6 +207,29 @@ fn a_paint_with_no_color_still_shows_the_background() {
|
||||
assert_eq!(hex(&h).as_deref(), Some("#ffffff"), "the other selection's background is read during the interaction");
|
||||
}
|
||||
|
||||
/// With no color to measure, a move during an interaction reads the background again at the
|
||||
/// selection's new place.
|
||||
#[test]
|
||||
fn a_move_during_an_interaction_reads_the_background_again() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 200})).unwrap();
|
||||
app.run("paint.setFill", json!({"color": "#ffff00"})).unwrap();
|
||||
app.run("object.lock", json!({})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 40, "height": 40})).unwrap();
|
||||
app.run("paint.setFill", json!({"none": true})).unwrap();
|
||||
app.run("ui.colorWheel", json!({"contrast": true})).unwrap();
|
||||
let mut h = harness(app);
|
||||
let hex = |h: &Harness<'static, VectorcraftApp>| behind(h).and_then(|(_, hex)| hex);
|
||||
h.state_mut().session.begin_interaction("test").unwrap();
|
||||
h.run_steps(2);
|
||||
assert_eq!(hex(&h).as_deref(), Some("#ffff00"));
|
||||
h.state_mut().run("object.move", json!({"dx": 110, "dy": 0})).unwrap();
|
||||
assert!(h.state().session.in_interaction(), "the move is part of the interaction");
|
||||
h.run_steps(2);
|
||||
assert_eq!(hex(&h).as_deref(), Some("#ffffff"), "the background at the new place");
|
||||
}
|
||||
|
||||
/// An interaction keeps no answer for another selection: the row asks again, and the chip shows
|
||||
/// the other selection's background.
|
||||
#[test]
|
||||
|
||||
@@ -239,7 +239,7 @@ as `ui.color_guide` (`variation`, `steps`, `amount`). Save Colors as Swatches ru
|
||||
|
||||
Color Wheel contrast: `color.contrast {color?, against?, opacity?}` answers the WCAG 2 contrast ratio of the active
|
||||
proxy's color against the color drawn behind the selection (`against: "below"`, the default) or against a given color,
|
||||
with the AA and AAA results for normal text, large text and graphics (docs/mcp.md). The Color Wheel panel's Show
|
||||
with the AA and AAA results for normal text and large text and the AA result for graphics (docs/mcp.md). The Color Wheel panel's Show
|
||||
Contrast row shows the same answer for the category picked under Contrast For; `ui.colorWheel {contrast?, contrastFor?,
|
||||
contrastBackground?}` sets the row, its category and a pinned background, and `ui.inspect` reports them as
|
||||
`ui.color_wheel`.
|
||||
|
||||
+4
-3
@@ -685,7 +685,7 @@ and answers true when the fields show in percent.
|
||||
strip at its right) in place of the wheel, as the panel menu's Box View and Box Channel do, and `"view": "wheel"`
|
||||
shows the wheel again. Keys left out keep their values. Params that are not an object, another key or a value off
|
||||
the list return an error and change nothing. `{"contrast": true}` shows Show Contrast's row under the wheel or the
|
||||
box, `contrastFor` (`normalText`, `largeText` or `graphics`) picks the category its AA and AAA results are for, and
|
||||
box, `contrastFor` (`normalText`, `largeText` or `graphics`, which has AA only) picks the category its results are for, and
|
||||
`contrastBackground` (a color, or `null` for the color behind the selection) pins the background it measures against,
|
||||
as `color.contrast` below answers it. The command returns `{view, channel, contrast, contrastFor,
|
||||
contrastBackground, vision}`, and the settings are kept with the preferences.
|
||||
@@ -1155,8 +1155,9 @@ images included; template layers and guides left out, as exports leave them out;
|
||||
is drawn); a picked object of a dynamic symbol instance hides only itself, and the color is read at its own center.
|
||||
These are errors: `"below"` with nothing selected; a "?" proxy (hidden objects count there, as in the Color panel);
|
||||
selected objects that draw one color with different blend modes, or at different opacities without `opacity` (with
|
||||
`"below"`, also in different groups or layers that are translucent, have a blend mode or isolate their blending),
|
||||
where hidden objects do not count; a proxy of None, a pattern or a hidden row without `color`; and without `color`, a
|
||||
`"below"`, also in different groups or layers that are translucent, have a blend mode or isolate their blending, or
|
||||
with a translucent or blending row over different shown rows below it), where hidden objects do not count, and the
|
||||
error names `opacity` when giving it settles the difference; a proxy of None, a pattern or a hidden row without `color`; and without `color`, a
|
||||
proxy's object drawn through an opacity mask that is not disabled, its own or that of a group, layer or instance
|
||||
around it, since the mask sets how much of the color shows at each point. `against` in the
|
||||
answer is the background as a working RGB `#rrggbb`, the form `against` takes; the sampled background is rounded to 8
|
||||
|
||||
Reference in New Issue
Block a user