adriengibrat / jQuery-crop

Image Cropping jQuery Plugin
24 stars 13 forks source link

disable max zoom? #4

Closed daniel-hopkins closed 11 years ago

daniel-hopkins commented 11 years ago

Thanks for this plugin, I have been using it for a while, and even adapted it to use a jquery ui slider instead of the buttons.

An "issue" I'm facing now is if I have { width: 200, height:200 } and the user uploads an image that is <= 200 x 200 the zoom controls do nothing because minPercent is already >= 1.

The other scenario that makes the behavior strange is if the user uploads an image @ 210x210. the click controls only zoom 1px per click (assuming { step:10 } ).

Even though images would get pixelated, I think I'd like to allow them to zoom past minPercent.

Any thoughts on a tweak to allow this?

thanks

adriengibrat commented 11 years ago

I've made a few commit to add a new option, and to document it.

Now there is a stretch option, default value is 1, but you can put what float you want greater than 1 (2 allow to zoom up to 2x ...).

In the code, it wasn't minPercent the pb, but the "1" right next to it ;)

And about the click controls only zoom 1px per click... since the commit i couldn't reproduce the bug!

Hope this help. I'm waiting your response to close the issue.

daniel-hopkins commented 11 years ago

Hi Adrien, wow, thanks for the quick turnaround. I think this is a step in the right direction, but the behavior is still not always as expected. when loading an image larger than the window, it zooms as before when loading an image the same size as the window, it doesn't zoom at all when loading an image that is smaller than the window, the minus button zooms in, and the plus button zooms out

I made a fiddle to show you what I mean. http://jsfiddle.net/szZGe/

btw, there is a typo *stretch

Daniel

adriengibrat commented 11 years ago

Hi,

Oops, That's what happend when I code after 2 am when my son wakes me up!

The latest commit should fix this, thanks for the fiddle and typo ;)

Adrien

2013/10/13 niestudio notifications@github.com

Hi Adrien, wow, thanks for the quick turnaround. I think this is a step in the right direction, but the behavior is still not always as expected. when loading an image larger than the window, it zooms as before when loading an image the same size as the window, it doesn't zoom at all when loading an image that is smaller than the window, the minus button zooms in, and the plus button zooms out

I made a fiddle to show you what I mean. http://jsfiddle.net/szZGe/

btw, there is a typo *stretch

Daniel

— Reply to this email directly or view it on GitHubhttps://github.com/adriengibrat/jQuery-crop/issues/4#issuecomment-26209533 .

adriengibrat commented 11 years ago

you can test it, i've updated the js fiddle: http://jsfiddle.net/szZGe/3/

daniel-hopkins commented 11 years ago

brilliant! You may want to update the version number too. Merci

adriengibrat commented 11 years ago

merci, et dire qu'on aurai pu parler en français depuis le début ;)

Adrien

2013/10/13 niestudio notifications@github.com

brilliant! You may want to update the version number too. Merci

— Reply to this email directly or view it on GitHubhttps://github.com/adriengibrat/jQuery-crop/issues/4#issuecomment-26219232 .