dist/js/cropjs.js
function (crop) {
            var pvDiv = document.getElementById(this._image.id + '_' + crop.id);
            if (pvDiv == null || typeof pvDiv != 'object') {
                return;
            }

            var pvDivInner = pvDiv.getElementsByTagName('DIV')[0]
            var pvImg = pvDiv.getElementsByTagName('IMG')[0];
            var previewHeight = window.getComputedStyle(pvDivInner).height.slice(0, -2)
            var imgDim = this._image.getDimensions();

            var previewWidth = IMSoftcrop.Ratio.width(previewHeight, crop.ratio.f);
            pvDivInner.style.width = previewWidth + 'px';

            var cropDim = crop.getDimensions();
            var cropRatio = previewWidth / cropDim.w;

            pvImg.style.height = imgDim.h * cropRatio + 'px';
            pvImg.style.marginTop = '-' + cropDim.y * cropRatio + 'px';
            pvImg.style.marginLeft = '-' + cropDim.x * cropRatio + 'px';

            if (crop.autoCropWarning == true) {
                pvDiv.classList.add('warning');
            }
            else {
                pvDiv.classList.remove('warning');
            }

            if (crop.usable == true) {
                pvDiv.classList.add('usable');
                pvDiv.classList.remove('unusable');
            }
            else {
                pvDiv.classList.add('unusable');
                pvDiv.classList.remove('usable');
            }
        }
function (crop) {
            var pvDiv = document.getElementById(this._image.id + '_' + crop.id);
            if (pvDiv == null || typeof pvDiv != 'object') {
                return;
            }

            var pvDivInner = pvDiv.getElementsByTagName('DIV')[0]
            var pvImg = pvDiv.getElementsByTagName('IMG')[0];
            var previewHeight = window.getComputedStyle(pvDivInner).height.slice(0, -2)
            var imgDim = this._image.getDimensions();

            var previewWidth = IMSoftcrop.Ratio.width(previewHeight, crop.ratio.f);
            pvDivInner.style.width = previewWidth + 'px';

            var cropDim = crop.getDimensions();
            var cropRatio = previewWidth / cropDim.w;

            pvImg.style.height = imgDim.h * cropRatio + 'px';
            pvImg.style.marginTop = '-' + cropDim.y * cropRatio + 'px';
            pvImg.style.marginLeft = '-' + cropDim.x * cropRatio + 'px';

            if (crop.autoCropWarning == true) {
                pvDiv.classList.add('warning');
            }
            else {
                pvDiv.classList.remove('warning');
            }

            if (crop.usable == true) {
                pvDiv.classList.add('usable');
                pvDiv.classList.remove('unusable');
            }
            else {
                pvDiv.classList.add('unusable');
                pvDiv.classList.remove('usable');
            }
        }
function ( crop ) { var pvDiv = document . getElementById ( this . _image . id + '_' + crop . id ) ; if ( pvDiv == null || typeof pvDiv != 'object' ) { return ; } var pvDivInner = pvDiv . getElementsByTagName ( 'DIV' ) [ 0 ] var pvImg = pvDiv . getElementsByTagName ( 'IMG' ) [ 0 ] ; var previewHeight = window . getComputedStyle ( pvDivInner ) . height . slice ( 0 , - 2 ) var imgDim = this . _image . getDimensions ( ) ; var previewWidth = IMSoftcrop . Ratio . width ( previewHeight , crop . ratio . f ) ; pvDivInner . style . width = previewWidth + 'px' ; var cropDim = crop . getDimensions ( ) ; var cropRatio = previewWidth / cropDim . w ; pvImg . style . height = imgDim . h * cropRatio + 'px' ; pvImg . style . marginTop = '-' + cropDim . y * cropRatio + 'px' ; pvImg . style . marginLeft = '-' + cropDim . x * cropRatio + 'px' ; if ( crop . autoCropWarning == true ) { pvDiv . classList . add ( 'warning' ) ; } else { pvDiv . classList . remove ( 'warning' ) ; } if ( crop . usable == true ) { pvDiv . classList . add ( 'usable' ) ; pvDiv . classList . remove ( 'unusable' ) ; } else { pvDiv . classList . add ( 'unusable' ) ; pvDiv . classList . remove ( 'usable' ) ; } }
Update rendering of current crop preview
@param crop
@private
Update rendering of current crop preview