mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 19:26:51 -04:00
Make the space between popup menu rows part of the rows. (#4624)
Context menus inherited a 6 pt item gap that belonged to neither button, so a drag across Merge Down or an adjustment list fell into dead space. Popup menus now stack their rows, and Pro rows use a square hover. (#4602) Co-authored-by: Brandon Thomas <[email protected]>
This commit is contained in:
1 parent
53db0f5c1f
commit
d825840bce
1 file changed
+7
-1
@@ -17,6 +17,9 @@ pub use type_ahead::list_open as dropdown_list_open;
|
||||
/// The setting is local to this popup's Ui and leaves other themes unchanged.
|
||||
pub fn style_spectrum_popup_menu(ui: &mut Ui) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
// The 6 pt gap between rows was outside both buttons, so a drag across a menu
|
||||
// dropped the highlight (#4602). Padding stays inside the row, which is the hit target.
|
||||
ui.spacing_mut().item_spacing.y = 0.0;
|
||||
if !t.pro {
|
||||
return;
|
||||
}
|
||||
@@ -26,7 +29,9 @@ pub fn style_spectrum_popup_menu(ui: &mut Ui) {
|
||||
v.widgets.hovered.bg_fill = t.accent;
|
||||
v.widgets.hovered.fg_stroke = Stroke::new(1.0, Color32::WHITE);
|
||||
v.widgets.hovered.bg_stroke = Stroke::NONE;
|
||||
v.widgets.hovered.corner_radius = CornerRadius::same(3);
|
||||
v.widgets.inactive.corner_radius = CornerRadius::ZERO;
|
||||
v.widgets.hovered.corner_radius = CornerRadius::ZERO;
|
||||
v.widgets.active.corner_radius = CornerRadius::ZERO;
|
||||
}
|
||||
|
||||
/// An accent insertion line on one edge of `r` while a drag hovers it (vertical: on its left or,
|
||||
@@ -1751,6 +1756,7 @@ mod tests {
|
||||
let original_padding = ui.spacing().button_padding;
|
||||
let original_hover = ui.visuals().widgets.hovered.fg_stroke;
|
||||
super::style_spectrum_popup_menu(ui);
|
||||
assert_eq!(ui.spacing().item_spacing.y, 0.0, "{kind:?}: menu rows meet so the gap is selectable");
|
||||
if tokens.pro {
|
||||
assert_eq!(ui.spacing().button_padding, egui::vec2(10.0, 4.0));
|
||||
assert_eq!(ui.visuals().widgets.hovered.bg_fill, tokens.accent);
|
||||
|
||||
Reference in new issue
Block a user