Ok, here's how to calculate the zoomOutPerc automatically.
These changes go in the ZoomViewer.as file. Place this code before the line:
gmcViewArea.setZoomOutPerc(zoomOutPerc);
And after the line:
var zoomOutPerc = Number(gXMLRoot.attributes.zoomOutPerc);
In my code I set a new variable called _global.maxImageRotation (which is the same as the maxRot constant in the Image.as variable--this defaults to 10.)
If the zoomOutPerc attribute isn't supplied, then it'll calculate the best percentage to use based on the width/height of the stage and the ViewArea.
// if the zoom out percentage was supplied, calculate it out by ViewArea
if( isNaN(zoomOutPerc) ){
// get the maximum rotation percentage
var iMaxRotation = _global.maxImageRotation/100;
// calculate the maximum width percentage
// Stage Width / (ViewArea Width + (ViewArea Width * Maximum Rotation) )
var iWidthPerc = Math.floor((_global.sWidth/(gmcViewArea.width + (gmcViewArea.width * iMaxRotation))) * 100);
// calculate the maximum height percentage
// Stage Height / (ViewArea Height + (ViewArea Height * Maximum Rotation) )
var iHeightPerc = Math.floor((_global.sHeight/(gmcViewArea.height + (gmcViewArea.height * iMaxRotation))) * 100);
// use which ever percentage is smaller--this guarantees all portions
// of images are displayed
zoomOutPerc = (iHeightPerc < iWidthPerc) ? iHeightPerc : iWidthPerc;
}
I'll be working on the zoomInPerc later. Same idea, just need to grab the max image width/height.
-Dan