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

Event "cropEnd" #7

Closed
kaermorchen opened this issue Jan 10, 2018 · 4 comments
Closed

Event "cropEnd" #7

kaermorchen opened this issue Jan 10, 2018 · 4 comments

Comments

@kaermorchen
Copy link

Hi.

@jamesssooi your Croppr.js is really cool, but using onUpdate event is too frequent for calculate new image.

Can I use "cropEnd" event (or something like that) when user has stoped crop?

@jamesssooi
Copy link
Owner

That's a really good suggestion @kaermorchen, will definitely work that in an update the next few days. Thanks!

jamesssooi added a commit that referenced this issue Jan 10, 2018
The current and only callback (onUpdate) triggers on every single mouse move
event, which may be too much and too frequent. As such, this merge commit
implements new callbacks for Croppr to cover more bases:
  * onCropStart: Triggers when users start modifying the crop region
  * onCropMove: Triggers when crop region changes (similar to onUpdate)
  * onCropEnd: Triggers when users stop modifying the crop region

This commit sees the deprecation of the onUpdate callback in favor of the
newer callbacks. However, it remains in Croppr for compatibility purposes but
will be removed in the next major release. Developers still utilizing the
onUpdate callback will be served a deprecation notice in the console.

See #7
@jamesssooi
Copy link
Owner

I've added the following three new callbacks in the develop branch. You can read the latest documentation here.

  • onCropStart: Triggers when users start modifying the crop region
  • onCropMove: Triggers when crop region changes (similar to the current onUpdate)
  • onCropEnd: Triggers when users stop modifying the crop region

I realised onUpdate can be confusing as it could mean either onCropMove or onCropEnd. As such, I've decided to also deprecate the existing onUpdate callback to create a more uniform, consistent, and less ambiguous API.

It will still remain in Croppr.js however for backwards compatibility purposes, but will be removed after one or two major releases. Developers still using onUpdate will see deprecation notices in their console.

Let me know what you think before I merge it into master and package a new release on npm!

@kaermorchen
Copy link
Author

Yes, that is what I needed. So fast update. Thank you.

@jamesssooi
Copy link
Owner

Issued a new release with the new callbacks as v2.0.0 in npm. Closing this for now.

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

No branches or pull requests

2 participants