variax20 Posted January 22, 2014 Share Posted January 22, 2014 Hi everyone, Just signed up to the forum I have a problem which I'm hoping someone could possibly help me out with please. I have created an app using HTML5 Canvas, which basically allows the user to click on an image to place markers exactly where the mouse pointer is. This works fine on desktop computers but when trying it on a mobile device, the markers seem a bit mis-aligned, as if the co-ordinates being calculated have changed. If anyone could help me out here, I'd really appreciate it. Many thanks! Ash Quote Link to comment Share on other sites More sharing options...
Stunt Pixels Posted January 23, 2014 Share Posted January 23, 2014 Is the canvas being scaled on mobile? And if so, are you compensating for the scale factor with the mouse event coordinates? Quote Link to comment Share on other sites More sharing options...
jogutierrez Posted February 1, 2014 Share Posted February 1, 2014 Hi, i recommend you to use touchstart since mousedown or click, use moderniz or something to detect touch device and call touch event or click event. If you centered or align the canvas you should add offsetLeft and offsetTop to x y coord. And lookbody,html{ margin:0px; padding:0px;} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.