[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.gmf] Re: How to set the center of a newly created Figure at the Mouse Location?
|
Hi,
I've searched the newsgroup for solutions and there were suggestions to
set a breakpoint to SetBoundsCommand. I did the following in the
LayoutPolicy in the "protected Command getCreateCommand(CreateRequest
request)" method:
req.setLocation(//a fixed position));
This works fine.
My problem is that the location depends on the size of the Figures I
want to create. So I figured I have to somehow get to the corresponding
EditPart or Figure to get the size. The SetBoundsCommand is afaiu
invoked while the Mouse is moved (mouse_move). At this point the
EditPart and the Figure are not even created. I think they will be
created during the "Mouse Click" (mouse_up).
My problem is quite similiar to this one:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/msg11496.html
So as i understand, what I need is a place where the mouse location is
known and I am able to get to the created EditPart or Figure.
After that I can use setLocation() on the created Figure, or is this the
wrong idea?
Could someone please point me in the right direction?
Thanks,
Daniel
D. Rolfes schrieb:
Hi,
I create a figure from the palette onto the diagram. The mouse location
and the upper-left point of the newly created element will be the same
after the creation.
But I would like the mouse location to be the center of the newly
created element.
How can I achieve this?
Thanks,
Daniel