Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Prevent RectangleFigures from overlaying each other
Prevent RectangleFigures from overlaying each other [message #215110] Wed, 26 April 2006 21:33 Go to next message
Eclipse UserFriend
Originally posted by: ben.vitale.precipia.com

I have a GEF-based editor which uses RectangleFigure to represent nodes.

When moving nodes around the canvas, is there an easy way to prevent the
user from dragging (and releasing) the node in a position such that it
overlays another node?

Or, if the user decides to release the node in such a position,
automatically relocate it outside the bounds of the Figure which already
occupies that real estate.

Suggestions?

Thanks
Ben
Re: Prevent RectangleFigures from overlaying each other [message #215132 is a reply to message #215110] Thu, 27 April 2006 01:38 Go to previous message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
Some ideas:

1. Use EditPolicies to enforce position
- Install an XYLayoutEditPolicy subclass on the node shapes you don't want
to overlap.
- Override only the getAddCommand method.
- Change the type of the request to REQ_MOVE and delegate to the host parent
EditPart to retrieve the command to change the position.
- Then append a command to move the dragged shape by a delta based on the
target node bounding box.

2. Create a custom XYLayout layout manager and override the layout method to
make sure that intersections are avoided. It would be tricky to do this in
a performant manner.

-Steve

"Ben Vitale" <ben.vitale@precipia.com> wrote in message
news:e2ooum$20f$1@utils.eclipse.org...
> I have a GEF-based editor which uses RectangleFigure to represent nodes.
>
> When moving nodes around the canvas, is there an easy way to prevent the
> user from dragging (and releasing) the node in a position such that it
> overlays another node?
>
> Or, if the user decides to release the node in such a position,
> automatically relocate it outside the bounds of the Figure which already
> occupies that real estate.
>
> Suggestions?
>
> Thanks
> Ben
Previous Topic:Changing the title of a palette
Next Topic:Not scalable figures in ScalableRootEditPart
Goto Forum:
  


Current Time: Tue Apr 16 04:52:10 GMT 2024

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

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

Back to the top