Moving an Edit Part [message #21063] |
Thu, 26 September 2002 07:55  |
Eclipse User |
|
|
|
Originally posted by: g.wagenknecht.intershop.de
Hi!
I've have some trouble with source & target feedback when moving a graphical
edit part. This has worked befor so I think there is a problem in my
implementations of LayoutEditPolicy and NonResizableEditPolicy because I
reimplemeted these from ground up to fit it to my GridLayout.
Problem:
The ChangeBoundsRequest seems to have different coordinates.
Look at this debug string:
mouse: 123, 181
mouse: 118, 176
mouse: 122, 181
mouse: 117, 176
mouse: 121, 181
mouse: 116, 176
This string is generated by
MyLayoutEditPolicy#getConstraintFor(ChangeBoundsRequest, GraphicalEditPart)
with the following code.
Point mouseLocation = request.getLocation();
getLayoutContainer().translateToRelative(mouseLocation);
System.out.print("mouse: " + mouseLocation.x + ", " + mouseLocation.y);
As you can see, the method gets called twice. First time is from
MyLayoutEditPolicy#showDragTargetFeedback(Request) and the second time must
be from
ConstraintLayoutEditPolicy#getResizeChildrenCommand(ChangeBo undsRequest
request).
The difference is excatly 5,5 until the layout container is scrolled then it
is more. 5 could be because of the MarginBorder of the LayoutContainer but
I'm not sure.
Where does the different come from?
Cu, Gunnar
|
|
|
|
Re: Moving an Edit Part [message #21110 is a reply to message #21081] |
Thu, 26 September 2002 09:44  |
Eclipse User |
|
|
|
Originally posted by: hudsonr.us.eye-bee-em.com
"Gunnar Wagenknecht" <g.wagenknecht@intershop.de> wrote in message
news:amuv57$po5$1@rogue.oti.com...
> Hi!
>
> Problem solved!
>
> wrong:
> > Point mouseLocation = request.getLocation();
>
> You must ensure that you always use copies of the original request / host
> figure bounds, locations, deltas.
That is correct. You can use
Point.SINGLETON.setLocation(request.getLocation()) if you want to avoid
newing objects. But only do that if your paranoid about the expense of
newing objects, like me.
>
> Cu, Gunnar
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05068 seconds