HTML Canvas and the Ipad
This is a discussion on HTML Canvas and the Ipad within the iPad Development forums, part of the iPad App Store category; Hello everyone, I am trying to develop a web site that needs an HTML5 canvas element where the user can create a drawing. This drawing ...
-
iPF Noob
HTML Canvas and the Ipad
Hello everyone, I am trying to develop a web site that needs an HTML5 canvas element where the user can create a drawing. This drawing is stored on a database. The site already works on IE6-8 (using FlashCanvas), IE9, Firefox, Safari, Opera and Chrome for Windows (I have not tested it on a Mac or Linux yet, but I assume I will get the same results as the windows versions of the browsers that are available in those OS's). Originally it only used mouse events. Then, I tested on the Ipad and it drew only a single spot and when dragging the finger through the screen, instead of continuing the drawing, the page scrolled. I did a little research and added touch events (touchstart, touchmove and touchend). It still does the same thing. The TouchStart, TouchMove and TouchEnd events do the same thing as the MouseDown, MouseMove and MouseUp events. The idea is that the same app should work on all browsers. The touch events did not affect the behavior on windows based browsers at all, which is a good thing.
Here is an excerpt of my code (I cannot show the full code because of confidentiality reasons)
This is inside the function that initializes the canvas:
canvas.addEventListener("touchstart", touchStart, false); canvas.addEventListener("touchmove", touchMove, false); canvas.addEventListener("touchend", touchEnd, false); Afterwards I have all the functions declared:
function touchStart(event){ //{function code here}
}
function touchMove(event){ //{function code here}
}
function touchEnd(event){ //{function code here}
}
Is there any thing I am doing wrong?
How else can I keep the page from scrolling when the user is trying to draw inside the canvas?
Thank you very much in advance for your help
Last edited by shinaco; 12-26-2011 at 10:58 PM.
-
12-26-2011 04:49 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
Similar Threads
-
By MrFish in forum iPad Development
Replies: 0
Last Post: 12-20-2011, 02:57 PM
-
By lukemeyer in forum iPad Help
Replies: 0
Last Post: 07-25-2011, 03:55 PM
-
By janfisher1 in forum iPad Accessories
Replies: 1
Last Post: 07-23-2011, 02:13 PM
-
By Toscana in forum iPad Accessories
Replies: 2
Last Post: 04-24-2011, 12:07 AM
-
By MatthewH12 in forum iPad Accessories
Replies: 0
Last Post: 04-21-2011, 10:47 PM
Search tags for this page
canvas drawing for ipad html
,
canvas web ipad 2
,
drawing in ipad using html canvas
,
html canvas ipad
,
html canvas ipad2
,
html5 canvas drawing ipad
,
html5 canvas ipad
,
html5 canvas ipad 2
,
ipad canvas touchend
,
ipad html canvas
,
ipad html5 canvas
Click on a term to search for related topics.
Tags for this Thread