Merge #12296 into the merge queue batch

Mixer Brush: the load swatch shows a checkerboard or the sampled tip image (#11953)

# Conflicts:
#	crates/ui-egui/src/panels/brush_controls.rs
This commit is contained in:
David Mann committed 2026-11-19 22:27:43 +01:00
commit 82af382c06
2 files changed
+441

No files matched your search

@@ -0,0 +1,144 @@
//! The Mixer Brush's Current Brush Load swatch shows what the reservoir holds (#11953): a solid
//! colour after Load Brush, the sampled 64 × 64 tip image after an ⌥-click (an edge between green
//! and blue shows green on the left and blue on the right), and a checkerboard after Clean Brush.
use egui::{Modifiers, Rect, Shape, TextureId, vec2};
use egui_kittest::Harness;
use egui_kittest::kittest::Queryable;
use serde_json::json;
use super::{mixer_load_image, mixer_load_texture};
use crate::PhotocraftApp;
use crate::canvas::{ToolEvent, tool_event};
use crate::state::Tool;
const GREEN: [f32; 4] = [0.0, 1.0, 0.0, 1.0];
const BLUE: [f32; 4] = [0.0, 0.0, 1.0, 1.0];
/// A pixel layer green left of x 100 and blue from there on, with the Mixer Brush active.
fn app() -> PhotocraftApp {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
app.run("file.new", json!({"width": 200, "height": 100, "background": "white"})).unwrap();
app.run("layer.new.layer", json!({})).unwrap();
app.run("select.rect", json!({"x": 0, "y": 0, "width": 100, "height": 100})).unwrap();
app.run("edit.fill", json!({"contents": "color", "color": GREEN})).unwrap();
app.run("select.rect", json!({"x": 100, "y": 0, "width": 100, "height": 100})).unwrap();
app.run("edit.fill", json!({"contents": "color", "color": BLUE})).unwrap();
app.run("select.deselect", json!({})).unwrap();
app.run("tools.setColors", json!({"foreground": "#ff0000", "background": "#ffffff"})).unwrap();
app.ui.tool = Tool::MixerBrush;
crate::paint_mouse::sync_tool_brush(&mut app);
app.run("tools.setBrush", json!({"brush": {"size": 40, "hardness": 1.0}})).unwrap();
app
}
fn harness() -> Harness<'static, PhotocraftApp> {
let mut h = Harness::builder().with_size(vec2(1600.0, 120.0)).build_ui_state(
|ui, app: &mut PhotocraftApp| {
if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
return;
}
crate::panels::options_bar(app, ui);
},
app(),
);
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::Studio);
h.run_steps(4);
h
}
fn flatten<'a>(shape: &'a Shape, out: &mut Vec<&'a Shape>) {
if let Shape::Vec(v) = shape {
v.iter().for_each(|s| flatten(s, out));
} else {
out.push(shape);
}
}
/// What the swatch draws this frame: the fill colours of its rectangles and the textures of its
/// images, inside the swatch's chip.
fn swatch(h: &Harness<'static, PhotocraftApp>) -> (Vec<egui::Color32>, Vec<TextureId>) {
let r = h.get_by_label("Current Brush Load").rect();
let chip = Rect::from_min_size(egui::pos2(r.left() + 4.0, r.center().y - 8.0), vec2(16.0, 16.0)).expand(0.5);
let (mut fills, mut textures) = (Vec::new(), Vec::new());
for clipped in &h.output().shapes {
let mut all = Vec::new();
flatten(&clipped.shape, &mut all);
for s in all {
match s {
Shape::Rect(rs) if chip.contains_rect(rs.rect) => fills.push(rs.fill),
Shape::Mesh(m) if m.texture_id != TextureId::default() && chip.contains_rect(m.calc_bounds()) => textures.push(m.texture_id),
_ => {}
}
}
}
(fills, textures)
}
fn has_fonts(h: &Harness<'static, PhotocraftApp>) -> bool {
h.ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into())))
}
#[test]
fn the_sampled_image_keeps_its_left_right_top_and_bottom() {
let load: Vec<[f32; 4]> = (0..64 * 64).map(|i| if i % 64 < 32 { GREEN } else { BLUE }).collect();
let image = mixer_load_image(&load);
assert_eq!(image.size, [64, 64]);
assert_eq!(image[(10, 32)], egui::Color32::from_rgb(0, 255, 0));
assert_eq!(image[(54, 32)], egui::Color32::from_rgb(0, 0, 255));
// Row 0 is the tip's top, as `load_at` reads it; alpha is kept and values past 0..1 clamp.
let load: Vec<[f32; 4]> = (0..64 * 64).map(|i| if i < 32 * 64 { [1.0, 0.0, 0.0, 0.5] } else { [1.5, -0.2, 0.0, 1.0] }).collect();
let image = mixer_load_image(&load);
let (top, bottom) = (image[(32, 10)], image[(32, 54)]);
assert_eq!((top.r() > 0, top.g(), top.b(), top.a()), (true, 0, 0, 128), "top of the image {top:?}");
assert_eq!(bottom, egui::Color32::from_rgb(255, 0, 0), "bottom of the image");
}
#[test]
fn the_swatch_shows_the_load_the_tip_image_or_a_checkerboard() {
let mut h = harness();
if !has_fonts(&h) {
return;
}
// Load Brush: one solid red, no image.
h.state_mut().run("brush.mixer.load", json!({})).unwrap();
h.run_steps(3);
let (fills, textures) = swatch(&h);
assert!(fills.contains(&egui::Color32::from_rgb(255, 0, 0)) && textures.is_empty(), "{fills:?} {textures:?}");
// ⌥-click on the green/blue edge: the sampled tip image, green left and blue right.
tool_event(h.state_mut(), ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 }, Modifiers::ALT);
tool_event(h.state_mut(), ToolEvent::Up { x: 100.0, y: 50.0 }, Modifiers::ALT);
h.run_steps(3);
let load = h.state().session.tools.mixer.spatial.clone().expect("the ⌥-click loads the tip image");
let (_, textures) = swatch(&h);
let sampled = mixer_load_texture(&h.ctx, &load).id();
assert_eq!(textures, [sampled], "the swatch draws the texture of the sampled load");
let image = mixer_load_image(&load);
let (left, right) = (image[(16, 32)], image[(48, 32)]);
assert!(left.g() > 200 && left.b() < 50, "left of the image {left:?}");
assert!(right.b() > 200 && right.g() < 50, "right of the image {right:?}");
h.run_steps(3);
assert_eq!(swatch(&h).1, [sampled], "an unchanged load keeps its texture");
// ⌥-click in the green: a new load, uploaded again.
tool_event(h.state_mut(), ToolEvent::Down { x: 30.0, y: 50.0, pressure: 1.0 }, Modifiers::ALT);
tool_event(h.state_mut(), ToolEvent::Up { x: 30.0, y: 50.0 }, Modifiers::ALT);
h.run_steps(3);
let green = h.state().session.tools.mixer.spatial.clone().expect("the second ⌥-click loads the tip image");
let (_, textures) = swatch(&h);
assert!(textures != [sampled] && textures == [mixer_load_texture(&h.ctx, &green).id()], "the new load's texture {textures:?}");
// A new foreground: the next stroke loads it, so the swatch shows that colour, not the image.
h.state_mut().run("tools.setColors", json!({"foreground": "#ffff00"})).unwrap();
h.run_steps(3);
let (fills, textures) = swatch(&h);
assert!(fills.contains(&egui::Color32::from_rgb(255, 255, 0)) && textures.is_empty(), "the new foreground {fills:?} {textures:?}");
// Clean Brush: a checkerboard of two greys, no image.
h.state_mut().run("brush.mixer.clean", json!({})).unwrap();
h.run_steps(3);
let (fills, textures) = swatch(&h);
let greys: std::collections::BTreeSet<_> = fills.iter().filter(|c| c.r() == c.g() && c.g() == c.b() && c.r() > 150).map(|c| c.r()).collect();
assert!(greys.len() >= 2 && textures.is_empty(), "checkerboard {fills:?} {textures:?}");
}
+297
View File
@@ -0,0 +1,297 @@
use super::{Align2, BlendMode, Color32, PhotocraftApp, Rect, Sense, Stroke, StrokeKind, Tokens, c32, icons, json, pos2, starts_blend_group, vec2, widgets};
/// A painting tool's Mode dropdown over `modes` (`None` is Clear); the wheel over it steps the
/// mode. Returns the mode picked this frame. A list of every blend mode draws the Layers panel's
/// group lines (#5532; Clear starts none); a short one (the Healing Brush's) draws none.
/// `threshold` names Normal "Threshold", as the reference does in an Indexed Color document.
pub(super) fn tool_mode_dropdown(
ui: &mut egui::Ui,
id: &str,
modes: &[Option<BlendMode>],
current: Option<BlendMode>,
threshold: bool,
) -> Option<Option<BlendMode>> {
let label = |m: &Option<BlendMode>| match m {
Some(BlendMode::Normal) if threshold => tl!("Threshold"),
_ => m.map_or("Clear", BlendMode::label),
};
let opts: Vec<(Option<BlendMode>, &str)> = modes.iter().map(|m| (*m, label(m))).collect();
let grouped = BlendMode::LAYER_MODES.iter().all(|m| modes.contains(&Some(*m)));
let mut mode = current;
let chosen = widgets::dropdown_wheel_grouped(ui, id, tl!("Mode"), &mut mode, &opts, 96.0, |m| grouped && m.is_some_and(starts_blend_group)).0;
chosen.last().copied()
}
/// The Brush's or Pencil's Mode dropdown: the blend modes, with Photoshop's painting-only Clear
/// after Dissolve (#3439). Clear erases with the brush (`clear`); it shows while chosen, or while
/// `~` is held (`held`). The wheel over it steps the mode, as over the Layers panel's (#2061).
pub(super) fn paint_mode_dropdown(ui: &mut egui::Ui, id: &str, b: &mut photocraft_engine::BrushSettings, clear: &mut bool, held: bool) {
let opts = crate::brush_mode_menu::choices();
let mut mode = if *clear || held {
(None, false)
} else if b.behind {
(None, true)
} else {
(Some(b.mode), false)
};
if !widgets::dropdown_wheel_grouped(ui, id, tl!("Mode"), &mut mode, &opts, 96.0, |m| m.0.is_some_and(starts_blend_group)).0.is_empty() {
*clear = mode == (None, false);
b.behind = mode.1;
if mode.1 {
b.mode = BlendMode::Normal;
}
if let Some(m) = mode.0 {
b.mode = m;
}
}
}
/// The Pattern Stamp's Mode dropdown: the blend modes with Behind after Dissolve and no Clear, as
/// the reference application lists them (#12879). Behind is the tool's own brush's, as its mode;
/// picking another mode leaves it. The wheel steps it as it steps the other Mode dropdowns.
/// Without `behind_enabled` (the Background is the active layer) Behind is greyed, as in the
/// Shift+right-click menu, and the wheel and the keys step past it.
pub(super) fn pattern_stamp_mode_dropdown(ui: &mut egui::Ui, id: &str, b: &mut photocraft_engine::BrushSettings, behind_enabled: bool, threshold: bool) {
let mut opts = crate::brush_mode_menu::pattern_stamp_choices();
if threshold && let Some(normal) = opts.iter_mut().find(|o| o.0 == (Some(BlendMode::Normal), false)) {
normal.1 = tl!("Threshold");
}
let before = if b.behind { (None, true) } else { (Some(b.mode), false) };
let mut mode = before;
let groups = |m: &(Option<BlendMode>, bool)| m.0.is_some_and(starts_blend_group);
if !widgets::dropdown_wheel_grouped_enabled(ui, id, tl!("Mode"), &mut mode, &opts, 96.0, groups, |m| behind_enabled || !m.1).0.is_empty() {
let mode = crate::brush_mode_menu::pattern_stamp_pick(before, mode, behind_enabled);
b.behind = mode.1;
b.mode = mode.0.unwrap_or(BlendMode::Normal);
}
}
/// The Eraser's Smoothing %: whole numbers 0..100 that say when a typed value was past them, for
/// the reference's alert (#11938). Returns the field and whether to show the alert.
pub(super) fn smoothing_field_alerting(ui: &mut egui::Ui, b: &mut photocraft_engine::BrushSettings, width: f32) -> (egui::Response, bool) {
let mut sm = b.smoothing.amount * 100.0;
let (r, alert) = widgets::value_field_whole_alerting(ui, tl!("Smoothing"), &mut sm, 0.0..=100.0, "%", width);
if r.changed() {
b.smoothing.enabled = true;
b.smoothing.amount = (sm / 100.0).clamp(0.0, 1.0);
}
(r, alert)
}
/// Options-bar Smoothing % (the brush's stroke smoothing; the live stroke and the commit use it).
pub(super) fn smoothing_field(ui: &mut egui::Ui, b: &mut photocraft_engine::BrushSettings, width: f32) -> egui::Response {
let mut sm = (b.smoothing.amount * 100.0).round();
let r = widgets::value_field_named(ui, tl!("Smoothing"), &mut sm, 0.0..=100.0, "%", width);
if r.changed() {
b.smoothing.enabled = true;
b.smoothing.amount = (sm / 100.0).clamp(0.0, 1.0);
}
r
}
/// Options-bar gear beside Smoothing: Photoshop's smoothing options popup, edited on the brush
/// like the Smoothing % (so they stay per tool and reach the live stroke and the commit).
/// `brush` adds the Brush's "Smoothing Options" title (#11813); the Eraser keeps its popup as it was.
pub(super) fn smoothing_options(ui: &mut egui::Ui, b: &mut photocraft_engine::BrushSettings, brush: bool) {
let resp = icons::button(ui, "settings", 24.0, false, tl!("Set additional smoothing options"));
let resp = crate::brush_picker::named(resp, "Set additional smoothing options");
egui::Popup::from_toggle_button_response(&resp).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {
let s = &mut b.smoothing;
if brush {
ui.label(egui::RichText::new(tl!("Smoothing Options")).strong());
}
// At 0 % there is no smoothing to tune: the four are greyed and keep their values, as in
// the reference application (#11939). Rounded like the Smoothing field, so a value that
// shows as 0 % greys them too.
let on = (s.amount * 100.0).round() > 0.0;
ui.add_enabled_ui(on, |ui| {
widgets::checkbox(ui, &mut s.pulled_string, tl!("Pulled String Mode"));
widgets::checkbox(ui, &mut s.catch_up, tl!("Stroke Catch-up"));
widgets::checkbox(ui, &mut s.catch_up_on_end, tl!("Catch-up on Stroke End"));
widgets::checkbox(ui, &mut s.adjust_for_zoom, tl!("Adjust for Zoom"));
});
});
}
/// The sampled tip image of a Mixer Brush load (64 × 64 straight RGBA cells, row by row) as the
/// Current Brush Load swatch draws it.
pub(crate) fn mixer_load_image(load: &[[f32; 4]]) -> egui::ColorImage {
let bytes: Vec<u8> = load.iter().flat_map(|c| c.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8)).collect();
egui::ColorImage::from_rgba_unmultiplied([64, 64], &bytes)
}
/// The swatch's texture of `load`, uploaded again only when the load changes.
fn mixer_load_texture(ctx: &egui::Context, load: &[[f32; 4]]) -> egui::TextureHandle {
use std::hash::{Hash, Hasher};
let image = mixer_load_image(load);
let mut hasher = std::collections::hash_map::DefaultHasher::new();
image.as_raw().hash(&mut hasher);
let hash = hasher.finish();
let key = egui::Id::unique("mixer-load-swatch-image");
if let Some((_, tex)) = ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(key)).filter(|(h, _)| *h == hash) {
return tex;
}
let tex = ctx.load_texture("mixer-load-swatch", image, egui::TextureOptions::LINEAR);
ctx.data_mut(|d| d.insert_temp(key, (hash, tex.clone())));
tex
}
#[cfg(test)]
#[path = "../mixer_load_swatch_tests.rs"]
mod mixer_load_swatch_tests;
/// A Useful mixer brush combinations entry: its label and the Wet, Load and Mix it sets.
type MixerCombination = (&'static str, Option<(f32, f32, f32)>);
/// The Mixer Brush's Useful mixer brush combinations, in the reference's order: each entry's label
/// and the Wet, Load and Mix (0..1) it sets. Custom, the first, sets nothing.
pub(crate) const MIXER_COMBINATIONS: [MixerCombination; 13] = [
("Custom", None),
("Dry", Some((0.0, 0.5, 0.0))),
("Dry, Light Load", Some((0.0, 0.05, 0.0))),
("Dry, Heavy Load", Some((0.0, 1.0, 0.0))),
("Moist", Some((0.1, 0.05, 0.5))),
("Moist, Light Mix", Some((0.1, 0.05, 0.0))),
("Moist, Heavy Mix", Some((0.1, 0.05, 1.0))),
("Wet", Some((0.5, 0.5, 0.5))),
("Wet, Light Mix", Some((0.5, 0.5, 0.0))),
("Wet, Heavy Mix", Some((0.5, 0.5, 1.0))),
("Very Wet", Some((1.0, 0.5, 0.5))),
("Very Wet, Light Mix", Some((1.0, 0.5, 0.0))),
("Very Wet, Heavy Mix", Some((1.0, 0.5, 1.0))),
];
/// The entries of [`MIXER_COMBINATIONS`] a separator line goes above: Dry, Moist, Wet, Very Wet.
const MIXER_COMBINATION_GROUPS: [usize; 4] = [1, 4, 7, 10];
/// Mixer Brush: the Useful mixer brush combinations dropdown (#11946). Picking an entry sets Wet,
/// Load and Mix together (Flow stays) and keeps showing it, also after a value is typed; Custom
/// sets nothing. `picked` is the entry shown.
pub(super) fn mixer_combination_dropdown(
ui: &mut egui::Ui,
picked: &mut usize,
m: &mut photocraft_engine::paint::mixer::MixerSettings,
) -> Option<egui::Response> {
const ID: &str = "mixer-combination";
let opts: Vec<(usize, &str)> = MIXER_COMBINATIONS.iter().enumerate().map(|(i, (label, _))| (i, *label)).collect();
let mut shown = (*picked).min(MIXER_COMBINATIONS.len() - 1);
let chosen =
widgets::dropdown_wheel_grouped(ui, ID, tl!("Useful mixer brush combinations"), &mut shown, &opts, 132.0, |i| MIXER_COMBINATION_GROUPS.contains(i)).0;
if let Some(&i) = chosen.last() {
*picked = i;
if let Some((wet, load, mix)) = MIXER_COMBINATIONS[i].1 {
(m.wet, m.load, m.mix) = (wet, load, mix);
}
}
ui.ctx().read_response(ui.make_persistent_id(egui::IdSalt::new(ID)))
}
#[cfg(test)]
#[path = "../mixer_blend_combination_tests.rs"]
mod mixer_blend_combination_tests;
#[cfg(test)]
#[path = "../mixer_load_solid_colors_tests.rs"]
mod mixer_load_solid_colors_tests;
/// Mixer Brush: the Current Brush Load swatch shows the paint the next stroke starts with: the
/// loaded colour, the sampled tip image after an ⌥-click, or a transparency checkerboard when the
/// brush is clean. Its menu holds Load Brush, Clean Brush, a separator and the checkable Load Solid
/// Colors Only.
pub(super) fn mixer_load_swatch(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
let t = Tokens::get(ui.ctx());
let (r, _) = ui.allocate_exact_size(vec2(40.0, 26.0), Sense::hover());
let resp = ui.interact(r, ui.scope_id().with("mixer-brush-load"), Sense::click());
if resp.hovered() {
ui.painter().rect_filled(r, t.radius_sm, t.hover);
}
let chip = Rect::from_min_size(pos2(r.left() + 4.0, r.center().y - 8.0), vec2(16.0, 16.0));
let p = ui.painter();
// What the reservoir holds (#11953): the loaded colour, the sampled tip image of an ⌥-click
// (kept while the foreground stays), or a transparency checkerboard when the brush is clean.
let mixer = &app.session.tools.mixer;
let foreground = app.session.tools.foreground;
match mixer.next_load(foreground) {
Some(c) => match mixer.spatial.as_deref().filter(|load| load.len() == 64 * 64 && mixer.color == Some(foreground)) {
Some(load) => {
widgets::checker(p, chip, 4.0);
let tex = mixer_load_texture(ui.ctx(), load);
p.image(tex.id(), chip, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
}
None => {
p.rect_filled(chip, 2.0, c32(c));
}
},
None => widgets::checker(p, chip, 4.0),
}
p.rect_stroke(chip, 2.0, Stroke::new(1.0, t.field_border), StrokeKind::Outside);
icons::paint(ui, Rect::from_center_size(pos2(r.right() - 9.0, r.center().y), vec2(10.0, 10.0)), "chevron-down", 9.0, t.text_faint);
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, tl!("Current Brush Load")));
let resp = resp.on_hover_text(tl!("Current Brush Load"));
let (mut run, mut solid_colors) = (None, None);
egui::Popup::menu(&resp).show(|ui| {
if ui.button(tl!("Load Brush")).clicked() {
run = Some("brush.mixer.load");
}
if ui.button(tl!("Clean Brush")).clicked() {
run = Some("brush.mixer.clean");
}
ui.separator();
// Load Solid Colors Only: ⌥-click loads one colour, not the tip image (#11952).
let mut solid = app.session.tools.brush.mixer.solid_colors_only;
if ui.checkbox(&mut solid, tl!("Load Solid Colors Only")).changed() {
solid_colors = Some(solid);
}
});
if let Some(id) = run
&& let Err(e) = app.run(id, json!({}))
{
app.ui.status = e;
app.ui.status_error = true;
}
if let Some(on) = solid_colors
&& let Err(e) = app.run("tools.setBrush", json!({"brush": {"mixer": {"solidColorsOnly": on}}}))
{
app.ui.status = e;
app.ui.status_error = true;
}
}
/// Options-bar brush chip: a click shows or hides Photoshop's Brush Preset picker below it (size,
/// hardness, the preset library), the one a right-click on the canvas opens.
pub(super) fn brush_preset_chip(ui: &mut egui::Ui, b: &photocraft_engine::BrushSettings, state: &mut crate::state::UiState) {
let t = Tokens::get(ui.ctx());
let (r, _) = ui.allocate_exact_size(vec2(44.0, 30.0), Sense::hover());
let resp = ui.interact(r, crate::brush_picker::chip_id(), Sense::click());
if resp.hovered() || state.brush_picker.is_some() {
ui.painter().rect_filled(r, t.radius_sm, t.hover);
}
let c = pos2(r.left() + 14.0, r.top() + 11.0);
// Photoshop's white tip vanishes on light chrome; light themes use their icon colour.
let tip = if t.dark() { Color32::WHITE } else { t.icon };
// The brush's own tip, as the Brush Preset picker's thumbnails draw it: the engine's falloff
// for its hardness, its angle and roundness, a sampled tip's shape.
let tex = crate::brush_preview::tip_texture(ui.ctx(), "options-bar-chip", &b.tip, (b.hardness, b.angle, b.roundness), 32, tip);
let uv = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0));
ui.painter().image(tex.id(), Rect::from_center_size(c, vec2(14.0, 14.0)), uv, Color32::WHITE);
ui.painter().text(pos2(c.x, r.bottom() - 5.0), Align2::CENTER_CENTER, format!("{}", b.size.round() as i64), egui::FontId::proportional(9.5), t.text_dim);
icons::paint(ui, Rect::from_center_size(pos2(r.right() - 9.0, c.y), vec2(10.0, 10.0)), "chevron-down", 9.0, t.text_faint);
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, tl!("Brush Preset picker")));
// The Brush's and the Background Eraser's own text (#11813, #11909); the other tools keep theirs.
let tip = if matches!(state.tool, crate::state::Tool::Brush | crate::state::Tool::BackgroundEraser) {
tl!("Click to open the Brush Preset picker")
} else {
tl!("Brush Preset picker")
};
if resp.on_hover_text(tip).clicked() {
if state.brush_picker.is_some() {
crate::brush_picker::close(state);
} else {
crate::brush_picker::open(state, ui.ctx(), [r.left(), r.bottom() + 2.0]);
}
}
}
#[cfg(test)]
#[path = "../smoothing_options_greyed_tests.rs"]
mod smoothing_options_greyed_tests;