Thanks for your answer.
-- Sounds very good, but a little bite difficult than i thought :-)
I´ll try it with Lienzo
Am Dienstag, 19. Mai 2015 02:12:52 UTC+2 schrieb Jens:
Am Dienstag, 19. Mai 2015 02:12:52 UTC+2 schrieb Jens:
You paint into a canvas using its Context2D object (canvas.getContext2d()). It has a bunch of methods for still styles and shapes.Since canvas is just something you paint on you can not attach a handler for each painted rectangle, a painted rectangle is just pixels. You need to attach a handler to the canvas itself and then use some math to figure out which painted shape has been clicked. To be able to do that you would need to store every painted shape in a data structure, e.g. for a rectangle store x,y and maybe z axis as well as width and height. To make a rectangle visible/invisible on click you also have to store the visibility information somewhere.In graphics language the above data structure is called a scene graph which is a model that describes the scene you want to render. Once you have build up your scene graph you can render its information to a canvas. Based on user input you would modify the scene graph and then repaint it to the canvas again (either the whole graph or you would calculate which parts of the canvas need to be repainted based on the changes in the scene graph).In short: I would use a library that allows you to build such a scene graph. From the top of my head I only know lienzo but I never used it.-- J.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment