Wednesday, August 15, 2018

Re: Add Mouse Events for Canvas Drawing

Jens, ok, I understood, thank you! 

среда, 15 августа 2018 г., 13:41:39 UTC+7 пользователь Jens написал:
While you can paint an image into the canvas, the canvas itself is just pixel. When you click on the canvas you actually click the rendered pixel and not the image instance used to paint these pixels into the canvas. So a click handler on the image does not make any sense. 

To work effectively with canvas you usually have to define a model (often called scene graph) that represents what you have painted / want to paint into the canvas. Then you add event handlers to the canvas and when you receive events you use the x/y position to work with / modify your model. Then you re-render the updated model into the canvas.

So usually you want to use some library. Maybe Lienzo suites your needs: 


-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment