Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance "demo" example to handle touch events #33

Open
GoogleCodeExporter opened this issue Aug 24, 2015 · 4 comments
Open

enhance "demo" example to handle touch events #33

GoogleCodeExporter opened this issue Aug 24, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Export the demo projects to IOS/Android using Marmalade/Phonegap
2. Run demo on Device and use finger to grab and throw objects
3. Objects will not respond to touch events

What is the expected output? What do you see instead?
Would be great if one could grab and throw B2D objects

What version of the product are you using? On what operating system?


Please provide any additional information below.
The following additional handlers will allow you to run the example on IOS and 
android devices

document.addEventListener('touchstart', function(event) {
            isMouseDown = true;
            var touch = event.touches[0];
            mouseX = (touch.pageX - canvasPosition.x) / 30;
            mouseY = (touch.pageY - canvasPosition.y) / 30;
            //alert("Touch x:" + touch.pageX + ", y:" + touch.pageY + ',len='+event.touches.length);
        }, false);

        document.addEventListener('touchend', function(event) {
            isMouseDown = false;
            mouseX = undefined;
            mouseY = undefined;
            //alert('Tend' + event.touches.length);         
        }, false);


        document.addEventListener('touchmove', function(event) {
            event.preventDefault();
            var touch = event.touches[0];
            mouseX = (touch.pageX - canvasPosition.x) / 30;
            mouseY = (touch.pageY - canvasPosition.y) / 30;
            //alert("MOve - Touch x:" + touch.pageX + ", y:" + touch.pageY);
        }, false);



Original issue reported on code.google.com by nan...@gmail.com on 5 Aug 2012 at 7:03

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

codingowl.com/readblog.php?blogid=137

Original comment by shekhars...@gmail.com on 10 Nov 2012 at 1:25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant