Перейти к публикации
Дедовский городской форум
Skazochnik

Мультитач на резистивных экранах?

Рекомендованные сообщения

1271850333_4-19-10-htcresistmultitouch200-183x240.jpg

 

Мультитач на резистивных экранах? Вы думаете, что это шутка? Маленькая компания Stantum, доказала обратное - реализовать мультитач на резистивном дисплее не только возможно, но в чем-то он даже предпочтительнее своего ёмкостного коллеги. Если вам надоело "тыкать" в дисплей одним пальцем, ваш коммуникатор сделан компанией HTC и работает под управлением Windows Mobile, то в один прекрасный день вы можете получить то, что хочется.

 

Адель Аль Зубейр (Adel Al Zubeir) выяснил, что, когда два пальца давят на экран одновременно, дигитайзер рассчитывает точку между ними. Применив немного математики он состряпал программу, которая может определить относительное положение обоих пальцев. Ну а далее уже не сложно реализовать функции, известные всем пользователям устройств с мультитач дисплеями. К сожалению, не все просто - нельзя установить программу и получить вожделенный мультитач, но если вы являетесь разработчиком приложений для WinMo, вы можете "встроить" эту функцию в свою программу.

 

Видео -

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Лех ты сам понимаешь что это дерьмо.

 

когда нажимаешь двумя пальцами, точка получается ровно между точками касания. Далее привязываемся к этому и взависимости от перемещения данной точки ресайзим размер картинки.

 

Далее, опять же точка касания между касаниями пальцев, ведем, получаем вектор, куда он направлен? по или против часовой.

 

Вывод - туфта.

 

С уважением, Maksim.

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Продолжение темы

 

Раз уж нато и пошло , то вот вам и сами исходники. В архиве две папки в одной лежит сам .dll фаил (мультитач), а в другой вы сможете найти и испробывать функю разблокировки вашего КПК как это изображено и показывается на видео в верху. Я тут описывать ничего небуду, вы сможете это прочитать в теме выше или отсюда но в оригинальном виде и языке.

 

http://forum.xda-developers.com/showthread.php?t=593290

 

Features:

•Pinch to Zoom Support

•Drag (swipe) support.

•Replacement events for the mouse move fires only when a single finger detected.

•Multiple events based on gestures.

•Performance optimized, memory footprint is minimal.

To use this SDK you will need Visual Studio Professional or better. start a new Smart Device Project, and add the SDK to your references.

The SDK is consists of only one object, which is DualTouchSDK. We will need one instance of this class for every control that supports pinch to zoom or drag in your application.

 

There are several methods, properties and events that can be utilized in order to achieve multitouch effect. i have done my best to make this as easy as possible, my code is now complex but it is necessary to achieve easy implementation.

 

Methods

public void MouseUp()

This method MUST be called when the original MouseUp event of the control that supports multitouch.

 

public void SetMouseDown(int x, int y)

Whenever your control fires the MouseDown even you must call this even along with the X and Y coordinates that are given to you by the MouseEventArgs. It provides the SDK with the information required.

 

public void SetMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)

As usual, this Method is used so the SDK will get to determine when a Dual Touch is performed. Pass the MouseEventArgs as provided by the MouseMove event from your control.

 

Events

public event DualTouchSDK.DualTouchSDK.MultiTouchEventHandler Zooming

Whenever you have hooked the SDK to the events of your control, this even will be fired when a pinchtozoom is happening, it will keep firing as the user tries to zoom in or out until both fingers are off the screen.

 

The event provides an object of type MultiTouchEventArgument, it will give your application the indication of the zoom status as follows :

 

Point e.FirstPoint, returns the point which the first finger is located in (basically the First Touch to the screen)

 

point e.SecondPoint, contains the 2nd point X and Y coordinates.

 

double e.ZoomRatio, it will simply return a double number which indicates the percentage of the zoom, the value is always greater than Zero (0), to know if you are zooming in or out you can simply detect the value of it. When the value is Less than ONE (1) then the user is pinching OUT, for example if you got the value of 0.65 this means that the user has zoomed out to a total size of 65% of the original size.

 

same applies for the Zoom IN but in this case you get a number that is greater than ONE, for example if you got the Ratio of 1.40, it indicates that the user is zooming IN by 40%.

 

public event System.Windows.Forms.MouseEventHandler MouseMoved

When working with dualtouch, your MouseMove event of your control will NOT distinguish between the single finger and dual finger mouse move, this event can be used to get the SINGLE finger mouse move event.

 

public event DualTouchSDK.DualTouchSDK.DragEventHandler Dragged

When this event is triggered, it indicates that the user has dragged your control into a direction, the direction is determined by evaluating the value of the object (DualTouchSDK.dragDirection e).

 

the dragDirection object contains FOUR (4) important bool properties,

 

e.up;

e.down;

