-
Notifications
You must be signed in to change notification settings - Fork 604
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
WheelEvents callback #1280
Comments
What needs to be done is decide on the API. |
@ogoffart , I've created naive implementation of events aggregator in my pet project. In brief. (upd: I'm describing this to tell you my user case. ) When aggregated state is read (Ex. pushed to events queue) all accumulated events are reset. Since I "reinvented the wheel" this can be quite naive and have some flaws. Ex. windows has it's own system functions to test mouse double clicks and current verion does all this bookkeeping. You may have a look if you want to upd: It is in playground state. So there are some debugs and logging. |
@DaMilyutin Internally, we already represent the wheel event internally: Line 46 in e557ba5
What we don't do, is forward it to the .slint code. This should happens here: Line 575 in e557ba5
For the other events, we forward to one of the TouchArea's callback ( pointer-event , moved , clicked , ...) but not for the Wheel.
We could add some entries in the Slint's pointer-event enum to indicate a wheel. Or we could create a new callback only for the wheel event. |
@ogoffart, thank you for clarification. Inner representation looks like what I want to have. In my plans for plotting application I'm going to have following use case. |
Given that we would want to know the keyboard state, i'm thinking we should extend the PointerEvent structure. https://github.com/slint-ui/slint/blob/master/docs/langref/src/builtin_structs.md#pointerevent (pseudo-slint-code based on slint/internal/compiler/builtins.slint Line 87 in 41157b9
export struct PointerEvent {
button: PointerEventButton,
kind: PointerEventKind,
+ // When kind == wheel, this is the amount of logical pixel to scroll in the vertical or horizontal direction
+ delta-x: length,
+ delta-y: length,
+ // The modifiers currently pressed
+ modifiers: KeyboardModifiers
}
enum PointerEventKind {
cancel,
down,
up,
+ wheel,
} Does that new API make sense? |
Possible alternative:
|
@ogoffart, I'm curiuos, is it possible to join events from keyboard and mouse in one callback? |
I think extending a pointer event to support wheel events feels wrong to me. Those are rather different kinds of user actions IMO. I’d prefer a separate event / callback. Regarding the modifiers: instead of adding this to every single event I’d prefer if API wise this was a global property. In practice it is, in practice there is only one keyboard active for an application. |
I had a small chat with @simon and we decided on this API:
(I added the |
TouchArea should support wheel event.
Options:
add a new
callback wheel-event(Orientation, delta)
(what type should the delta be?)add things in the current pointer-event.
PointerEventKind.vertical-wheel
/horizontal-wheel
or should it be in PointerEventButton ?PointerEvent.wheel-delta
?The text was updated successfully, but these errors were encountered: