* Comments: "Other colour…" picker and recent custom colours under the swatches (#1193) The annotation tools offered only the ten fixed swatches. The shared swatch grid (comments' quick bar, right-click menu and Comment Properties, and the other colour choosers that use it) now ends with "Other colour…", a full colour picker that starts from the current colour; Apply commits it once. Applied custom colours are kept as a "Recent colours" row (newest first, five at most, swatches not repeated) for the session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVtZHu998NDhf4Z8QvS5pd * Comments: import kittest's Queryable in the Other colour test (#1193) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVtZHu998NDhf4Z8QvS5pd * Comments: "Other colour…" is a "+" swatch so the grid keeps its height (#1193) A row under every swatch grid made dense dialogs (Redaction Tool Properties has two grids) taller, pushing their lower controls out of reach. The picker now opens from a swatch-sized "+" at the end of the first row; the Recent colours row appears only once a custom colour has been applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVtZHu998NDhf4Z8QvS5pd * Comments: each colour grid keeps its own "Other colour…" state Two swatch grids drawn in one parent (Redaction properties, Prepare a form) shared the picker's open state, so "+" opened both. The state and the swatch grid are now keyed on each grid's own place in its parent. * Comments: test that two colour grids in one parent open separately * ATTRIBUTION.toml: catalog hashes after merging main --------- Co-authored-by: ngrafton2006 <ngrafton2006@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
This commit is contained in:
parent
4e53e5ffbd
commit
7183bf4264
|
|
@ -7,7 +7,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Greek UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "f0498e7e9b71f054fa2115a1d02e5cee45f070747c37fc844b299c3536711fbd"
|
||||
sha256 = "d7ad8f46f105638aff5b91423fe74077af5bf1f3246eeb9e066df8e4df0e222e"
|
||||
|
||||
# ATTRIBUTION.toml: one entry per asset (AGENTS.md §1). The source of truth for provenance and licences.
|
||||
# ATTRIBUTION.md is generated from this file: `cargo xtask assets --write`. Checked by `cargo xtask assets` (part of `xtask ci`).
|
||||
|
|
@ -30,7 +30,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Simplified Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "8061baf67a35734f87bd9d91aa9c22a6121cc450b69dd9a4862d56bc61f2b4b8"
|
||||
sha256 = "7df6e3aebce85e8eaac46465ab46d0c8447f314cdcdbe41ba4fc0188a2105f14"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/zh-hant.tsv"
|
||||
|
|
@ -41,7 +41,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Traditional Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "49f52fd09814bc9cca6f3b659bbe26a7091f7407a569cb138b5721bc8e8d5536"
|
||||
sha256 = "49eccf2decfc53724250e685bb448c41ccadcf6906fa56ba9b13d8047329ab99"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/cs.tsv"
|
||||
|
|
@ -52,7 +52,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Czech UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "16723806a7d1045edbe45c06250fe4ef03ec94ea5a2829e7ec6c593a42d4db9a"
|
||||
sha256 = "6abec13d351d38a12e4634f64bbf6b884c8102af1f97da7e08cbcd29de14a5ba"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/pt-br.tsv"
|
||||
|
|
@ -63,7 +63,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Brazilian Portuguese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "b69ecd1590a9573b25b191f6adc0450bfc45b0866a9be83aaba2d0b079c449d7"
|
||||
sha256 = "afa953e566e7b9533df28845b52a768f77c7d8aa254cd3bbe1928ddf28019efa"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/es.tsv"
|
||||
|
|
@ -74,7 +74,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Spanish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "2806f83b280606d48a9aeaa60ae6fc3ca9e4308ae427222a4413cf88c9799b38"
|
||||
sha256 = "1de0258b9b1ea7c375ef71d8c4cbeeebbc0f976cb6aead04bdd1d06d18f7c717"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/fr.tsv"
|
||||
|
|
@ -85,7 +85,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "French UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "3d6817e945690fd1a156b0d7484a762c9c1b3286de6373be58c07e0451b4dd30"
|
||||
sha256 = "59ac5e705d8d74273ce774cb2dd8020313277ae2a376ae2967031d60ae590745"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/de.tsv"
|
||||
|
|
@ -96,7 +96,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "German UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "252cdb6adc0ab7780e56f21a8edd7d2d34a8a4918c7285a0ea3f96bd3bbb0760"
|
||||
sha256 = "36e814e0bec4fab77c7a0face806fa14269c1964b9850d19765d4b41b4503300"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/te.tsv"
|
||||
|
|
@ -107,7 +107,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Telugu UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "68eae372d31b38e6cf93a1060838cf9f7092129508e9bae0a34b1053da16916c"
|
||||
sha256 = "22c8d5335c7b7be2e7a735e94b076ab9aead4817335953387f1122691b00e04e"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/it.tsv"
|
||||
|
|
@ -118,7 +118,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Italian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "ba2a40614bd092949ce1bacf484d18814eb13847f787b06dc2e4b1c036cef3c8"
|
||||
sha256 = "3c2740ffdf370e1dc1cd3fbfd4da05185a0d247233fcb143c63c2f560a072cd2"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/pl.tsv"
|
||||
|
|
@ -129,7 +129,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Polish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "cf19679450f1f38c38ca41cfc0c46bbb10424697fe50eeec012a36f55b87dad8"
|
||||
sha256 = "755fadd87a23d56ff3319ed58b4651b386603a86ceed1a74919403a9a1f5698b"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/ru.tsv"
|
||||
|
|
@ -140,7 +140,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Russian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "0c62ce0d40d9aaff929e32188ad6506dd3e861f99f560eb7c2fb60a5cd333572"
|
||||
sha256 = "3455f5598efb906ad12921cb9264761d7eb8f180d26ef02e8c3ab041d5f63f76"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/hu.tsv"
|
||||
|
|
@ -151,7 +151,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Hungarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "9b7ead6a6fe54b67efb765ed9dea28f24f194b3c406ec94198eb9a1ed4838f31"
|
||||
sha256 = "0f9ae32a12fd0285d5e11a523019f410894533669a20ba16ad6ded4907ee8f55"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/bg.tsv"
|
||||
|
|
@ -162,7 +162,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Bulgarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "ffab5ead4c717d4dbfa6021d1a36f651957586948c7f69f7cedc5133883fce37"
|
||||
sha256 = "3e1386f1e8c6412a5a685b127b4871c5ea5e7e1c91428a1a402dca61b785f103"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/kk.tsv"
|
||||
|
|
@ -173,7 +173,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Kazakh UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "6708a64bf049de7ee454966abdf564227d69e23786e9928577a97f7a1cc7e08f"
|
||||
sha256 = "134d6c9787407e8634c2749adcf40c8f15f89e6262e902547f8ef0022e548f72"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/ja.tsv"
|
||||
|
|
@ -184,7 +184,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Japanese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "7ccf9f318b9d3d394247975bbea19cf124edefb17910819af153a9a2a654127f"
|
||||
sha256 = "6dfc2b9e312a888fd0a11426129d38654e40f59888c2c90b1be1751b5893daa3"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/uk.tsv"
|
||||
|
|
@ -195,7 +195,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Ukrainian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "a861ee9b2e4c04a36ec83df3087f0a8bcdad30b07b2385f346533177f8003fe1"
|
||||
sha256 = "46f7addc24737c5700b8dff69392d16b24c67b92f0bf92444b806f3f9e107195"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/ar.tsv"
|
||||
|
|
@ -206,7 +206,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Arabic UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "7f9cb9cc57ff67d57a3b12a656673b746fa3830b57f070d36085c3faaef0ec28"
|
||||
sha256 = "a680284dc350985b9f0742e258ff6e8d05e2d30513a0d9444c915d250ba1ed9a"
|
||||
|
||||
[[asset]]
|
||||
path = "crates/ui-egui/src/i18n/tr.tsv"
|
||||
|
|
@ -217,7 +217,7 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Turkish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "4c63bcca851aba720662af0a1b76b1ba0140908e3ef5e9c3016d8b0642d9e689"
|
||||
sha256 = "1a1db9cd9a6d3ba59eeb739a8961e57183320dd11ca9f8750c6683ed5bc243a3"
|
||||
|
||||
[[asset]]
|
||||
path = "assets/icons/accessibility.svg"
|
||||
|
|
@ -3328,4 +3328,4 @@ licence = "MIT OR Apache-2.0"
|
|||
licence_file = "LICENSE-MIT"
|
||||
kind = "translation"
|
||||
usage = "Slovene UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
|
||||
sha256 = "13071abba5e8ec37f2f93dbe1c8bd47eecac6a0d4956407535c91ba655cad936"
|
||||
sha256 = "499b2ea8dbb49c4d59f4ac360e72a64ac4f3eb2760521c4e9b8f135297180823"
|
||||
|
|
|
|||
|
|
@ -1433,27 +1433,126 @@ pub enum CanvasAction {
|
|||
Properties(usize, usize),
|
||||
}
|
||||
|
||||
/// A grid of colour swatches; returns the one clicked.
|
||||
/// How many custom colours the "Recent colours" row keeps.
|
||||
const RECENT_CUSTOM: usize = 5;
|
||||
|
||||
fn recent_custom_id() -> egui::Id {
|
||||
egui::Id::new("pdfcraft-recent-custom-colours")
|
||||
}
|
||||
|
||||
/// Custom colours picked with "Other colour…" this session, newest first (#1193).
|
||||
pub fn recent_custom_colours(ctx: &egui::Context) -> Vec<Rgb> {
|
||||
ctx.data(|d| d.get_temp::<Vec<Rgb>>(recent_custom_id())).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Put `c` first in the recent custom colours (once, at most [`RECENT_CUSTOM`]). Colours that are
|
||||
/// already swatches are not repeated there.
|
||||
pub fn remember_custom_colour(ctx: &egui::Context, c: Rgb) {
|
||||
if !c.iter().all(|v| v.is_finite()) || SWATCHES.iter().any(|(_, s)| same_colour(s, &c)) {
|
||||
return;
|
||||
}
|
||||
let c = c.map(|v| v.clamp(0.0, 1.0));
|
||||
ctx.data_mut(|d| {
|
||||
let recent = d.get_temp_mut_or_default::<Vec<Rgb>>(recent_custom_id());
|
||||
recent.retain(|r| !same_colour(r, &c));
|
||||
recent.insert(0, c);
|
||||
recent.truncate(RECENT_CUSTOM);
|
||||
});
|
||||
}
|
||||
|
||||
fn same_colour(a: &Rgb, b: &Rgb) -> bool {
|
||||
a.iter().zip(b).all(|(x, y)| (x - y).abs() < 0.02)
|
||||
}
|
||||
|
||||
fn rgb_of(c: Color32) -> Rgb {
|
||||
[c.r(), c.g(), c.b()].map(|v| f64::from(v) / 255.0)
|
||||
}
|
||||
|
||||
/// One round swatch; `on` rings it as the current colour.
|
||||
fn swatch(ui: &mut egui::Ui, c: Rgb, on: bool, tooltip: &str) -> egui::Response {
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(22.0, 22.0), Sense::click());
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, tooltip));
|
||||
ui.painter().circle_filled(r.center(), 9.0, color32(c));
|
||||
ui.painter().circle_stroke(r.center(), 9.0, Stroke::new(1.0, Color32::from_black_alpha(40)));
|
||||
if on || resp.hovered() {
|
||||
ui.painter().circle_stroke(r.center(), 11.0, Stroke::new(1.5, SELECT_BLUE));
|
||||
}
|
||||
resp.on_hover_text(tooltip)
|
||||
}
|
||||
|
||||
/// The "+" swatch that opens "Other colour…": a ring with a plus, the size of a swatch.
|
||||
fn other_colour_swatch(ui: &mut egui::Ui, open: bool) -> egui::Response {
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(22.0, 22.0), Sense::click());
|
||||
let ink = ui.visuals().widgets.inactive.fg_stroke.color;
|
||||
ui.painter().circle_stroke(r.center(), 9.0, Stroke::new(1.0, ink.gamma_multiply(0.6)));
|
||||
let c = r.center();
|
||||
for d in [vec2(4.5, 0.0), vec2(0.0, 4.5)] {
|
||||
ui.painter().line_segment([c - d, c + d], Stroke::new(1.5, ink));
|
||||
}
|
||||
if open || resp.hovered() {
|
||||
ui.painter().circle_stroke(c, 11.0, Stroke::new(1.5, SELECT_BLUE));
|
||||
}
|
||||
let label = tl!("Other colour…");
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, true, open, label));
|
||||
resp.on_hover_text(label)
|
||||
}
|
||||
|
||||
/// A grid of colour swatches with a "+" swatch for "Other colour…" (a full picker, as Acrobat's
|
||||
/// quick colours offer) and, once used, the recent custom colours; returns the colour chosen.
|
||||
/// The "+" sits in the first row, so the grid is no taller than before until the picker opens.
|
||||
pub fn swatch_grid(ui: &mut egui::Ui, current: Option<Rgb>) -> Option<Rgb> {
|
||||
let mut picked = None;
|
||||
egui::Grid::new(ui.id().with("swatches")).spacing(vec2(6.0, 6.0)).show(ui, |ui| {
|
||||
let on = |c: &Rgb| current.is_some_and(|cur| same_colour(&cur, c));
|
||||
// Keyed on this grid's own place in the parent, so two grids in one dialog open their
|
||||
// pickers separately.
|
||||
let base = ui.next_auto_id();
|
||||
ui.skip_ahead_auto_ids(1);
|
||||
let open_id = base.with("other-colour");
|
||||
let value_id = open_id.with("value");
|
||||
let mut open = ui.data(|d| d.get_temp::<bool>(open_id)).unwrap_or(false);
|
||||
egui::Grid::new(base.with("swatches")).spacing(vec2(6.0, 6.0)).show(ui, |ui| {
|
||||
for (i, (name, c)) in SWATCHES.iter().enumerate() {
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(22.0, 22.0), Sense::click());
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, tl!(name)));
|
||||
let on = current.is_some_and(|cur| cur.iter().zip(c).all(|(a, b)| (a - b).abs() < 0.02));
|
||||
ui.painter().circle_filled(r.center(), 9.0, color32(*c));
|
||||
ui.painter().circle_stroke(r.center(), 9.0, Stroke::new(1.0, Color32::from_black_alpha(40)));
|
||||
if on || resp.hovered() {
|
||||
ui.painter().circle_stroke(r.center(), 11.0, Stroke::new(1.5, SELECT_BLUE));
|
||||
}
|
||||
if resp.on_hover_text(tl!(name)).clicked() {
|
||||
if swatch(ui, *c, on(c), tl!(name)).clicked() {
|
||||
picked = Some(*c);
|
||||
}
|
||||
if i == 4 && other_colour_swatch(ui, open).clicked() {
|
||||
open = !open;
|
||||
// Start from the current colour each time the picker opens.
|
||||
ui.data_mut(|d| d.insert_temp(value_id, current.map_or(Color32::BLACK, color32)));
|
||||
}
|
||||
if i % 5 == 4 {
|
||||
ui.end_row();
|
||||
}
|
||||
}
|
||||
});
|
||||
let recent = recent_custom_colours(ui.ctx());
|
||||
if !recent.is_empty() {
|
||||
ui.label(egui::RichText::new(tl!("Recent colours")).small());
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 6.0;
|
||||
for c in &recent {
|
||||
let [r, g, b, _] = color32(*c).to_array();
|
||||
if swatch(ui, *c, on(c), &format!("#{r:02X}{g:02X}{b:02X}")).clicked() {
|
||||
picked = Some(*c);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if open && picked.is_none() {
|
||||
let mut value = ui.data(|d| d.get_temp::<Color32>(value_id)).unwrap_or_else(|| current.map_or(Color32::BLACK, color32));
|
||||
egui::widgets::color_picker::color_picker_color32(ui, &mut value, egui::widgets::color_picker::Alpha::Opaque);
|
||||
ui.data_mut(|d| d.insert_temp(value_id, value));
|
||||
// Dragging in the picker previews nothing; Apply commits once (one undo step).
|
||||
if ui.button(tl!("Apply")).clicked() {
|
||||
let c = rgb_of(value);
|
||||
remember_custom_colour(ui.ctx(), c);
|
||||
picked = Some(c);
|
||||
}
|
||||
}
|
||||
if picked.is_some() {
|
||||
open = false;
|
||||
}
|
||||
ui.data_mut(|d| d.insert_temp(open_id, open));
|
||||
picked
|
||||
}
|
||||
|
||||
|
|
@ -1645,6 +1744,75 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recent_custom_colours_dedupe_cap_and_skip_swatches() {
|
||||
// #1193: "Other colour…" remembers what it applied, newest first.
|
||||
let ctx = egui::Context::default();
|
||||
assert!(recent_custom_colours(&ctx).is_empty());
|
||||
for i in 0..7 {
|
||||
remember_custom_colour(&ctx, [0.1 * f64::from(i), 0.3, 0.7]);
|
||||
}
|
||||
let recent = recent_custom_colours(&ctx);
|
||||
assert_eq!(recent.len(), RECENT_CUSTOM, "capped");
|
||||
assert!(same_colour(&recent[0], &[0.6, 0.3, 0.7]), "newest first: {recent:?}");
|
||||
remember_custom_colour(&ctx, [0.2, 0.3, 0.7]);
|
||||
let again = recent_custom_colours(&ctx);
|
||||
assert_eq!(again.len(), RECENT_CUSTOM);
|
||||
assert!(
|
||||
same_colour(&again[0], &[0.2, 0.3, 0.7]) && again.iter().filter(|c| same_colour(c, &[0.2, 0.3, 0.7])).count() == 1,
|
||||
"moved, not repeated"
|
||||
);
|
||||
// Swatches and unusable values are not remembered; out-of-range ones are clamped.
|
||||
remember_custom_colour(&ctx, SWATCHES[0].1);
|
||||
remember_custom_colour(&ctx, [f64::NAN, 0.0, 0.0]);
|
||||
assert!(same_colour(&recent_custom_colours(&ctx)[0], &[0.2, 0.3, 0.7]));
|
||||
remember_custom_colour(&ctx, [1.7, -0.5, 0.25]);
|
||||
assert!(same_colour(&recent_custom_colours(&ctx)[0], &[1.0, 0.0, 0.25]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn other_colour_applies_the_picked_colour_once() {
|
||||
// #1193: the swatch grid has a full picker; Apply returns its colour and remembers it.
|
||||
use egui_kittest::kittest::Queryable;
|
||||
let current = [0.2, 0.4, 0.6];
|
||||
let mut h = egui_kittest::Harness::new_ui_state(
|
||||
|ui, picked: &mut Vec<Rgb>| {
|
||||
if let Some(c) = swatch_grid(ui, Some(current)) {
|
||||
picked.push(c);
|
||||
}
|
||||
},
|
||||
Vec::new(),
|
||||
);
|
||||
h.run();
|
||||
assert!(h.query_by_label("Apply").is_none(), "the picker starts closed");
|
||||
assert!(h.query_by_label("Recent colours").is_none());
|
||||
h.get_by_label("Other colour…").click();
|
||||
h.run();
|
||||
h.get_by_label("Apply").click();
|
||||
h.run();
|
||||
let picked = h.state().clone();
|
||||
assert_eq!(picked.len(), 1, "one choice: {picked:?}");
|
||||
assert!(same_colour(&picked[0], ¤t), "the picker opens on the current colour: {picked:?}");
|
||||
assert!(h.query_by_label("Apply").is_none(), "applying closes the picker");
|
||||
assert!(h.query_by_label("Recent colours").is_some(), "the colour is offered again");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn two_grids_in_one_parent_open_their_pickers_separately() {
|
||||
// Redaction properties and Prepare a form draw two grids in one parent ui.
|
||||
use egui_kittest::kittest::Queryable;
|
||||
let mut h = egui_kittest::Harness::new_ui(|ui| {
|
||||
let _ = swatch_grid(ui, Some([0.2, 0.4, 0.6]));
|
||||
let _ = swatch_grid(ui, Some([0.6, 0.4, 0.2]));
|
||||
});
|
||||
h.run();
|
||||
let plus = h.query_all_by_label("Other colour…").collect::<Vec<_>>();
|
||||
assert_eq!(plus.len(), 2);
|
||||
plus[0].click();
|
||||
h.run();
|
||||
assert_eq!(h.query_all_by_label("Apply").count(), 1, "only the first grid's picker opens");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proportional_corners_keep_the_opposite_anchor_and_edges_stretch_one_axis() {
|
||||
let r = Rect::from_min_max(pos2(100.0, 100.0), pos2(196.0, 132.0));
|
||||
|
|
|
|||
|
|
@ -2337,6 +2337,8 @@ animation effects Off معطّلة
|
|||
Ink sensitivity حساسية الحبر
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. لم يُعثر على توقيع داخل الإطار. حرّك الإطار فوق التوقيع أو ارفع حساسية الحبر.
|
||||
Couldn't use the photo: {e} تعذّر استخدام الصورة: {e}
|
||||
Other colour… لون آخر…
|
||||
Recent colours الألوان الأخيرة
|
||||
Couldn't follow linked PDF: {reason} تعذّر فتح ملف PDF المرتبط: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. فُتح ملف PDF المرتبط، لكن لم تُطبَّق وجهته المسماة.
|
||||
The linked PDF opened, but its page destination was out of range. فُتح ملف PDF المرتبط، لكن وجهة الصفحة خارج النطاق.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
|
|
@ -2279,6 +2279,8 @@ animation effects Off Изключени
|
|||
Ink sensitivity Чувствителност към мастило
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. В рамката не е открит подпис. Преместете рамката върху подписа или увеличете чувствителността към мастило.
|
||||
Couldn't use the photo: {e} Снимката не може да се използва: {e}
|
||||
Other colour… Друг цвят…
|
||||
Recent colours Последни цветове
|
||||
Couldn't follow linked PDF: {reason} Свързаният PDF не можа да бъде отворен: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Свързаният PDF се отвори, но именуваната му цел не беше приложена.
|
||||
The linked PDF opened, but its page destination was out of range. Свързаният PDF се отвори, но целевата му страница е извън обхвата.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 8 and column 16.
|
|
|
@ -2390,6 +2390,8 @@ animation effects Off Vypnuto
|
|||
Ink sensitivity Citlivost na inkoust
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. V rámečku nebyl nalezen žádný podpis. Přesuňte rámeček na podpis nebo zvyšte citlivost na inkoust.
|
||||
Couldn't use the photo: {e} Fotografii nelze použít: {e}
|
||||
Other colour… Jiná barva…
|
||||
Recent colours Nedávné barvy
|
||||
Couldn't follow linked PDF: {reason} Odkazovaný PDF nelze otevřít: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Odkazovaný PDF se otevřel, ale jeho pojmenovaný cíl nebyl použit.
|
||||
The linked PDF opened, but its page destination was out of range. Odkazovaný PDF se otevřel, ale cílová stránka je mimo rozsah.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
|
|
@ -2317,6 +2317,8 @@ animation effects Off Aus
|
|||
Ink sensitivity Tintenempfindlichkeit
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Im Rahmen wurde keine Unterschrift gefunden. Ziehen Sie den Rahmen über die Unterschrift oder erhöhen Sie die Tintenempfindlichkeit.
|
||||
Couldn't use the photo: {e} Das Foto kann nicht verwendet werden: {e}
|
||||
Other colour… Andere Farbe…
|
||||
Recent colours Zuletzt verwendete Farben
|
||||
Couldn't follow linked PDF: {reason} Verknüpfte PDF konnte nicht geöffnet werden: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Die verknüpfte PDF wurde geöffnet, aber ihr benanntes Ziel wurde nicht angewendet.
|
||||
The linked PDF opened, but its page destination was out of range. Die verknüpfte PDF wurde geöffnet, aber ihr Seitenziel liegt außerhalb des Bereichs.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 51.
|
|
|
@ -2321,6 +2321,8 @@ animation effects Off Ανενεργά
|
|||
Ink sensitivity Ευαισθησία μελανιού
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Δεν βρέθηκε υπογραφή στο πλαίσιο. Μετακινήστε το πλαίσιο πάνω από την υπογραφή ή αυξήστε την ευαισθησία μελανιού.
|
||||
Couldn't use the photo: {e} Δεν ήταν δυνατή η χρήση της φωτογραφίας: {e}
|
||||
Other colour… Άλλο χρώμα…
|
||||
Recent colours Πρόσφατα χρώματα
|
||||
Reading colours Χρώματα ανάγνωσης
|
||||
Replace document colours Αντικατάσταση χρωμάτων εγγράφου
|
||||
Page background Φόντο σελίδας
|
||||
|
|
|
|||
|
Can't render this file because it has a wrong number of fields in line 5.
|
|
|
@ -2435,6 +2435,8 @@ animation effects Off Desactivados
|
|||
Ink sensitivity Sensibilidad de la tinta
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. No se encontró ninguna firma en el marco. Mueva el marco sobre la firma o aumente la sensibilidad de la tinta.
|
||||
Couldn't use the photo: {e} No se puede usar la foto: {e}
|
||||
Other colour… Otro color…
|
||||
Recent colours Colores recientes
|
||||
Reading colours Colores de lectura
|
||||
Replace document colours Reemplazar colores del documento
|
||||
Page background Fondo de página
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 60.
|
|
|
@ -2316,6 +2316,8 @@ animation effects Off Désactivés
|
|||
Ink sensitivity Sensibilité à l’encre
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Aucune signature trouvée dans le cadre. Placez le cadre sur la signature ou augmentez la sensibilité à l’encre.
|
||||
Couldn't use the photo: {e} Impossible d’utiliser la photo : {e}
|
||||
Other colour… Autre couleur…
|
||||
Recent colours Couleurs récentes
|
||||
Couldn't follow linked PDF: {reason} Impossible de suivre le PDF lié : {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Le PDF lié s'est ouvert, mais sa destination nommée n'a pas été appliquée.
|
||||
The linked PDF opened, but its page destination was out of range. Le PDF lié s'est ouvert, mais sa page de destination est hors limites.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 39.
|
|
|
@ -2315,6 +2315,8 @@ animation effects Off Ki
|
|||
Ink sensitivity Tintaérzékenység
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. A keretben nem található aláírás. Húzza a keretet az aláírásra, vagy növelje a tintaérzékenységet.
|
||||
Couldn't use the photo: {e} A fénykép nem használható: {e}
|
||||
Other colour… Egyéb szín…
|
||||
Recent colours Legutóbbi színek
|
||||
Couldn't follow linked PDF: {reason} A hivatkozott PDF nem nyitható meg: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. A hivatkozott PDF megnyílt, de a nevesített cél nem lett alkalmazva.
|
||||
The linked PDF opened, but its page destination was out of range. A hivatkozott PDF megnyílt, de a céloldal a tartományon kívül esik.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 7 and column 44.
|
|
|
@ -2325,6 +2325,8 @@ animation effects Off Disattivati
|
|||
Ink sensitivity Sensibilità all’inchiostro
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Nessuna firma trovata nella cornice. Sposta la cornice sulla firma o aumenta la sensibilità all’inchiostro.
|
||||
Couldn't use the photo: {e} Impossibile usare la foto: {e}
|
||||
Other colour… Altro colore…
|
||||
Recent colours Colori recenti
|
||||
Couldn't follow linked PDF: {reason} Impossibile aprire il PDF collegato: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Il PDF collegato è stato aperto, ma la sua destinazione con nome non è stata applicata.
|
||||
The linked PDF opened, but its page destination was out of range. Il PDF collegato è stato aperto, ma la pagina di destinazione è fuori intervallo.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
|
|
@ -2316,6 +2316,8 @@ animation effects Off オフ
|
|||
Ink sensitivity インクの感度
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. 枠内に署名が見つかりません。枠を署名に合わせるか、インクの感度を上げてください。
|
||||
Couldn't use the photo: {e} 写真を使用できません: {e}
|
||||
Other colour… その他の色…
|
||||
Recent colours 最近使った色
|
||||
Couldn't follow linked PDF: {reason} リンク先の PDF を開けませんでした: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. リンク先の PDF を開きましたが、名前付き移動先は適用されませんでした。
|
||||
The linked PDF opened, but its page destination was out of range. リンク先の PDF を開きましたが、移動先のページが範囲外です。
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
|
|
@ -2304,6 +2304,8 @@ animation effects Off Өшірулі
|
|||
Ink sensitivity Сия сезімталдығы
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Жақтауда қолтаңба табылмады. Жақтауды қолтаңбаның үстіне жылжытыңыз немесе сия сезімталдығын арттырыңыз.
|
||||
Couldn't use the photo: {e} Суретті пайдалану мүмкін болмады: {e}
|
||||
Other colour… Басқа түс…
|
||||
Recent colours Соңғы түстер
|
||||
Reading colours Оқу түстері
|
||||
Replace document colours Құжат түстерін ауыстыру
|
||||
Black on white Ақ фонда қара
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 820 and column 12.
|
|
|
@ -2285,6 +2285,8 @@ animation effects Off Wyłączone
|
|||
Ink sensitivity Czułość na atrament
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. W ramce nie znaleziono podpisu. Przesuń ramkę na podpis lub zwiększ czułość na atrament.
|
||||
Couldn't use the photo: {e} Nie można użyć zdjęcia: {e}
|
||||
Other colour… Inny kolor…
|
||||
Recent colours Ostatnie kolory
|
||||
Reading colours Kolory do czytania
|
||||
Replace document colours Zastąp kolory dokumentu
|
||||
Page background Tło strony
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
|
|
@ -2330,6 +2330,8 @@ animation effects Off Desativados
|
|||
Ink sensitivity Sensibilidade à tinta
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Nenhuma assinatura encontrada no quadro. Mova o quadro sobre a assinatura ou aumente a sensibilidade à tinta.
|
||||
Couldn't use the photo: {e} Não foi possível usar a foto: {e}
|
||||
Other colour… Outra cor…
|
||||
Recent colours Cores recentes
|
||||
Couldn't follow linked PDF: {reason} Não foi possível abrir o PDF vinculado: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. O PDF vinculado foi aberto, mas seu destino nomeado não foi aplicado.
|
||||
The linked PDF opened, but its page destination was out of range. O PDF vinculado foi aberto, mas sua página de destino está fora do intervalo.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 9 and column 16.
|
|
|
@ -2229,6 +2229,8 @@ animation effects Off Выкл
|
|||
Ink sensitivity Чувствительность к чернилам
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. В рамке не найдена подпись. Наведите рамку на подпись или увеличьте чувствительность к чернилам.
|
||||
Couldn't use the photo: {e} Не удалось использовать фото: {e}
|
||||
Other colour… Другой цвет…
|
||||
Recent colours Недавние цвета
|
||||
Couldn't follow linked PDF: {reason} Не удалось открыть связанный PDF: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Связанный PDF открыт, но его именованное назначение не применено.
|
||||
The linked PDF opened, but its page destination was out of range. Связанный PDF открыт, но страница назначения вне допустимого диапазона.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 9 and column 16.
|
|
|
@ -2321,6 +2321,8 @@ animation effects Off Izklopljeni
|
|||
Ink sensitivity Občutljivost za črnilo
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. V okvirju ni bilo najdenega podpisa. Premaknite okvir nad podpis ali povečajte občutljivost za črnilo.
|
||||
Couldn't use the photo: {e} Fotografije ni bilo mogoče uporabiti: {e}
|
||||
Other colour… Druga barva…
|
||||
Recent colours Nedavne barve
|
||||
Couldn't follow linked PDF: {reason} Povezanega PDF-ja ni bilo mogoče odpreti: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Povezani PDF se je odprl, vendar njegov poimenovani cilj ni bil uporabljen.
|
||||
The linked PDF opened, but its page destination was out of range. Povezani PDF se je odprl, vendar je ciljna stran zunaj obsega.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 9 and column 16.
|
|
|
@ -2218,6 +2218,8 @@ animation effects Off ఆఫ్
|
|||
Ink sensitivity ఇంక్ సున్నితత్వం
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. ఫ్రేమ్లో సంతకం కనబడలేదు. ఫ్రేమ్ను సంతకం మీదకు జరపండి లేదా ఇంక్ సున్నితత్వాన్ని పెంచండి.
|
||||
Couldn't use the photo: {e} ఫోటోను ఉపయోగించలేకపోయాం: {e}
|
||||
Other colour… ఇతర రంగు…
|
||||
Recent colours ఇటీవలి రంగులు
|
||||
Reading colours చదవడానికి రంగులు
|
||||
Replace document colours పత్రం రంగులను మార్చు
|
||||
Page background పేజీ నేపథ్యం
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 13 and column 16.
|
|
|
@ -2302,6 +2302,8 @@ animation effects Off Kapalı
|
|||
Ink sensitivity Mürekkep hassasiyeti
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. Çerçevede imza bulunamadı. Çerçeveyi imzanın üzerine taşıyın veya mürekkep hassasiyetini artırın.
|
||||
Couldn't use the photo: {e} Fotoğraf kullanılamadı: {e}
|
||||
Other colour… Diğer renk…
|
||||
Recent colours Son kullanılan renkler
|
||||
Reading colours Okuma renkleri
|
||||
Replace document colours Belge renklerini değiştir
|
||||
Black on white Beyaz üzerinde siyah
|
||||
|
|
|
|||
|
Can't render this file because it has a wrong number of fields in line 7.
|
|
|
@ -2338,6 +2338,8 @@ animation effects Off Вимкнено
|
|||
Ink sensitivity Чутливість до чорнила
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. У рамці не знайдено підпису. Наведіть рамку на підпис або збільште чутливість до чорнила.
|
||||
Couldn't use the photo: {e} Не вдалося використати фото: {e}
|
||||
Other colour… Інший колір…
|
||||
Recent colours Нещодавні кольори
|
||||
Couldn't follow linked PDF: {reason} Не вдалося відкрити пов’язаний PDF: {reason}
|
||||
The linked PDF opened, but its named destination was not applied. Пов’язаний PDF відкрито, але його іменоване призначення не застосовано.
|
||||
The linked PDF opened, but its page destination was out of range. Пов’язаний PDF відкрито, але сторінка призначення поза межами діапазону.
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
|
|
@ -2280,6 +2280,8 @@ animation effects Off 关
|
|||
Ink sensitivity 墨迹灵敏度
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. 框内未找到签名。请将框移到签名上,或提高墨迹灵敏度。
|
||||
Couldn't use the photo: {e} 无法使用该照片:{e}
|
||||
Other colour… 其他颜色…
|
||||
Recent colours 最近使用的颜色
|
||||
Couldn't follow linked PDF: {reason} 无法打开链接的 PDF:{reason}
|
||||
The linked PDF opened, but its named destination was not applied. 已打开链接的 PDF,但未应用其命名目标。
|
||||
The linked PDF opened, but its page destination was out of range. 已打开链接的 PDF,但其页面目标超出范围。
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 9 and column 16.
|
|
|
@ -2179,6 +2179,8 @@ animation effects Off 關
|
|||
Ink sensitivity 墨跡靈敏度
|
||||
No signature was found in the frame. Move the frame over the signature or raise the ink sensitivity. 框內找不到簽名。請將框移到簽名上,或提高墨跡靈敏度。
|
||||
Couldn't use the photo: {e} 無法使用此相片:{e}
|
||||
Other colour… 其他顏色…
|
||||
Recent colours 最近使用的顏色
|
||||
Reading colours 閱讀色彩
|
||||
Replace document colours 取代文件色彩
|
||||
Page background 頁面背景
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 9 and column 16.
|
Loading…
Reference in New Issue