Skip to content

Commit

Permalink
small improvements and a "bugfix" | context menus (#164)
Browse files Browse the repository at this point in the history
* small improvements and a "bugfix" | context menus

* changed my code to be more like the existing code
  • Loading branch information
BUGO07 authored Dec 6, 2024
1 parent 6b92f2c commit 6d3b457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bevy_widgets/bevy_context_menu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl Plugin for ContextMenuPlugin {
}

fn on_secondary_button_down_entity_with_context_menu(
mut trigger: Trigger<Pointer<Down>>,
mut trigger: Trigger<Pointer<Up>>,
mut commands: Commands,
query: Query<&ContextMenu>,
theme: Res<Theme>,
Expand Down
3 changes: 3 additions & 0 deletions bevy_widgets/bevy_context_menu/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ pub(crate) fn spawn_option<'a>(
mut commands: Commands,
parent_query: Query<&Parent>,
mut query: Query<&mut ContextMenu>| {
if trigger.event().button != PointerButton::Primary {
return;
}
// Despawn the context menu when an option is selected
let root = parent_query
.iter_ancestors(trigger.entity())
Expand Down

0 comments on commit 6d3b457

Please sign in to comment.