e.left;

e.right

 

Each one can get a status of true or false depending if the drag is going in that direction or not. for example if the user swipes his finger from the center toward the top of the screen, the return value will be UP = TRUE only. Notice that the SDK supports diagonal Dragging so you can get a combination of 8 Directions.

 

Properties

public int DragLengthToDetect { set; get; }

This property is used to give the developer the option to decide the minimum drag length (in pixels) that is required to trigger the Dragged Event. If the user Drags more or equal to this value, the event would be fired. Otherwise the operation will be ignored.

 

the default value for this property is 100 pixels.

 

public int DragLengthToDetect { set; get; }

This property sets the minimum distance between 2 fingers to detect a dualtouch, if the fingers have an original distance less than this value it will be ignored and treated as a single touch.

 

The default value of this property is 50 pixels.

 

Notice: This SDK is provided as is, without any guarantee or support.

 

You are not allowed to reverse engineer this SDK or any Executable, Assembly, DLL or file of any format.

 

You CAN use this SDK free of charge as long as:

 

1) You downloaded it from here.

 

2) Your application is provided free of charge.

 

3) You mention the usage of this SDK on your application and website with a link to this page.

 

4) If you have a commercial application and want to use this SDK, I must be contacted and an electronic/written approval must be obtained from me directly, notice that you must still download it from here and mention this post in the application and site. you may contact me through the Contact for found on top of the page or email me directly on adel [@at] windowsphoneme.com

Изменено пользователем Skazochnik

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

где исходники? хочу взгялуть на чудо математику!

 

Обана:

Requres .Net Compat Framework 3.5, ы(сразу становиться все ясно, смотрим дальше)

 

Known Bugs (V0.0)

- Single Finger sliding causes zoom IN (notice that you CANNOT zoom OUT). ыы(да ну только на увеличение? всегда???? хех)

____

исходников на хда не нашел, зато, это чудо-эсдека легко рефлектором вскрылась и:

конструктор

public DualTouchSDK()

{

this.xStart = 0;

this.yStart = 0;

this.StartIsSet = false;

this.xAvg = 0;

this.yAvg = 0;

this.AvgIsSet = false;

this.xEnd = 0;

this.yEnd = 0;

this.length1 = 0.0;

this.length2 = 0.0;

this.Tollerance = 50;// особенно милая константа, прям няшечка

}

//без коментариев видно что к чему, идем дальше:

private double getlength(int x1, int y1, int x2, int y2)

{

return Math.Abs(Math.Sqrt(Math.Pow((double) (x2 - x1), 2.0) + Math.Pow((double) (y2 - y1), 2.0)));

}

// ба так это взятие середины(вот она математика сложная, как посчитать длину вектора, ага)

// дальше идем:

public void SetMouseDown(int x, int y)

{

if (!this.StartIsSet)

{

this.xStart = x;// зафиксировали координаты

this.yStart = y;

this.StartIsSet = true;// флаг выставили что палец ткнулся

Console.WriteLine("Fixed Start");

}

}

//запоминание начальной координаты

// а вот и поехали:

public void SetMouseMove(int x, int y)

{

if (!this.AvgIsSet && (this.getlength(this.xStart, this.yStart, x, y) >= (this.Tollerance / 2)))

{

this.xAvg = x;

this.yAvg = y;

this.AvgIsSet = true;

this.xEnd = Math.Abs((int) ((2 * this.xAvg) - this.xStart));

this.yEnd = Math.Abs((int) ((2 * this.yAvg) - this.yStart));

this.length1 = this.getlength(this.xStart, this.yStart, this.xEnd, this.yEnd);

Console.WriteLine("Fixed Avg");

}

if (this.AvgIsSet && (this.Zooming != null))

{

int num2 = Math.Abs((int) ((2 * x) - this.xStart));

int num3 = Math.Abs((int) ((2 * y) - this.yStart));

double num4 = this.getlength(this.xStart, this.yStart, num2, num3);

if (num4 >= this.Tollerance)

{

this.xEnd = num2;

this.yEnd = num3;

this.length2 = num4;

double num5 = this.length2 / this.length1;

MultiTouchEventArgument argument2 = new MultiTouchEventArgument();

argument2.x1 = this.xStart;

argument2.y1 = this.yStart;

argument2.x2 = this.xEnd;

argument2.y2 = this.yEnd;

argument2.ZoomRatio = num5;

MultiTouchEventArgument e = argument2;

this.Zooming(e);

}

}

}

// а тут палец отпустили:

public void MouseUp()

{

this.StartIsSet = false;

this.AvgIsSet = false;

}

 

хня хня хня

 

всем привет, особенно афтору, обфускация должна быть а иначе это детские поделки.

 

С уважением, Maksim.

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Не только индусы могут писать хорошие программы...

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас

×
×
  • Создать...