mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 02:07:10 +01:00
Color Wheel: the contrast row's chips show the focus outline of the color fields
The fix chip drew no focus indicator, and the background chip recolored its own border. Both now draw the outline a focused color field draws around itself (widgets::focus_outline).
This commit is contained in:
1 parent
767c0798a9
commit
86f1489895
3 files changed
+4
-5
No files matched your search
@@ -1106,9 +1106,7 @@ fn contrast_row(app: &mut VectorcraftApp, ui: &mut Ui, m: &Measured) -> Option<C
|
||||
Some(c) => widgets::swatch_tile(ui, rect, &Paint::solid(c), false, false),
|
||||
None => widgets::swatch_tile(ui, rect, &Paint::None, false, false),
|
||||
}
|
||||
if chip_resp.has_focus() {
|
||||
ui.painter().rect_stroke(rect, 0.0, ui.visuals().selection.stroke, StrokeKind::Inside);
|
||||
}
|
||||
widgets::focus_outline(ui, &chip_resp, rect);
|
||||
let enabled = ui.is_enabled();
|
||||
let value = chip.map(|c| hex(bytes(cms::active().display_rgb(&c))));
|
||||
chip_resp.widget_info(|| egui::WidgetInfo {
|
||||
@@ -1163,6 +1161,7 @@ fn fix_chip(ui: &mut Ui, answer: Option<&Value>, aa: bool, aaa: Option<bool>) ->
|
||||
};
|
||||
let (rect, resp) = ui.allocate_exact_size(vec2(CHIP, CHIP), egui::Sense::click());
|
||||
widgets::swatch_tile(ui, rect, &Paint::solid(color), false, false);
|
||||
widgets::focus_outline(ui, &resp, rect);
|
||||
let label = crate::i18n::fmt(tl!("The closest color that passes {level}: click to apply it."), &[("level", name)]);
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), &label));
|
||||
let resp = resp.on_hover_text(&label);
|
||||
|
||||
@@ -42,7 +42,7 @@ pub use color::{
|
||||
color_slider_stepped, color_slider_valued, harmony_wheel, hex_field, hex_field_named, hsb32, hue_ring, recolor_wheel, region_texture,
|
||||
ring_markers, ring_square, segment_color, segment_color_on, segmented_wheel, stepped_area, wheel_of,
|
||||
};
|
||||
pub(crate) use color::{HEX_FIELD_CHARS, color_rail_bar, focus_by_pointer, hex_text, pointer_phase};
|
||||
pub(crate) use color::{HEX_FIELD_CHARS, color_rail_bar, focus_by_pointer, focus_outline, hex_text, pointer_phase};
|
||||
#[cfg(test)]
|
||||
pub(crate) use color::{SHADE, shade_cells, shade_edges};
|
||||
pub use drag::{
|
||||
|
||||
@@ -383,7 +383,7 @@ fn arrow_steps(ui: &Ui, id: egui::Id, horizontal: bool, vertical: bool) -> (f32,
|
||||
}
|
||||
|
||||
/// The focus outline of a focused color control.
|
||||
fn focus_outline(ui: &Ui, resp: &Response, rect: Rect) {
|
||||
pub(crate) fn focus_outline(ui: &Ui, resp: &Response, rect: Rect) {
|
||||
if ui.memory(|m| m.has_focus(resp.id)) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
ui.painter().rect_stroke(rect.expand(2.0), 0.0, Stroke::new(1.0, t.accent), StrokeKind::Outside);
|
||||
|
||||
Reference in new issue
Block a user