Skip to content

Adding API calls for helping with selection. - #163

Open
isleshocky77 wants to merge 4 commits into
tapmodo:masterfrom
Virtuvia:selectionTools
Open

Adding API calls for helping with selection.#163
isleshocky77 wants to merge 4 commits into
tapmodo:masterfrom
Virtuvia:selectionTools

Conversation

@isleshocky77

Copy link
Copy Markdown

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