Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Uncaught TypeError: self.applyZoom is not a function #29

Closed
pietrovismara opened this issue Mar 7, 2016 · 5 comments
Closed

Uncaught TypeError: self.applyZoom is not a function #29

pietrovismara opened this issue Mar 7, 2016 · 5 comments
Assignees
Labels

Comments

@pietrovismara
Copy link

Every time i try to zoomIn/Out i get this error: Uncaught TypeError: self.applyZoom is not a function

In fact in the code, there is no applyZoom function! We just have this:

Cropper.prototype.bindControls = function() {
  var self = this;  
  this.elements.controls.zoomIn.addEventListener('click', function() {
    self.applyZoom(self.zoomInFactor);
  });
  this.elements.controls.zoomOut.addEventListener('click', function() {
    self.applyZoom(self.zoomOutFactor);
  });
};

Cropper.prototype.applyZoomIn = function(zoom) {
  this.zoomImage(1 + parseFloat(zoom));
};
Cropper.prototype.applyZoomOut = function(zoom) {
  this.zoomImage(1 / ( 1 + parseFloat(zoom)));
};

Then i went on the demo page to look at the code and i saw this:

Cropper.prototype.bindControls = function() {
  var self = this;
  this.elements.controls.zoomIn.addEventListener('click', function() {
    self.applyZoom(self.zoomInFactor);
  });
  this.elements.controls.zoomOut.addEventListener('click', function() {
    self.applyZoom(self.zoomOutFactor);
  });
};

Cropper.prototype.applyZoom = function(zoom) {
  this.zoomImage(zoom);
};

This code is working, everything is fine. But where do i get this code? I tried bower, npm and git but no way to find a working version. Can you help me?

@bcabanes bcabanes added the bug label Mar 7, 2016
@bcabanes bcabanes self-assigned this Mar 7, 2016
@bcabanes
Copy link
Owner

bcabanes commented Mar 7, 2016

Hi @pietrovismara
What is the package version you use?

@pietrovismara
Copy link
Author

I tried with bower and it installed this version:
"ng-image-cropper": "https://npmcdn.com/angular-image-cropper/bower.zip#^1.1.6"

With npm:
"angular-image-cropper": "^1.1.6"

Also i looked on the code on the github repo, and it looks like the same version.

@bigfree
Copy link

bigfree commented Mar 10, 2016

@pietrovismara change:

this.elements.controls.zoomIn.addEventListener('click', function() {
    self.applyZoom(self.zoomInFactor);
});
this.elements.controls.zoomOut.addEventListener('click', function() {
    self.applyZoom(self.zoomOutFactor);
});

to:

this.elements.controls.zoomIn.addEventListener('click', function() {
    self.applyZoomIn(self.zoomInFactor);
});
this.elements.controls.zoomOut.addEventListener('click', function( {
    self.applyZoomOut(self.zoomOutFactor);
});

@pietrovismara
Copy link
Author

+1 please merge this commit and update the npm / bower packages so that we can start using this package.

bcabanes added a commit that referenced this issue Mar 15, 2016
@bcabanes
Copy link
Owner

Hi guys!
I've merge the PR and this is in the new release!
@KarlDoyle Thank you for your PR!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants