facebook

Catch the x and y coordinates of screen touch. CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #327794 Reply

    ClintNash
    Member

    Is it currently possible to catch a screen touch and return the x and y coordinates of it?

    Thanks,
    Clint…

    #327797 Reply

    Hi ClintNash,

    Adding the next code at the phoneui.documentReadyHandler function you can achieve it.

     document.addEventListener('touchstart', function(e) { 
        $('#m1-touch-textArea1').append("Touch at " + e.pageX + "," + e.pageY + "\n");
      }, true);

    As you can see with e.pageX and e.pageY you’ll get the x and y coordinates. You should replace the code instruction:

    $('#m1-touch-textArea1').append("Touch at " + e.pageX + "," + e.pageY + "\n");
    #327799 Reply

    ClintNash
    Member

    Brilliant! Thank you, works perfectly!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Catch the x and y coordinates of screen touch. CLOSED

You must be logged in to post in the forum log in