Grid [message #18013] |
Mon, 26 August 2002 08:57  |
Eclipse User |
|
|
|
Originally posted by: goran.pufler.infodom.hr
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  |
Eclipse User |
|
|
|
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
> >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.09333 seconds