dist/crocodoc.viewer.js
function (shouldNotCenter) {
            var state = this.state,
                zoomState = state.zoomState,
                ratio = zoomState.zoom / zoomState.prevZoom,
                newScrollLeft, newScrollTop;

            // update scroll position
            newScrollLeft = state.scrollLeft * ratio;
            newScrollTop = state.scrollTop * ratio;

            // zoom to center
            if (shouldNotCenter !== true) {
                newScrollTop += state.viewportDimensions.offsetHeight * (ratio - 1) / 2;
                newScrollLeft += state.viewportDimensions.offsetWidth * (ratio - 1) / 2;
            }

            // scroll!
            this.scrollToOffset(newScrollLeft, newScrollTop);
        }
function (shouldNotCenter) {
            var state = this.state,
                zoomState = state.zoomState,
                ratio = zoomState.zoom / zoomState.prevZoom,
                newScrollLeft, newScrollTop;

            // update scroll position
            newScrollLeft = state.scrollLeft * ratio;
            newScrollTop = state.scrollTop * ratio;

            // zoom to center
            if (shouldNotCenter !== true) {
                newScrollTop += state.viewportDimensions.offsetHeight * (ratio - 1) / 2;
                newScrollLeft += state.viewportDimensions.offsetWidth * (ratio - 1) / 2;
            }

            // scroll!
            this.scrollToOffset(newScrollLeft, newScrollTop);
        }
function ( shouldNotCenter ) { var state = this . state , zoomState = state . zoomState , ratio = zoomState . zoom / zoomState . prevZoom , newScrollLeft , newScrollTop ; // update scroll position newScrollLeft = state . scrollLeft * ratio ; newScrollTop = state . scrollTop * ratio ; // zoom to center if ( shouldNotCenter !== true ) { newScrollTop += state . viewportDimensions . offsetHeight * ( ratio - 1 ) / 2 ; newScrollLeft += state . viewportDimensions . offsetWidth * ( ratio - 1 ) / 2 ; } // scroll! this . scrollToOffset ( newScrollLeft , newScrollTop ) ; }
Update the scroll position after a zoom
@param {bool} shouldNotCenter Whether or not the scroll position
should be updated to center the new
zoom level
@returns {void}
Update the scroll position after a zoom