andrefarzat / ng-jcrop

Angular directive to jCrop jQuery plugin
GNU General Public License v2.0
101 stars 39 forks source link

No selection on start? #9

Closed bbirand closed 9 years ago

bbirand commented 9 years ago

Thanks for this package, it works very well! My one question is, how do I start out the app without any selection? I tried setting all the values in the selection array to 0, but that highlights the entire picture?

bbirand commented 9 years ago

Also, as a related point, is there a way to access the Jcrop object from outside the module's scope? Maybe then I can call the release() method on that object..?

andrefarzat commented 9 years ago

Hey @bbirand, it wasn't possible to start without the selection. I did some changes and made it possible. May I ask you to test it here : http://jsfiddle.net/andrefarzat/v5ty4cnv/6/ ? If you say it's ok, I will create a new version to bower.

About the jcrop object. It's not possible as it is now. I set up only one event JcropChangeSrc as an external interface. If you explain me better the use case, we might come up with a way to create the interface you need =)

bbirand commented 9 years ago

Thanks a lot for the quick reply, @andrefarzat ! I will give it a try very shortly. The use case that I have for exposing the jcrop object is so that I can call the .release() method on it. In my app, I select a portion of an image, and then click a button. In the handler for the click, I save the coordinates, and want to reset the screen so that another entry can be made.

I tried to play with the code, but it seems like it's kinda hard to expose methods from directives. One way I found could be this:http://jsfiddle.net/Mve2e/

Another one would be just to have a special value on the selection property. Maybe if an array of 0s is passed, the selection is cleared or so? Any thoughts on this?

andrefarzat commented 9 years ago

@bbirand I see what you mean. Setting an array with all values as 0 it would be still a valid value. IMO it makes more sense setting the selection to null instead of creating an interface to call .release() method to clear the selection. What do you think ?

bbirand commented 9 years ago

Makes sense! I see that that's the modification that you made above as well, right? If I set selection to null after the app is first loaded, then that corresponds to a .release()?

andrefarzat commented 9 years ago

@bbirand yes! But I gonna check if setting selection to null on the fly also makes it non-selected

andrefarzat commented 9 years ago

@bbirand I believe I reached the right point. Can you confirm for me: http://jsfiddle.net/andrefarzat/v5ty4cnv/8/ ?

bbirand commented 9 years ago

Looks and works great! Pretty nice and clean interface for releasing!

On Nov 24, 2014, at 2:36 PM, André Farzat notifications@github.com wrote:

@bbirand I believe I reached the right point. Can you confirm for me: http://jsfiddle.net/andrefarzat/v5ty4cnv/8/ ?

— Reply to this email directly or view it on GitHub.

andrefarzat commented 9 years ago

version 1.1.2 created. Just updated with bower.

Thanks a lot =)