dist/crocodoc.viewer.js
function (val) {
            var zoomVal = parseFloat(val),
                state = this.state,
                zoomState = state.zoomState,
                currentZoom = zoomState.zoom,
                nextZoom = currentZoom;

            // number
            if (zoomVal) {
                nextZoom = zoomVal;
            } else {
                switch (val) {
                    case Crocodoc.ZOOM_FIT_WIDTH:
                        // falls through
                    case Crocodoc.ZOOM_FIT_HEIGHT:
                        // falls through
                    case Crocodoc.ZOOM_AUTO:
                        nextZoom = this.calculateZoomValue(val);
                        break;

                    case Crocodoc.ZOOM_IN:
                        // falls through
                    case Crocodoc.ZOOM_OUT:
                        nextZoom = this.calculateNextZoomLevel(val) || currentZoom;
                        break;

                    // bad mode or no value
                    default:
                        // if there hasn't been a zoom set yet
                        if (!currentZoom) {
                            //use default zoom
                            nextZoom = this.calculateZoomValue(this.config.zoom || Crocodoc.ZOOM_AUTO);
                        }
                        else if (zoomState.zoomMode) {
                            //adjust zoom
                            nextZoom = this.calculateZoomValue(zoomState.zoomMode);
                        } else {
                            nextZoom = currentZoom;
                        }
                        break;
                }
            }

            return nextZoom;
        }
function (val) {
            var zoomVal = parseFloat(val),
                state = this.state,
                zoomState = state.zoomState,
                currentZoom = zoomState.zoom,
                nextZoom = currentZoom;

            // number
            if (zoomVal) {
                nextZoom = zoomVal;
            } else {
                switch (val) {
                    case Crocodoc.ZOOM_FIT_WIDTH:
                        // falls through
                    case Crocodoc.ZOOM_FIT_HEIGHT:
                        // falls through
                    case Crocodoc.ZOOM_AUTO:
                        nextZoom = this.calculateZoomValue(val);
                        break;

                    case Crocodoc.ZOOM_IN:
                        // falls through
                    case Crocodoc.ZOOM_OUT:
                        nextZoom = this.calculateNextZoomLevel(val) || currentZoom;
                        break;

                    // bad mode or no value
                    default:
                        // if there hasn't been a zoom set yet
                        if (!currentZoom) {
                            //use default zoom
                            nextZoom = this.calculateZoomValue(this.config.zoom || Crocodoc.ZOOM_AUTO);
                        }
                        else if (zoomState.zoomMode) {
                            //adjust zoom
                            nextZoom = this.calculateZoomValue(zoomState.zoomMode);
                        } else {
                            nextZoom = currentZoom;
                        }
                        break;
                }
            }

            return nextZoom;
        }
function ( val ) { var zoomVal = parseFloat ( val ) , state = this . state , zoomState = state . zoomState , currentZoom = zoomState . zoom , nextZoom = currentZoom ; // number if ( zoomVal ) { nextZoom = zoomVal ; } else { switch ( val ) { case Crocodoc . ZOOM_FIT_WIDTH : // falls through case Crocodoc . ZOOM_FIT_HEIGHT : // falls through case Crocodoc . ZOOM_AUTO : nextZoom = this . calculateZoomValue ( val ) ; break ; case Crocodoc . ZOOM_IN : // falls through case Crocodoc . ZOOM_OUT : nextZoom = this . calculateNextZoomLevel ( val ) || currentZoom ; break ; // bad mode or no value default : // if there hasn't been a zoom set yet if ( ! currentZoom ) { //use default zoom nextZoom = this . calculateZoomValue ( this . config . zoom || Crocodoc . ZOOM_AUTO ) ; } else if ( zoomState . zoomMode ) { //adjust zoom nextZoom = this . calculateZoomValue ( zoomState . zoomMode ) ; } else { nextZoom = currentZoom ; } break ; } } return nextZoom ; }
Parse the given zoom value into a number to zoom to.
@param   {float|string} val The zoom level (float or one of the zoom constants)
@returns {float} The parsed zoom level
Parse the given zoom value into a number to zoom to .