Skip to main content



      Home
Home » Eclipse Projects » GEF » Grid
Grid [message #18013] Mon, 26 August 2002 08:57 Go to next message
Eclipse UserFriend
Originally posted by: goran.pufler.infodom.hr

Hi,

is it possible to define a background grid and snap to grid ?

raf
Re: Grid [message #18087 is a reply to message #18013] Tue, 27 August 2002 05:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tomas.pinos.atlas.cz

Hi,

sure it's possible. Although I'm not sure if my approach is the smartest.
I modified NonResizableEditPolicy to show the feedback while dragging
and XYLayoutEditPolicy to actually set the appropriate constraints.
In NonResizableEditPolicy (~ in my edit policy extending this one), I
overrode createDragSourceFeedbackFigure method to return my customized
feedback figure. The only difference to the original figure is that its
setBounds method adjusts the bounds so it looks like the figure jumps over
the grid (~ snap to grid).
But this was only the visual feedback. To actually set the right
constraints I modified getConstraintFor methods of XYLayoutEditPolicy.
The computation of grid constraints is very simple. You just have to
distinguish if the figure is moving or if it's being resized. When moving, I
adjust its top left corner (according to the grid), when resizing the
appropriate side has to be adjusted. The drawing of the grid is simple too.
The fact that NonResizableEditPolicy has been modified introduced the
neccessity to do the same for ResizableEditPolicy, which is somehow
inconvenient. Also the fact that the computation (although very simple) is
being performed twice (first for the feedback, then for the real figure) is
not optimal. The other way to solve this could be to modify the trackers for
moving and resizing.
Does anyone find my approach weird? Or have you implemented anything
more reasonable?

Regards,
Tomas


"Raf" <goran.pufler@infodom.hr> wrote in message
news:akd7ps$tm3$1@rogue.oti.com...
> Hi,
>
> is it possible to define a background grid and snap to grid ?
>
> raf
>
>
>
Re: Grid [message #18096 is a reply to message #18087] Tue, 27 August 2002 10:54 Go to previous message
Eclipse UserFriend
Originally posted by: hudsonr.spam.com

It is probably possible to do this on the Request. ChangeBoundsRequest is
actually responsible for generating the new (translated/resized) Rectangle
on the screen, therefore, rounding to the nearest grid location could be
done there, and there would be no reason to change feedback or override some
methods in the EditPolicy.

"Tomas Pinos" <tomas.pinos@atlas.cz> wrote in message
news:akfgln$275$1@rogue.oti.com...
> Hi,
>
> sure it's possible. Although I'm not sure if my approach is the smartest.
> I modified NonResizableEditPolicy to show the feedback while dragging
> and XYLayoutEditPolicy to actually set the appropriate constraints.
> In NonResizableEditPolicy (~ in my edit policy extending this one), I
> overrode createDragSourceFeedbackFigure method to return my customized
> feedback figure. The only difference to the original figure is that its
> setBounds method adjusts the bounds so it looks like the figure jumps over
> the grid (~ snap to grid).
> But this was only the visual feedback. To actually set the right
> constraints I modified getConstraintFor methods of XYLayoutEditPolicy.
> The computation of grid constraints is very simple. You just have to
> distinguish if the figure is moving or if it's being resized. When moving,
I
> adjust its top left corner (according to the grid), when resizing the
> appropriate side has to be adjusted. The drawing of the grid is simple
too.
> The fact that NonResizableEditPolicy has been modified introduced the
> neccessity to do the same for ResizableEditPolicy, which is somehow
> inconvenient. Also the fact that the computation (although very simple) is
> being performed twice (first for the feedback, then for the real figure)
is
> not optimal. The other way to solve this could be to modify the trackers
for
> moving and resizing.
> Does anyone find my approach weird? Or have you implemented anything
> more reasonable?
>
> Regards,
> Tomas
>
>
> "Raf" <goran.pufler@infodom.hr> wrote in message
> news:akd7ps$tm3$1@rogue.oti.com...
> > Hi,
> >
> > is it possible to define a background grid and snap to grid ?
> >
> > raf
> >
> >
> >
>
>
Previous Topic:connection clipping and containers
Next Topic:dynamic palette items based on editor selection
Goto Forum:
  


Current Time: Mon Jul 14 04:13:14 EDT 2025

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

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

Back to the top