-
Notifications
You must be signed in to change notification settings - Fork 690
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
[Skia.WPF] Multi-Touch support #14393
Comments
I'm delighted to be involved in the development of this feature, and I'm also quite familiar with the touch and ink modules of WPF. |
@lindexi I don't think this was implemented. So, re-opening it. |
Thank you @Youssef1313 |
After reviewing the source code of UNO, I believe we can modify the original method of only obtaining events from the Mouse, to simultaneously obtaining events from both the Stylus and Mouse. Moreover, when the Mouse determines that the current event is from the Stylus or Touch, it will automatically ignore the subsequent processing logic. According to the touch behavior of WPF, the Touch event is triggered first, then promoted to the Stylus event, and finally promoted to the Mouse event. At the same time, Pen messages will trigger the Stylus event first, and then be promoted to the Mouse event. This means that for simple processing, using the Stylus event can handle both Touch and Pen situations. When using the Stylus event, multi-touch support will be automatically enabled. Also, by using the GetPropertyValue method and passing in StylusPointProperties.Width and StylusPointProperties.Height, we can obtain the possible size of the touch, which can be used to fill in the Microsoft.UI.Input.PointerPointProperties.ContactRect attribute. This will be beneficial for WPF applications on touch screens using the UNO framework. private void MainWindow_StylusDown(object sender, StylusDownEventArgs e)
{
var stylusPointCollection = e.GetStylusPoints(this);
var firstStylusPoint = stylusPointCollection.First();
if (firstStylusPoint.HasProperty(StylusPointProperties.Width))
{
var width = firstStylusPoint.GetPropertyValue(StylusPointProperties.Width);
}
if (firstStylusPoint.HasProperty(StylusPointProperties.Height))
{
var height = firstStylusPoint.GetPropertyValue(StylusPointProperties.Height);
}
} |
I think the ability to distinguish input types is working since #15543 , but maybe the additional properties are missing? |
@MartinZikmund Sorry for delay. As you can see, the |
@MartinZikmund I create #16378 and could you review my code? |
The changes are merged now! |
What would you like to be added
Adding the multi-touch support to UNO.Skia.WPF.
Why is this needed
The original WPF has very good touch support. But that's what UNO.Skia.WPF is missing right now. See #4309
For which platform
Skia.WPF
Anything else we need to know?
WPF distinguishes WM_Pointer from Mouse and Stylus and Touch events.
The text was updated successfully, but these errors were encountered: