Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Enlarge click area for connections
Enlarge click area for connections [message #729556] Mon, 26 September 2011 13:40 Go to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
Hi,

In my Editor, you add model objects by placing them on a connection. The problem is the click area for the connection is very small, so you have to aim precisly.

Is there possibility to enlarge the click area for a connection, for example return a rectangle as click area for connections?

I tried the getClickArea() in the BehaviourProvider, but you cannot create a rectangle there, you can only return existing graphic algorithms...

I would also be happy about workaround ideas, if the framework does not provide such a functioniolity.

Thanks!
Re: Enlarge click area for connections [message #734847 is a reply to message #729556] Mon, 10 October 2011 07:33 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
My temporary solution is a invisible rectangle behind every connection...
(This works, because connections are never added or moved by the user)

Any better ideas?
Re: Enlarge click area for connections [message #742265 is a reply to message #734847] Thu, 20 October 2011 10:33 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
Another idea?
Could it be possible with a connection decorator? Or is the connection decorator always fixed size?
Re: Enlarge click area for connections [message #747747 is a reply to message #742265] Mon, 24 October 2011 08:59 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1603
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Sounds as if you would like to use the decorator for the whole length of the
connection. Tha would mean you have to bend the decorator along the
connection at its bendpoints. Sounds not that ease to me...

Using Connection decorators as kind of visual points to drop stuff onto
could be an option. Where the thing is added is still another story and
could be influenced by your add feature after dropping.

HTH,
Michael
Re: Enlarge click area for connections [message #747865 is a reply to message #747747] Mon, 24 October 2011 10:27 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
yeah, sounds not easy... Wink And i need an easy solution, because i already have a workaround with invisible rectangles behind connections.

The easiest solution would be to enlarge the line width of the connection. But then i need another way to paint the connection that it does not look like a much to wide line...
Any ideas on that?
Re: Enlarge click area for connections [message #753707 is a reply to message #747865] Fri, 28 October 2011 12:48 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
Hey guys, sorry for pushing this thread again, but it is really important for me to find a good solution...
I'm hitting the limits, which is possible with my workaround (invisible rectangles behind connections)

The best way is to just increase the width of the connection. By this i get every functionality i want.
Only problem is the visualization, because a linewidth of 10 just looks stupid Wink

So my idea is to create new GraphicsAlgorithm which has all functionality of a Graphity Polyline, but a different visualization.
Is this possible? where to start?

thanks!
Re: Enlarge click area for connections [message #753961 is a reply to message #753707] Mon, 31 October 2011 08:46 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1603
Registered: July 2009
Location: Walldorf, Germany
Senior Member
There are so called PlatformGraphicsAlgorithms in Graphiti to allow the
direct usage of GEF figures in Graphiti Diagrams. Maybe this is what you are
lookingg for.

There's an example in ou Sketch test tool (tests folder in our Git
repository -
http://git.eclipse.org/c/gmp/org.eclipse.gmp.graphiti.git/tree/tests/org.eclipse.graphiti.testtool.sketch).
Have a look at the classes CanFigure adn
SkecthGraphicsAlgorithmRendererFactory.

HTH,
Michael
Re: Enlarge click area for connections [message #754404 is a reply to message #753961] Wed, 02 November 2011 12:58 Go to previous messageGo to next message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
thanks, i will try this.

But i found one other very interesting code snipped in org.eclipse.graphiti.ui.internal.figures.GFPolyline:

/**
* Sets the selection tolerance. This is the minimum line-width, which is
* still considered to be a selection of the polyline, independent from the
* real line-width. For a small line-width this makes it easier to select
* the polyline.
* 
* @param minimumSelectionLineWidth
*            The new minimum selection line-width to set.
*/
public void setMinimumSelectionLineWidth(int minimumSelectionLineWidth) {
	this.minimumSelectionLineWidth = minimumSelectionLineWidth;
}


This looks exactly like what i am looking for! so now i have to overwrite or extend some internal class to use this method!
What would be the appropiate way to use this method?
Which internally class should i extend or overwrite? (i think of org.eclipse.graphiti.ui.internal.figures.GFPolylineConnection)

EDIT:
if the minimumSelectionWidth works, it should definitly be settable by the graphiti user

EDIT2:
org.eclipse.graphiti.ui.internal.figures.GFPolyline.minimumSelectionWidth solves my issue perfectly! But it is only changable by changing internal code...

[Updated on: Wed, 02 November 2011 15:25]

Report message to a moderator

Re: Enlarge click area for connections [message #755048 is a reply to message #754404] Mon, 07 November 2011 08:26 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1603
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Right, that appears a way to achieve that within the framework, but since
this is internal coding we would not recommend it to any users.

Of course you may try to override GFPolylineConnection (woudl be the right
place), but since you would also need to care about creating the instance
from within the delegate, I assume this will get ugly in terms of using
internal stuff.

But I think an enhancement at this spot makes perfect sense, so would you
file an enhancement bugzilla for this? (An since it appear you would like to
try that, in case you have a solution a contribution would be highly
welcome... ;-) )

Thanks,
Michael
Re: Enlarge click area for connections [message #755049 is a reply to message #755048] Mon, 07 November 2011 08:28 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1603
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Ah, I forgot to mention that propably the ToolBahviourProvider would be a
good place to control that setting.

Michael
Re: Enlarge click area for connections [message #756856 is a reply to message #729556] Tue, 15 November 2011 11:02 Go to previous message
Christian B is currently offline Christian B
Messages: 68
Registered: August 2011
Member
done:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363796
Previous Topic:Rotate graphical object
Next Topic:Graphiti Connections
Goto Forum:
  


Current Time: Wed Oct 01 00:04:17 GMT 2014

Powered by FUDForum. Page generated in 0.02005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software