wgui: MouseCancel event couldn't propagate all the way down (Closes #588)

This commit is contained in:
Aleksander 2026-07-22 22:23:44 +02:00 committed by galister
parent e1fb392297
commit 7f6caca0f8
3 changed files with 10 additions and 5 deletions

View File

@ -508,11 +508,11 @@ fn register_event_mouse_release(
state.sticky_down = !state.sticky_down;
}
common.alterables.trigger_haptics();
common.alterables.play_sound(WguiSoundType::ButtonRelease);
common.alterables.mark_redraw();
if state.down {
common.alterables.trigger_haptics();
common.alterables.play_sound(WguiSoundType::ButtonRelease);
common.alterables.mark_redraw();
state.down = false;
if state.hovered {
anim_hover(

View File

@ -471,6 +471,7 @@ impl Layout {
&mut self.get_event_params(l, node_id, style, alterables),
widget_id,
event,
event_result,
)?;
if res_priority.can_propagate() {

View File

@ -561,13 +561,17 @@ impl WidgetState {
}
// this is called before calling children of this widget
pub fn process_event_priority(
pub fn process_event_priority<'a>(
&mut self,
params: &mut EventParams,
widget_id: WidgetID,
event: &Event,
event_result: &'a mut EventResult,
) -> anyhow::Result<EventResult> {
match &event {
Event::MouseCancel => {
*event_result = EventResult::Pass;
}
Event::MouseUp(_e) => {
if self.data.swipe_running {
self.data.swipe_running = false;