Closed QuantumEntangledAndy closed 2 years ago
I am ok with rustfmt
, even wanted to put it into CI. Would be nice to have it in one separate commit though.
I have a CI script for rustfmt and clippy a use in another project. Shall I put it in?
It would be very kind of you :)
Do you use tap to click on your mac's touch pad? The egui dosen't seem to like tap to click for buttons only actual clicks.
I put a couple of debug prints in and found that when using tap to click the state of the button is Deactivated
while egui expects it to be Hold
with this line pressed: button_state == InputState::Hold,
. I think perhaps tap to click just sends the button up event and no other
Can it be that TAP triggers a separate event that we ignore?
From the looks of it tap just sends mouse up. Which I thinnk is normal, consider what happens when you click a hyper link on a webpage: You can click it drag the mouse away and letgo and the hyper link won't activate. Only the mouse up event triggers the link event
Have you also noticed how if you have an egui side bar (like in the lights demo) and you click and drag to move the camera it will also resize the side bar if your drag goes in that area.
I suspect that if would also drag scroll bars etc
Perhaps egui needs a global context of active ui element
Here's a video showing what I mean
I am thinking it needs to handle mouse down and up fully rather than just have a yes/no for pressed.
I think this covers it:
Any thoughts?
Hmm I see you are delgating to https://github.com/emilk/egui for the lifting. I'll look into there and see what can be done
It seems we want to use this function:
/// True if egui is currently interested in the pointer (mouse or touch).
/// Could be the pointer is hovering over a [`Window`] or the user is dragging a widget.
/// If `false`, the pointer is outside of any egui area and so
/// you may be interested in what it is doing (e.g. controlling your game).
/// Returns `false` if a drag started outside of egui and then moved over an egui area.
pub fn wants_pointer_input(&self) -> bool {
self.is_using_pointer() || (self.is_pointer_over_area() && !self.input().pointer.any_down())
}
Ok so I made some more changes and have it working.
Hold
so that tap to click worksThe example looks good to me. There is still issue, that you can rotate the camera with mouse even if mouse is above he UI. But I would fix it separately and globally.
Do you mean when the click starts outside the ui? That was intentional, I expect that if my click starts with controlling the camera it keeps doing that until i let go
Try to hover mouse over the sidebar, then hold right button and move.
Try to hover mouse over the sidebar, then hold right button and move.
That dosen't move the camera for me
This adds horizontal scroll to the input.
I rather like blenders trackpad controls using the horizontal scroll so I wanted this for my app.
p.s. I use rustfmt by default in my editor and that makes a lot of changes. Would you be ok with putting the whole project through rustfmt or should I look to disabling that?