简体   繁体   English

应用,提高触摸事件的性能

[英]Application, improve performance of touch events

Basically, I have an application witch is 8000px by 8000px. 基本上,我有一个8000px到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. 我使用OnMouseLeftButtonDown,OnMouseMove等。通过触摸,计算机似乎很难获得触摸位置并且存在巨大的延迟,尤其是当用户同时用两个手指移动2个不同的按钮时。 I use the OnTouchDown, OnTouchMove, etc... 我使用OnTouchDown,OnTouchMove等...

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) 鼠标和触摸之间的唯一区别是当我们需要获取位置时,使用鼠标:(e是MouseButtonEventArgs)

Point currentPosition = e.GetPosition(this);

With the Touch I use: (e is a TouchEventArgs) 使用Touch我使用:(e是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.... 我不知道是不是因为我在我的应用程序中有太多的控制权(超过5000我们可以操作,但当我们只放大2控制它是同样的事情)或因为它真的很难让计算机得到触摸事件的位置....

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 我在NEC 2490WUXi2屏幕上使用Visual Studio 2010,Blend 4,.NET 4.0 Windows 7 64位7 Gb RAM Xeon 2.13 Ghz,2核,8线程屏幕:ELO技术

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. 很难说为什么会出现这样的问题 - 可能是OnTouchMove比MouseMove更频繁地被触发,你应该创建一些额外的处理来平滑触摸位置数据。 I'd try to comment all the code under the Point currentPosition = e.GetTouchPoint(this).Position; 我试着评论Point currentPosition = e.GetTouchPoint(this).Position下的所有代码;

and look at the performance. 并看看表现。

Another approach is to count how much OnTouchMove is triggered. 另一种方法是计算触发OnTouchMove的数量。

问题是触摸设备,尝试另一个,看看滞后是否仍然存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM