Reputation: 585
In my DX12 UWP App (not XAML), I want to differentiate between mouse wheel scroll, as well as the two finger up, down, left and right on the laptop touchpad. I know all of these are handled as:
window->PointerWheelChanged += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>
I've already implemented this for the mouse but distinguishing between the two is not straightforward. PointerDeviceType
is always mouse type regardless, and the only thing I have found that can differentiate between the two input methods is PointerPointProperties.MouseWheelDelta
, which on mouse seems to be fixed at intervals of 120.
Is this the only thing I can use to check to see if I have mouse vs touchpad input, or have I totally missed something? Checking for mod 120 seems like a sub optimal solution to this.
Any input would be much appreciated.
Thanks, Peter
Upvotes: 0
Views: 127
Reputation: 8666
I'd suggest you handle the Manipulation events which is designed for multiple finger interactions in your app. As the document mentioned, Manipulation gesture events, such as ManipulationStarted, indicate an ongoing interaction. They start firing when the user touches an element and continue until the user lifts their finger(s), or the manipulation is canceled.
Manipulation events include multi-touch interactions such as zooming, panning, or rotating, and interactions that use inertia and velocity data such as dragging. The information provided by the manipulation events doesn't identify the form of the interaction that was performed, but rather includes data such as position, translation delta, and velocity. You can use this touch data to determine the type of interaction that should be performed.
The PointerWheelChanged event is not designed for touch interactions. It's just for pointer wheel changes so it can't indicate if it is triggered by the mouse or by the gesture.
Upvotes: 1