Comments (8)
What I found is, during a session of click-rotate-release, we have:
- initial click is not consumed right away, i.e. egui context doesn't recognize that Gizmo consumes the click
- drag is consumed
- release is also consumed
I don't know if it's an issue with egui-gizmo or egui upstream, it's not easy to find out.
from transform-gizmo.
The consumed
is part of egui_winit::EventResponse
. For mouse input, it should get marked as consumed when egui::Context::wants_pointer_input()
returns true. At least in the egui-gizmo-demo that seems to immediately return true whenever I click the gizmo, if called after Gizmo::interact
.
from transform-gizmo.
What is the "egui-gizmo-demo" you are referencing @urholaukkarinen ? I checked the demo in this repo and it's not using winit
, so it's not applicable as an example.
from transform-gizmo.
I meant that in the demo egui::Context::wants_pointer_input()
returns true after interacting with gizmo, but I have not tried the Gizmo with egui_winit
yet.
Anyways, the Gizmo does not explicitly consume any events. It interacts with egui using `ui.interact(viewport, id, Sense::click_and_drag())``, which in turn tells egui context that something is clicked/dragged.
from transform-gizmo.
I did some more experiments, and I think I found the answer. wants_pointer_input()
only sets to true after I draw the Gizmo and it receives an event. Previously, I was checking for wants_pointer_input()
on receiving the event, and that would be false, because Gizmo hasn't had a chance to process this event yet.
This is probably a misunderstanding of egui event model from my part. But it feels inconsistent somewhat with the rest of egui for me? For all other elements, somehow it's enough to check wants_pointer_input()
before actually drawing them. So maybe there is something that could be done on Gizmo side?
from transform-gizmo.
Egui containers like Area and Window seem to cause wants_pointer_input
to return true already on hover. I suppose I could also do that for the Gizmo, but I haven't yet figured out how. I don't know if there is any built-in way to do that for custom widgets.
It could be done by using a non-background Area element, but that is just a rectangle. I may not want wants_pointer_input
to return true when none of the gizmo parts are highlighted.
from transform-gizmo.
For the record, I tried resizing an egui panel (which isn't related to Gizmo specifically), and I'm seeing the same issue. Initial click is not considered as consumed, which the release button is consume. So it could be something not to do with Gizmo specifically.
from transform-gizmo.
Since the gizmo no longer has any notion of events, I'll close this. If events can be manually consumed with egui, you can use Gizmo::is_focused
or the gizmo interaction result to decide if the events should be consumed.
from transform-gizmo.
Related Issues (20)
- add simple modifiers to change precision/rounding HOT 2
- Problem with rotation gizmos (possibly related to handedness / coordinate space?) HOT 11
- Cannot interact when multiple gizmos are present on screen
- Support for lh coordinate systems HOT 1
- Could this widget interact with 'wants_pointer_input'? HOT 5
- Graphical artifact at some angles HOT 2
- Lag between gizmo and manipulated object HOT 2
- egui-gizmo should not react to input events which occur outside the currently active viewport HOT 1
- Inconsistency of the Math primitives HOT 2
- Example of controlling an orbit camera HOT 2
- gizmo acts weirdly with large translations HOT 2
- Translate in camera plane and scale uniformly HOT 1
- Web demo HOT 1
- Trackball rotation HOT 1
- Publish new version HOT 2
- Gizmo does not work with reversed z projection matrix HOT 2
- Global orientation support for scaling
- Support for custom viewport size in bevy integration
- Entity-specific gizmo configuration in bevy integration HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transform-gizmo.