How to initially scroll or zoom to fit in a GEF editor [message #88519] |
Fri, 25 July 2003 18:46 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03825 seconds