qasta / gwt-diagrams

Automatically exported from code.google.com/p/gwt-diagrams
0 stars 0 forks source link

Enhancement Request: Ability to select connections using listeners #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using gwt-diagrams-0.1.jar

My application uses an underlying model object for the connections in my
diagram. I need the ability "select" these connections in the same way you
typically select the connectors, so that I can in turn bring up appropriate
property sheets and the like for manipulation of the underlying model.

I have accomplished this in my application by extending
AbstractConnection.class and wiring the underlying div (Rectilinear
connections) with the necessary listener capability (SourcesClickEvents,
etc.) It would be nice if this was just out of the box functionality though.

I am not sure how you would accomplish this with connections that use the
browser canvas element though (e.g. BezierTwoEndedConnection). Because the
connection is essentially a big rectangle, I do not know how you would
calculate that the user has clicked on the actual connection versus the
surrounding blank space (not to mention overlapping connections).

Perhaps a utility class that can calculate whether the mouse x/y intersects
with the drawn line of a connection. If it does then it in turn can fire
additional listeners that have been attached to the connection.

Original issue reported on code.google.com by xsegr...@gmail.com on 23 Jan 2008 at 9:47

GoogleCodeExporter commented 9 years ago
This enhancement is worth to consider. I will think about it but probably it 
won't be
included in the nearest release.

Original comment by michal.b...@gmail.com on 23 Jan 2008 at 10:28

GoogleCodeExporter commented 9 years ago
Just looked at the Canvas API and it appears that there is a "boolean
isPointInPath(in float x, in float y);" method that can be called to determine
whether an x/y coordinate falls within the current drawing path. This sounds 
like it
could be used to determine whether the user actually clicked on the drawn line.

Original comment by xsegr...@gmail.com on 23 Jan 2008 at 10:29

GoogleCodeExporter commented 9 years ago
The attached file is a prototype of what I did to make the rectilinear 
connection
selectable.

Original comment by xsegr...@gmail.com on 23 Jan 2008 at 10:37

Attachments: