Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » MoveContext
MoveContext [message #903961] Mon, 27 August 2012 12:57 Go to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
Hi.

Is that possible to get the mousePosition from movecontext instead of element new position X,Y.

I need the position in the allowed container calculated in canMoveshape, without that I know that the mouse is in the right place, but I don't know which place is that.

Thanks
Re: MoveContext [message #904290 is a reply to message #903961] Tue, 28 August 2012 07:14 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Rui,

you can get the current mouse position from the diagram editor, from within
your move feature with something like ((DiagramEditor)
getDiagramEditor()).getMouseLocation().

Not sure if that is sufficient.

Michael
Re: MoveContext [message #904330 is a reply to message #904290] Tue, 28 August 2012 08:59 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
I saw that. But it returns coordinates relative to diagram.

I need the coordinates relative to the container. Unless there is some converter. I think it is not possible to do the calculations, because I would need the mouse coordinates at the begining of the drag.
__________________________           A____________________________
|                         |          |                            |
|                  X0     | =move=>  |                      X1    |
|_________________________|          |____________________________|

Xi is mouse position I want
A is context (xy)





Thanks
Re: MoveContext [message #904469 is a reply to message #904330] Tue, 28 August 2012 13:30 Go to previous message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
For those who are interested. I solved my problem using only absolute location.

In move context I get global mouse position instead of getX and getY ( which is the left corner of the shape), as below:
DiagramEditor de = (DiagramEditor)getDiagramEditor();
Point location = de.getMouseLocation();		


And I do my calculations converting the position of shapes I'm interested to the absolute system:
GraphitiUi.getUiLayoutService().getLocationRelativeToDiagram((Shape)iGroupGA.getPictogramElement());

Thanks .

[Updated on: Tue, 28 August 2012 13:31]

Report message to a moderator

Previous Topic:Create dynamically anchors on a shape
Next Topic:Problem with Context Menu
Goto Forum:
  


Current Time: Thu Apr 18 21:00:55 GMT 2024

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

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

Back to the top