Thursday, December 20, 2012

Re: Hit detection for GWT canvas - which strategy for drawings?

In Lienzo, we opted for a Color Map approach. Detecting bounding boxes as previously suggested in the thread is not a trivial task, more so for non geometrical shapes.

http://wiki.emitrom.com/wiki/index.php/Picking

Lienzo is only 4 months old and already surpasses in functionality and efficiency all the JS based frameworks we've seen out there, that includes Kinetic. An example is, in Kinetic you have to handle dragging yourself to make it efficient. In Lienzo, you simply call setDraggable on the "shape" and we do the rest for you.

My suggestion would be to save you lots of time, coding and go with a GWT only based solution that has an incredible number of features already. While you are at it you can also provide us with feedback and help us make it better. It's Apache 2 and we are using it to build a few things.

A ton more of features are in the pipeline. We are as we speak for example in the process of adding zoom support. Via different mediators you'll be able to zoom in/out your entire viewport.

Take a look at the explorer here:


Regards,

Alfredo


On Thu, Dec 20, 2012 at 6:14 AM, membersound <kodyrecords@gmail.com> wrote:
I'm creating some kind of drawings/flowchart/UML-diagram like tool with GWT Canvas (Java).
For hit-detection of my drawings I could imagine 3 different strategies, but I do not know which would work best for my goal.

-  Just keep track of all Shape coordinates and iterate all objects on mouseclick
-  draw all objects on a ghost-canvas on mouseclick, and use isPointInPath() after every object drawing
- using a ghost-canvas and draw each object with its own color (like #000001, #000002), and keep reference of them in a Map<Color, Shape>. Then just detecting the mouseclick on the ghost-canvas and get the object belonging to the pixelcolor under mouse

What would you prefer, and why?

--
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/-/tPJuPlAJED4J.
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.



--
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

--
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.

No comments:

Post a Comment