应用,提高触摸事件的性能
基本上,我有一个 8000px x 8000px 的应用程序。我们可以放大以查看特定部分(例如收音机),也可以缩小以查看所有内容。
汽车的每个部分都是一个控制装置,我们可以用手指在双点触控或多点触控显示器上进行操作。
我的问题是:为了操纵控件,例如音量按钮,用户需要像在现实生活中一样移动鼠标,因此要进行圆周运动。 鼠标的一切都很完美,它立即响应,没有任何延迟。我使用 OnMouseLeftButtonDown、OnMouseMove 等。 对于触摸,计算机似乎很难获得触摸位置,并且存在巨大的滞后,特别是当用户同时用 2 个手指移动 2 个不同的按钮时。我使用 OnTouchDown、OnTouchMove 等...
鼠标和触摸之间的唯一区别是当我们需要获取位置时,我使用的鼠标:(e 是 MouseButtonEventArgs)
Point currentPosition = e.GetPosition(this);
我使用的触摸:(e 是a TouchEventArgs)
Point currentPosition = e.GetTouchPoint(this).Position;
此后的所有内容都是相同的。
我不知道是否是因为我的应用程序中有太多的控件(我们可以操作的控件超过 5000 个,但是当我们放大仅 2 个控件时,这是同一件事),或者因为计算机确实很难获取触摸事件的位置...
有人可以帮我解决这个问题吗?我需要找到一个解决方案来消除延迟。
我使用 Visual Studio 2010、Blend 4、.NET 4.0 Windows 7 64 位 7 GB 内存 Xeon 2.13 Ghz,2 核,8 线程 屏幕: ELO 技术,采用 NEC 2490WUXi2 屏幕
Basically, I have an application witch is 8000px by 8000px. We can zoom in to view a specific part, example on the radio, or we can zoom out to view everything.
Each part of the car is a control that we can manipulate with fingers, on a dual touch or multitouch monitor.
My problem is: for manipulating a control, for example the Volume button, the user needs to move the mouse exactly like in real life, so with a circular movement.
With the mouse everything is perfect, it responds instantly without any delay. I use the OnMouseLeftButtonDown, OnMouseMove, etc.
With the touch, it seems to be very difficult for the computer to get the touch position and there is a huge lag, especially when the user move 2 different button with 2 fingers at the same time. I use the OnTouchDown, OnTouchMove, etc...
The only difference between the mouse and the touch is when we need to get the position, with the Mouse I use: (e is a MouseButtonEventArgs)
Point currentPosition = e.GetPosition(this);
With the Touch I use: (e is a TouchEventArgs)
Point currentPosition = e.GetTouchPoint(this).Position;
Everything after this is the same.
I don't know if it's because I have too many control in the my application (over 5000 that we can manipulate, but when we zoom in on only 2 control it's the same thing) or because it is really difficult for the computer to get the position from a touch event....
Can someone help me with this? I need to find a solution to eliminate the lag.
I use Visual Studio 2010, Blend 4, .NET 4.0
Windows 7 64-bit
7 Gb RAM
Xeon 2.13 Ghz, 2 core, 8 thread
Screen: ELO technology, in a NEC 2490WUXi2 screen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这似乎是一个错误。看看这篇文章。
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/756a2ccf-6cf1-4e4a-a101-30b6f3d9c2c9/#ed51226a-6319-49f8-be45-cf5ff48d56bb
或
http://www.codeproject.com/Articles/692286/WPF-and-multi -触摸
This seems to be a bug. Take a look at this post.
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/756a2ccf-6cf1-4e4a-a101-30b6f3d9c2c9/#ed51226a-6319-49f8-be45-cf5ff48d56bb
Or
http://www.codeproject.com/Articles/692286/WPF-and-multi-touch
很难说为什么你会遇到这样的问题 - 可能是 OnTouchMove 比 MouseMove 更频繁地触发,你应该创建一些额外的处理来平滑触摸位置数据。
我会尝试注释下面的所有代码
点 currentPosition = e.GetTouchPoint(this).Position;
并查看性能。
另一种方法是计算 OnTouchMove 被触发的次数。
it's hard to say why you have such an issue - may be OnTouchMove is triggered more often than MouseMove and you should create some additional processing to smooth the touch positions data.
I'd try to comment all the code under the
Point currentPosition = e.GetTouchPoint(this).Position;
and look at the performance.
Another approach is to count how much OnTouchMove is triggered.
问题出在触摸设备上,请尝试另一台设备,看看是否仍然存在延迟。
The problem is the touch device, try another one to see if the lag is still there.