scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
875 stars 304 forks source link

onOffsetChange firing when plugin loads #106

Open aas395 opened 9 years ago

aas395 commented 9 years ago

Looks like this fires when the plugin loads under the following conditions:

imageState.src passed into config without any other imageState options ImageState.src and imageState.zoom passed in together imageState.src and both imageState.offset.x and imageState.offset.y passed. If only one or the other offset property is passed, onOffsetChange does not fire on load

Seems to me this shouldn't fire unless you've manually changed the offset. Let me know what you think.

scottcheng commented 9 years ago

I think it could make sense both ways. When cropit is initiated with a preset offset, it is "changed" in the sense that it's different from the default.

Is this creating any issue for your application?

bharatpatil commented 9 years ago

I think that is ok. User of the plugin may have to manage by setting some flag. I am currently doing that. I manage a global flag, when plugin first loads, in onOffsetChange callback, that flag is checked, if it is false then change it to true and do nothing, if true then do normal processing.