Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot interact when multiple gizmos are present on screen #16

Closed
setzer22 opened this issue Nov 5, 2022 · 0 comments · Fixed by #17
Closed

Cannot interact when multiple gizmos are present on screen #16

setzer22 opened this issue Nov 5, 2022 · 0 comments · Fixed by #17

Comments

@setzer22
Copy link
Contributor

setzer22 commented Nov 5, 2022

I tried adding multiple gizmos at the same time, and it seems only one of them (the first one I draw) is interactable.

I've tracked down the issue to lib.rs:158

        if let Some(pointer_ray) = self.pointer_ray(ui) {
            let interaction = ui.interact(self.config.viewport, self.id, Sense::click_and_drag()); // <- Here
            let dragging = interaction.dragged_by(PointerButton::Primary);

The problem is that egui will only generate drag events for one widget, so if you call ui.interact() during a frame where a drag starts, and the mouse is inside the interact area, no other call to interact will return a drag_started event no matter what.

I implemented a fix for this (PR incoming) which seems to be working fine. The trick is deferring the call to interact until we're sure that the mouse is hovering something we're interested in. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant