odyniec / imgareaselect

ImgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well as other user interface features, such as photo notes (like those on Flickr).
http://odyniec.net/projects/imgareaselect/
686 stars 197 forks source link

Mousedown and mousemove events get incorrectly unbinded in IE10 #55

Open ryanmcnz opened 10 years ago

ryanmcnz commented 10 years ago

As titled, when using imgAreaSelect under IE10 the control is unusable as it incorrectly removes mouse events straight away after being initialized. Oddly, this issue doesn't seem to occur on IE9 or IE8.

I suspect this is something to do with how the 'enable/disable' variables are checked, but most importantly I wonder why there are two variables throughout the code that control whether the plugin is enabled or not...both 'options.enable' and 'options.disable'. This seems a bit unnecessary, compared to having just one variable.

For the line containing the following code:

$box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown);

I've simply changed the code around this to be the following situation:

if (options.disable) {
//Do unbind code above
}
else{
//Do regular binding of mousemove and mousedown here
}

This fixed the issue for me under IE10, however it may not be the best solution as I've still left in the 'options.enable' checks elsewhere.