dist/js/cropjs.js
function (redraw) {
            var cx, cy;

            this._keepCenter = true;
            cx = this._container.clientWidth / 2;
            cy = this._container.clientHeight / 2;

            var ix = ((this._image.w * this._zoomLevel) / 2) + (this._image.x * this._zoomLevel) + this._margin;
            var iy = ((this._image.h * this._zoomLevel) / 2) + (this._image.y * this._zoomLevel) + this._margin;

            var x = (cx == ix) ? 0 : (cx - ix) / this._zoomLevel;
            var y = (cy == iy) ? 0 : (cy - iy) / this._zoomLevel;

            this._image.move({x: x, y: y});

            if (redraw === true) {
                this.redraw();
            }
        }
function (redraw) {
            var cx, cy;

            this._keepCenter = true;
            cx = this._container.clientWidth / 2;
            cy = this._container.clientHeight / 2;

            var ix = ((this._image.w * this._zoomLevel) / 2) + (this._image.x * this._zoomLevel) + this._margin;
            var iy = ((this._image.h * this._zoomLevel) / 2) + (this._image.y * this._zoomLevel) + this._margin;

            var x = (cx == ix) ? 0 : (cx - ix) / this._zoomLevel;
            var y = (cy == iy) ? 0 : (cy - iy) / this._zoomLevel;

            this._image.move({x: x, y: y});

            if (redraw === true) {
                this.redraw();
            }
        }
function ( redraw ) { var cx , cy ; this . _keepCenter = true ; cx = this . _container . clientWidth / 2 ; cy = this . _container . clientHeight / 2 ; var ix = ( ( this . _image . w * this . _zoomLevel ) / 2 ) + ( this . _image . x * this . _zoomLevel ) + this . _margin ; var iy = ( ( this . _image . h * this . _zoomLevel ) / 2 ) + ( this . _image . y * this . _zoomLevel ) + this . _margin ; var x = ( cx == ix ) ? 0 : ( cx - ix ) / this . _zoomLevel ; var y = ( cy == iy ) ? 0 : ( cy - iy ) / this . _zoomLevel ; this . _image . move ( { x : x , y : y } ) ; if ( redraw === true ) { this . redraw ( ) ; } }
Center image around the middle point of the drawing area
@param redraw
Center image around the middle point of the drawing area