Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Question about a ZoomManager method
Question about a ZoomManager method [message #194853] Tue, 06 September 2005 14:18 Go to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Partik/Randy,

Just wondering about the following function in ZoomManager

/**
* Currently does nothing.
* @param rect a rectangle
*/
public void zoomTo(Rectangle rect) { }

Are there any plans to implement this in a future release? If so, how
would it work? I am working on something similar right now. Thank you,
Harsh
Re: Question about a ZoomManager method [message #194883 is a reply to message #194853] Tue, 06 September 2005 14:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

I believe no implementation's provided because nobody has asked for it,
until now. The expected behaviour would be to animate zooming in (or out)
to the given rectangle. Any contributions are always welcome. ZoomManager
has a commented-out method, performAnimatedZoom(), that will give you an
idea about how to do this. It's probably got some bugs though; I don't
think it was ever tested thoroughly.

"Harsh" <harsh@ti.com> wrote in message
news:b092d14d20df1c8bcd2b4f901adc44cb$1@www.eclipse.org...
> Partik/Randy,
>
> Just wondering about the following function in ZoomManager
>
> /**
> * Currently does nothing.
> * @param rect a rectangle
> */
> public void zoomTo(Rectangle rect) { }
>
> Are there any plans to implement this in a future release? If so, how
> would it work? I am working on something similar right now. Thank you,
> Harsh
>
>
Re: Question about a ZoomManager method [message #194890 is a reply to message #194883] Tue, 06 September 2005 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Thank you very much Partik. I'll look into that method and provide
feedback.

Regards,
Harsh
Re: Question about a ZoomManager method [message #194912 is a reply to message #194890] Tue, 06 September 2005 17:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

I looked at the performAnimatedZoom() method but found a few issues with
it. First of all, shouldn't it zoom to the dimensions of the rectangle
and not the next zoom level? Secondly, because it zooms to a predefined
zoom level, it doesn't calculate to see if the rectangle we are zooming
into is still visible.

Keeping those two issues in mind, I went ahead and started to code my
"custom" zoom but it is not working properly. Here is the code snippet...

LogicEditPart leditPart = (LogicEditPart)focusEditPart;
Dimension desired = leditPart.getFigure().getSize();

Dimension available = getViewport().getClientArea().getSize();
//The figure
Rectangle rectFig = leditPart.getFigure().getBounds();
IFigure fig = leditPart.getFigure();

double scaleX = available.width * getZoom() / desired.width;
double scaleY = available.height * getZoom() / desired.height;
double desiredZoom = Math.min(scaleX, scaleY);
//primSetZoom is defined in the ZoomManager class
primSetZoom(desiredZoom);

getScalableFigure().translateToRelative(rectFig);
getViewport().setViewLocation(rectFig.x, rectFig.y);

getViewport().getUpdateManager().performUpdate();

Basically, what I am trying to do is take the bounds of the figure divide
it by what's available to figure out the zoom in ratio. Zoom in to that
ratio, translate the figure so it's coordinates are relative to the
parent. Then set the view location to be where the figure is and update.

Did I miss something?

Thank you,
Harsh
Re: Question about a ZoomManager method [message #194920 is a reply to message #194912] Tue, 06 September 2005 17:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I believe that the commented out code worked for the click-to-zoom case. So,
it was centered about the point where you clicked. The method takes a
rectangle since it would also work with a dragged zoom rect. But, the code
never handled that case. It's also not clear how you would zoom out to a
rectangle.

"Harsh" <harsh@ti.com> wrote in message
news:d7a937cdda24119516a60271b7b2513d$1@www.eclipse.org...
>I looked at the performAnimatedZoom() method but found a few issues with
>it. First of all, shouldn't it zoom to the dimensions of the rectangle and
>not the next zoom level? Secondly, because it zooms to a predefined zoom
>level, it doesn't calculate to see if the rectangle we are zooming into is
>still visible.
>
> Keeping those two issues in mind, I went ahead and started to code my
> "custom" zoom but it is not working properly. Here is the code snippet...
>
> LogicEditPart leditPart = (LogicEditPart)focusEditPart;
> Dimension desired = leditPart.getFigure().getSize();
>
> Dimension available = getViewport().getClientArea().getSize();
> //The figure
> Rectangle rectFig = leditPart.getFigure().getBounds();
> IFigure fig = leditPart.getFigure();
>
> double scaleX = available.width * getZoom() / desired.width;
> double scaleY = available.height * getZoom() / desired.height;
> double desiredZoom = Math.min(scaleX, scaleY);
> //primSetZoom is defined in the ZoomManager class
> primSetZoom(desiredZoom);
>
> getScalableFigure().translateToRelative(rectFig);
> getViewport().setViewLocation(rectFig.x, rectFig.y);
>
> getViewport().getUpdateManager().performUpdate();
>
> Basically, what I am trying to do is take the bounds of the figure divide
> it by what's available to figure out the zoom in ratio. Zoom in to that
> ratio, translate the figure so it's coordinates are relative to the
> parent. Then set the view location to be where the figure is and update.
>
> Did I miss something?
>
> Thank you,
> Harsh
>
Re: Question about a ZoomManager method [message #194975 is a reply to message #194920] Tue, 06 September 2005 21:26 Go to previous message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Thank you Randy for the explanation.

I am still struggling with the rectangle case. Any help would be greatly
appreciated.

Thank you,
Harsh
Previous Topic:New Documentation in latest Maintenance builds
Next Topic:GEF i18n in a RCP app
Goto Forum:
  


Current Time: Sat Apr 20 04:16:29 GMT 2024

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

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

Back to the top