mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-14 19:27:01 -04:00
Fix #316: the section eye stays while the pointer is on it
The eye was drawn only while the header itself was hovered; with the pointer on the eye, egui reports the eye (on top) as hovered and not the header, so the eye vanished under the pointer and could not be clicked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01912WaK6Rmew3wxZuPyX7E8
This commit is contained in:
1 file changed
+4
-1
@@ -270,8 +270,11 @@ pub fn section_header(ui: &mut Ui, id: &str, title: &str, open: bool, enabled: O
|
||||
paint(p, chev, if open { Icon::ChevronDown } else { Icon::ChevronRight }, t.text_label);
|
||||
p.text(pos2(r.left() + 44.0, r.center().y), Align2::LEFT_CENTER, title, t.semibold(14.0), t.text);
|
||||
let mut toggled = None;
|
||||
// shown while the pointer is anywhere on the header: `resp.hovered()` turns false as soon as the
|
||||
// pointer is over the eye itself (the eye is on top), which hid the eye before it could be
|
||||
// clicked (issue #316)
|
||||
if let Some(on) = enabled
|
||||
&& (resp.hovered() || !on)
|
||||
&& (ui.rect_contains_pointer(r) || !on)
|
||||
{
|
||||
let eye = Rect::from_center_size(pos2(r.right() - 34.0, r.center().y), vec2(18.0, 18.0));
|
||||
let er = ui.interact(eye, ui.id().with(("eye", id)), Sense::click());
|
||||
|
||||
Reference in new issue
Block a user