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

Adding API calls for helping with selection. #163

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

isleshocky77
Copy link

Not sure if anyone else would find this useful; but I wanted to have the quick ability to change the selection on the image. The following commits make selecting the maximum space on an image and moving a selection to be stuck on certain spots extremely quick and easy. I'm not 100% sure that the code is placed in the correct location of the code-base, but I couldn't find a better spot for it.

Adds the following API methods

  • selectMax
  • selectCenter
  • selectTopLeft
  • selectTopRight
  • selectBottomLeft
  • selectBottomRight

An example usage is the following

$(document).ready(function(){
    var jCropApi;
    $('#TheImage').Jcrop({
        aspectRatio: 2 / 3,
        onChange: showCoords
    }, function () {
        jCropApi = this;

        $('button#SelectMax').click(function() {jCropApi.selectMax();});
        $('button#SelectCenter').click(jCropApi.selectCenter);
        $('button#SelectTopLeft').click(jCropApi.selectTopLeft);
        $('button#SelectTopRight').click(jCropApi.selectTopRight);
        $('button#SelectBottomLeft').click(jCropApi.selectBottomLeft);
        $('button#SelectBottomRight').click(jCropApi.selectBottomRight);
    });
});

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

Successfully merging this pull request may close these issues.

1 participant