Hide and Show the cropper selection

13 views
Skip to first unread message

Michael B

unread,
Jun 9, 2008, 11:44:35 AM6/9/08
to javascript-image-cropper-ui
Wonderful work Dave!

I am using displayOnInit: and onloadCoords: when I want to pass in
pre-
set crop values when the cropper loads.


However, once the page loads, I have a situation where I want a
toggle
to show or hide the cropper depending on the state of a checkbox on
my
form.


When I hide the cropper, I want to store the last coordinates so if
the cropper is made visible again, then the previous selection is
visible.


I think I want to use some combination of removeCropper and
resetCropper, but with coordinate values on the reset.


I have been unable to call attacattachCropper(); again after the form
has initially loaded.


Thanks in advance for any assisstance.


Michael


David Spurr

unread,
Jun 9, 2008, 11:56:51 AM6/9/08
to javascript-image-cropper-ui
If you've got the co-ordinates stored then you could call the
setAreaCoords() method when you want to re-display it (after calling
resetCropper). This method is meant to be private, but that's the only
way of doing what you want at the moment.

-D

Michael B

unread,
Jun 10, 2008, 12:38:24 AM6/10/08
to javascript-image-cropper-ui
I can't seem to get that suggestion to work and I am not exactly sure
how I should be calling this... Here is what I am doing:

this.curCrop.reset();
this.setAreaCoords( {x1: 10, y1: 10, x2: 100, y2: 300},true,false);

Michael
> > Michael- Hide quoted text -
>
> - Show quoted text -

Michael B

unread,
Jun 10, 2008, 12:19:28 PM6/10/08
to javascript-image-cropper-ui
Ok. I figured it out.

It works fine when I call it like this:

this.curCrop.reset();

var previousCoords = { x1: prevX1, y1: prevY1, x2: prevX2, y2:
prevY2 };

this.curCrop.setAreaCoords( previousCoords );
this.curCrop.selArea.show();
this.curCrop.drawArea();
this.curCrop.endCrop();
> > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages