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

Zoom issue when using more than one cropper #32

Open
Sti3bas opened this issue Mar 15, 2016 · 2 comments
Open

Zoom issue when using more than one cropper #32

Sti3bas opened this issue Mar 15, 2016 · 2 comments

Comments

@Sti3bas
Copy link

Sti3bas commented Mar 15, 2016

Hi,
when adding new image croppers to the page, the existing image croppers zooms out if it's zoomed in.

Codepen: https://codepen.io/anon/pen/MybPwK
To reproduce the issue, zoom in the existing image cropper and then click the "Add one more" button.

@octavius37
Copy link

Hi, I think there is a problem with the scope of an image cropper. When a new cropper is instantiated, it does so with the defaults. However because the scope isn't isolated, on line 175 of angular-image-cropper.js,
if (this.imageHasToFit()) { this.fitImage(); this.centerImage(); }

this apparently points to both image croppers. So if you have imageHasToFit as true, both images will be zoomed out.

This issue not only affects the defaults. All listeners are bound to this, so if you try rotating after adding another cropper, it will rotate 180 degrees instead of 90.

This is a serious issue for anyone trying to have multiple croppers on the same page. I currently don't have a solution, and I'm not sure my javascript is at the level to implement one, however if I find something I'll let you know. The solution should probably consist of isolating the scope in some way.

@ericnewton76
Copy link

I'm running into a scoping problem too. Using this with angular 1.4.9 atm

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

No branches or pull requests

3 participants