dinther

Help with multi touch?

Recommended Posts

I want to make sure I get this control technically perfect before I translate the others. I would really appreciate a code review and feedback so I can get the rest right.

 

Checkout the latest version of my dial knob. http://www.planetinaction.com/instrumentdemos/dialknob.htm

 

The page shows two dial knobs. Each can be operated separately but they can not be operated simultaneously using multi-touch. I looked at the multi-touch example code and I believe I implemented it correctly but obviously it isn't working.

 

Individual files: http://www.planetinaction.com/instrumentdemo

 

 

 

 

Share this post


Link to post
Share on other sites

I posted this answer last day but never had some feedback : http://www.html5gamedevs.com/topic/14043-multi-touch-how-to-get-local-position-for-each-fingers/

var touches = [];var fingerOnScreen = false;stage.touchstart = mousedown();stage.touchend = mouseup();var mousedown = function(event){   fingerOnScreen = true;    var touch = {      id: event.data.identifier || 0, // || 0 is to support desktop version      pos: event.data.getLocalPosition(this.view)   };   touches.push(touch);};var mousemove = function(event){
for (var i = 0; i < touches.length; i++) {
if(touches.id === (event.data.identifier || 0) )
{
touches.pos = event.data.getLocalPosition(this.view);
}
};

}
var mouseup = function(event) { for (var i = 0; i < touches.length; i++) { if(touches.id === (event.data.identifier || 0)) { touches.splice(i,1); } };
 

if(touches.length === 0) // no more fingers on screen
{
fingerOnScreen = false;
}

};

 

It works, and then you can manage each button with the correspondant 'touch'

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.