brtnshrdr / angular2-image-zoom

An Angular2 Image Zoom Directive
MIT License
22 stars 15 forks source link

_widthRatio and this._heightRatio are NaN #14

Open melicard opened 7 years ago

melicard commented 7 years ago

Hi, in the way that the script is coded by default I have the following problem in

    ImageZoom.prototype.setImageZoomLensSize = function () {
        this.imageZoomLens.setLensSize(this.lensWidth / this._widthRatio, this.lensHeight / this._heightRatio);
    };

this._widthRatio and this._heightRatio have the values Nan as setImageZoomLensSize is being called before changeZoomLevel() where those values are set. I needed to modify the order of the calls in imageChanged to this one to make it work:

_this.changeZoomLevel(); 
_this.setImageZoomLensSize();