Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

determine lowset zoom #9

Closed
bharatpatil opened this issue Feb 5, 2014 · 5 comments
Closed

determine lowset zoom #9

bharatpatil opened this issue Feb 5, 2014 · 5 comments

Comments

@bharatpatil
Copy link

Is there any way to identify that we are on lowest possible zoom so that I can execute another function?

@bharatpatil
Copy link
Author

actually I wanted to execute a code to fit complete image inside crop area upon on lowest possible zoom

@acornejo
Copy link
Owner

acornejo commented Feb 5, 2014

Yes, the property minPercent of the cropbox data (I will document this).

So you would do:

$('yourimage').data('cropbox').minPercent

This property will only be populated AFTER the image has been loaded by the browser (otherwise it can't be computed). Therefore I suggest you query for the property inside the the cropbox event, like this:

$('yourimage').on('cropbox', function (event, result, cropbox) {
   console.log('lowest zoom is ' + cropbox.minPercent);
});

@acornejo acornejo closed this as completed Feb 5, 2014
@bharatpatil
Copy link
Author

Wow!! Thanks for such a nice plugin.
Sorry for my wrong question, my question should have been how to identify when I am zooming out if I am on lowest zoom. Once I am on lowest zoom inside zoomout function and again user tries to zoom out 2nd time I wanted to fit image inside cropbox viewport.

I hope you got my question..!!

@acornejo
Copy link
Owner

acornejo commented Feb 6, 2014

I don't think I understand you. The image should always be "fit" inside the cropbox viewport.

If you want to zoom out beyond the boundaries of the image (i.e. you want part of the cropbox to have empty space), then this is unsupported by this plugin. You are welcome to submit a pull request implementing this feature, but it should be optional since most people don't want that behavior.

@bharatpatil
Copy link
Author

Yes you are correct but I have such a requirement then I will be setting image width:auto / 100% and height:auto / 100% depending upon the image ratio.

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

No branches or pull requests

2 participants