Custom Zooming [message #194510] |
Thu, 01 September 2005 17:46  |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
Can someone please explain this to me. In the javadoc of
setZoomLevelContributions method in the ZoomManager class, it says
"Sets the list of zoom level contributions (as strings). If you contribute
something other than FIT_HEIGHT, FIT_WIDTH and FIT_ALL you must subclass
this class and override this method to implement your contributed zoom
function."
Does that mean I have to subclass ZoomManager? If so, how do I tell GEF
to use this new ZoomManager since the init of the
ScalableFreeformRootEditPart already calls a default one for you.
I am trying to set my own custom zooming so I need to ovverride the
zoomlevels.
Thank you,
Harsh
|
|
|
|
Re: Custom Zooming [message #194616 is a reply to message #194510] |
Fri, 02 September 2005 05:22   |
Eclipse User |
|
|
|
Harsh Sabikhi schrieb am 01.09.2005 23:46:
> I am trying to set my own custom zooming so I need to ovverride the
> zoomlevels.
Do you want to define only own zoomlevels?
Like 20%, 50%, 66%, etc?
If yes, jsut create an array with your zoomlevels within configureGraphicalViewer() of your editorclass:
GraphicalViewer viewer = getGraphicalViewer();
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
viewer.setRootEditPart(rootEditPart);
ZoomManager manager = rootEditPart.getZoomManager();
double[] zoomLevels = new double[] { 0.05, 0.1, 0.25, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 };
manager.setZoomLevels(zoomLevels);
ArrayList zoomContributions = new ArrayList();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
manager.setZoomLevelContributions(zoomContributions);
Andreas
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05262 seconds