How to set the center of a newly created Figure at the Mouse Location? [message #195362] |
Wed, 02 July 2008 11:32 |
Eclipse User |
|
|
|
Originally posted by: rolfes.daniel.web.de
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
|
|
|
Re: How to set the center of a newly created Figure at the Mouse Location? [message #195672 is a reply to message #195362] |
Thu, 03 July 2008 13:24 |
Eclipse User |
|
|
|
Originally posted by: rolfes.daniel.web.de
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/m sg11496.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
|
|
|
Re: How to set the center of a newly created Figure at the Mouse Location? [message #197182 is a reply to message #195672] |
Tue, 15 July 2008 21:06 |
Eclipse User |
|
|
|
Originally posted by: rolfes.daniel.web.de
Hi,
could anyone help me out on this, please?
D. Rolfes schrieb:
> 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/m sg11496.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
|
|
|
Re: How to set the center of a newly created Figure at the Mouse Location? [message #199946 is a reply to message #197182] |
Sun, 03 August 2008 18:47 |
Eclipse User |
|
|
|
Originally posted by: rolfes.daniel.web.de
Hi,
i've still not managed this problem.
My problem:
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.
Thanks,
Daniel
D. Rolfes schrieb:
> Hi,
> could anyone help me out on this, please?
>
> D. Rolfes schrieb:
>> 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/m sg11496.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
|
|
|
Powered by
FUDForum. Page generated in 0.02996 seconds