Skip to main content



      Home
Home » Eclipse Projects » GEF » Moving an Edit Part
Moving an Edit Part [message #21063] Thu, 26 September 2002 07:55 Go to next message
Eclipse UserFriend
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 #21081 is a reply to message #21063] Thu, 26 September 2002 08:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

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.

Cu, Gunnar
Re: Moving an Edit Part [message #21110 is a reply to message #21081] Thu, 26 September 2002 09:44 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:Drawing Connection in Logic Editor example
Next Topic:Drag and Drop behaviour in Logic Editor Example
Goto Forum:
  


Current Time: Tue Jul 22 08:37:29 EDT 2025

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

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

Back to the top