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

时间:2022-09-08 21:03:30

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.

基本上,我有一个8000px到8000px的应用程序。我们可以放大以查看特定部分,例如收音机,或者我们可以缩小以查看所有内容。

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...

我的问题是:对于操纵控件,例如音量按钮,用户需要像现实生活中一样移动鼠标,因此使用圆形运动。使用鼠标,一切都很完美,它可以毫不拖延地立即响应。我使用OnMouseLeftButtonDown,OnMouseMove等。通过触摸,计算机似乎很难获得触摸位置并且存在巨大的延迟,尤其是当用户同时用两个手指移动2个不同的按钮时。我使用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技术

3 个解决方案

#1


3  

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

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

http://www.codeproject.com/Articles/692286/WPF-and-multi-touch

#2


1  

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;

很难说为什么会出现这样的问题 - 可能是OnTouchMove比MouseMove更频繁地被触发,你应该创建一些额外的处理来平滑触摸位置数据。我试着评论Point currentPosition = e.GetTouchPoint(this).Position下的所有代码。

and look at the performance.

看看表演。

Another approach is to count how much OnTouchMove is triggered.

另一种方法是计算触发OnTouchMove的数量。

#3


1  

The problem is the touch device, try another one to see if the lag is still there.

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

#1


3  

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

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

http://www.codeproject.com/Articles/692286/WPF-and-multi-touch

#2


1  

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;

很难说为什么会出现这样的问题 - 可能是OnTouchMove比MouseMove更频繁地被触发,你应该创建一些额外的处理来平滑触摸位置数据。我试着评论Point currentPosition = e.GetTouchPoint(this).Position下的所有代码。

and look at the performance.

看看表演。

Another approach is to count how much OnTouchMove is triggered.

另一种方法是计算触发OnTouchMove的数量。

#3


1  

The problem is the touch device, try another one to see if the lag is still there.

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