Figure position [message #177130] |
Thu, 13 March 2008 10:37  |
Eclipse User |
|
|
|
Originally posted by: rump.informatik-emden.de
Hi all,
I am searching for a while but can't find an answer. When I create a new
figure on a diagram the mouse position is always the left upper corner
of the figure. But in my application the mouse position should be the
center of the figure. What do I have to do to change this behaviour?
Regards,
Frank
|
|
|
|
Re: Figure position [message #177302 is a reply to message #177222] |
Fri, 14 March 2008 06:27  |
Eclipse User |
|
|
|
Originally posted by: rump.informatik-emden.de
Hi,
thanks for your answer. Your solution works fine, but I have different
shapes with different sizes. How can I find out in the getContraintFor
method which shape should be created by the command to calculate the
center position?
Regards,
Frank
Cherie Revells schrieb:
> Frank,
>
> When a new figure is created a SetBoundsCommand is executed to set the
> location of the figure. If you put a breakpoint in the SetBoundsCommand
> constructor and attempt to create your figure using the palette tool,
> you will see where this command is created, most likely from the
> XYLayoutEditPolicy.
>
> The method getConstraintFor(CreateRequest request) in the
> XYLayoutEditPolicy is where the mouse location set in the request gets
> translated to a location and size that will be passed to the
> SetBoundsCommand. You should be able to override this method in a
> custom editpolicy to use the mouse location as the center of the shpae
> instead.
>
> Regards,
> Cherie
>
> Frank Rump wrote:
>> Hi all,
>>
>> I am searching for a while but can't find an answer. When I create a
>> new figure on a diagram the mouse position is always the left upper
>> corner of the figure. But in my application the mouse position should
>> be the center of the figure. What do I have to do to change this
>> behaviour?
>>
>> Regards,
>> Frank
|
|
|
Powered by
FUDForum. Page generated in 0.04886 seconds