Re: How to remove drawn elements on the canvas?
easiest way to clear a canvas is to use the context clearRect function and pass the canvas co-ordinate space width & height. This would clear the entire canvas. And you can redraw the shapes you want to remain on screen.
You can also clear portion of a screen, using the above function by passing the position and size of the ellipse you draw but if there are multiple shapes in that position then they would also get erased, you will have to manage redrawing them.
check out the canvas sample in gwt-examples, it gives a very good demo of how to use front and back canvas for complex rendering. Using this technique gives you smooth graphics and also better performance.
On Mon, Jan 21, 2013 at 1:31 AM, membersound <kodyrecords@gmail.com> wrote:
Hi,
I draw ellipses on a canvas on click, and want to remove them on doubleclick.
Therefor I track them in a list with coordinates tracked, and iterate if on mouseclick. I'm already detecting if an element is under mouseclick or not.
BUT: how do I remove that element from the canvas? Would I have to remove it from my list, then clear and redraw the whole canvas?
Can't I just somehow "clear" the ellipse selected?
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/kAQ-dtNuGz4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home