Simplify canvas control focus guard for strict lint

This commit is contained in:
2026-09-11 11:08:37 -07:00
parent 82fd0acf64
commit abffa4b3f0
@@ -158,8 +158,7 @@ impl<Message: Clone, R: renderer::Renderer> Widget<Message, Theme, R> for Contro
if matches!( if matches!(
event, event,
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
) { ) && !layout
if !layout
.bounds() .bounds()
.intersection(viewport) .intersection(viewport)
.is_some_and(|bounds| cursor.is_over(bounds)) .is_some_and(|bounds| cursor.is_over(bounds))
@@ -167,7 +166,6 @@ impl<Message: Clone, R: renderer::Renderer> Widget<Message, Theme, R> for Contro
state.focused = false; state.focused = false;
} }
} }
}
if matches!(event, Event::Window(iced::window::Event::Unfocused)) { if matches!(event, Event::Window(iced::window::Event::Unfocused)) {
state.focused = false; state.focused = false;
} }