Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to initially scroll or zoom to fit in a GEF editor
How to initially scroll or zoom to fit in a GEF editor [message #88519] Fri, 25 July 2003 18:46 Go to next message
Eclipse UserFriend
Originally posted by: schmerl+gef.cs.cmu.edu

Hi,

I'm having trouble working out where to put code to implement scrolling to
the center of a diagram in a GEF editor (and zooming to fit, as well). The
behavior I want is that, when a diagram is loaded, that the zoom level is
set to fit the entire diagram. To do this I need to get the bounds of the
elements in my diagram (easy) and the size of the client area of my viewport
(seemed easy). The problem that I am having is where to put the code so that
the client area is set to the proper value. If I do it in
initializeGraphicalViewer or configureGraphicalViewer, the viewport bounds
don't have the proper values.

Could someone point me to the write place in the code?

Thanks,
Bradley.
Re: How to initially scroll or zoom to fit in a GEF editor [message #88886 is a reply to message #88519] Tue, 29 July 2003 14:30 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I know that the workbench will resize your editor's control at least twice
when your editor is opened.
Perhaps you should start with adding an SWT Resize listener to your canvas,
and seeing how many times it is sized. After it is sized, you should be able
to scroll the viewport and adjust zoom settings. Unfortunately, the user
will probably see this happening.

"Bradley Schmerl" <schmerl+gef@cs.cmu.edu> wrote in message
news:bfrtua$dsi$1@eclipse.org...
> Hi,
>
> I'm having trouble working out where to put code to implement scrolling to
> the center of a diagram in a GEF editor (and zooming to fit, as well). The
> behavior I want is that, when a diagram is loaded, that the zoom level is
> set to fit the entire diagram. To do this I need to get the bounds of the
> elements in my diagram (easy) and the size of the client area of my
viewport
> (seemed easy). The problem that I am having is where to put the code so
that
> the client area is set to the proper value. If I do it in
> initializeGraphicalViewer or configureGraphicalViewer, the viewport bounds
> don't have the proper values.
>
> Could someone point me to the write place in the code?
>
> Thanks,
> Bradley.
>
>
Previous Topic:GEF 2.1.1 and Eclipse 3.0 Integration Build
Next Topic:A question about setContents()
Goto Forum:
  


Current Time: Sat Dec 21 14:56:28 GMT 2024

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

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

Back to the top