equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * imgAreaSelect jQuery plugin |
2 * imgAreaSelect jQuery plugin |
3 * version 0.9.10-monkey |
3 * version 0.9.10-wp |
4 * |
4 * |
5 * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net) |
5 * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net) |
6 * |
6 * |
7 * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 * Dual licensed under the MIT (MIT-LICENSE.txt) |
8 * and GPL (GPL-LICENSE.txt) licenses. |
8 * and GPL (GPL-LICENSE.txt) licenses. |
386 /* |
386 /* |
387 * Need to reset the document keypress event handler -- unbind the |
387 * Need to reset the document keypress event handler -- unbind the |
388 * current handler |
388 * current handler |
389 */ |
389 */ |
390 if ($.imgAreaSelect.onKeyPress != docKeyPress) |
390 if ($.imgAreaSelect.onKeyPress != docKeyPress) |
391 $(document).unbind($.imgAreaSelect.keyPress, |
391 $(document).off($.imgAreaSelect.keyPress, |
392 $.imgAreaSelect.onKeyPress); |
392 $.imgAreaSelect.onKeyPress); |
393 |
393 |
394 if (options.keys) |
394 if (options.keys) |
395 /* |
395 /* |
396 * Set the document keypress event handler to this instance's |
396 * Set the document keypress event handler to this instance's |
397 * docKeyPress() function |
397 * docKeyPress() function |
398 */ |
398 */ |
399 $(document)[$.imgAreaSelect.keyPress]( |
399 $(document).on( $.imgAreaSelect.keyPress, function() { |
400 $.imgAreaSelect.onKeyPress = docKeyPress); |
400 $.imgAreaSelect.onKeyPress = docKeyPress; |
|
401 }); |
401 } |
402 } |
402 |
403 |
403 /* |
404 /* |
404 * Internet Explorer displays 1px-wide dashed borders incorrectly by |
405 * Internet Explorer displays 1px-wide dashed borders incorrectly by |
405 * filling the spaces between dashes with white. Toggling the margin |
406 * filling the spaces between dashes with white. Toggling the margin |
929 position: 'absolute', |
930 position: 'absolute', |
930 /* |
931 /* |
931 * The font-size property needs to be set to zero, otherwise |
932 * The font-size property needs to be set to zero, otherwise |
932 * Internet Explorer makes the handles too large |
933 * Internet Explorer makes the handles too large |
933 */ |
934 */ |
934 fontSize: 0, |
935 fontSize: '0', |
935 zIndex: zIndex + 1 || 1 |
936 zIndex: zIndex + 1 || 1 |
936 }); |
937 }); |
937 |
938 |
938 /* |
939 /* |
939 * If handle width/height has not been set with CSS rules, set the |
940 * If handle width/height has not been set with CSS rules, set the |
1008 } |
1009 } |
1009 |
1010 |
1010 /* Calculate the aspect ratio factor */ |
1011 /* Calculate the aspect ratio factor */ |
1011 aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; |
1012 aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; |
1012 |
1013 |
1013 $img.add($outer).unbind('mousedown', imgMouseDown); |
1014 $img.add($outer).off('mousedown', imgMouseDown); |
1014 |
1015 |
1015 if (options.disable || options.enable === false) { |
1016 if (options.disable || options.enable === false) { |
1016 /* Disable the plugin */ |
1017 /* Disable the plugin */ |
1017 $box.off({ 'mousemove touchmove': areaMouseMove, |
1018 $box.off({ 'mousemove touchmove': areaMouseMove, |
1018 'mousedown touchstart': areaMouseDown }); |
1019 'mousedown touchstart': areaMouseDown }); |
1023 /* Enable the plugin */ |
1024 /* Enable the plugin */ |
1024 if (options.resizable || options.movable) |
1025 if (options.resizable || options.movable) |
1025 $box.on({ 'mousemove touchmove': areaMouseMove, |
1026 $box.on({ 'mousemove touchmove': areaMouseMove, |
1026 'mousedown touchstart': areaMouseDown }); |
1027 'mousedown touchstart': areaMouseDown }); |
1027 |
1028 |
1028 $(window).resize(windowResize); |
1029 $(window).on( 'resize', windowResize); |
1029 } |
1030 } |
1030 |
1031 |
1031 if (!options.persistent) |
1032 if (!options.persistent) |
1032 $img.add($outer).on('mousedown touchstart', imgMouseDown); |
1033 $img.add($outer).on('mousedown touchstart', imgMouseDown); |
1033 } |
1034 } |
1160 * .fadeIn(). |
1161 * .fadeIn(). |
1161 */ |
1162 */ |
1162 $box.add($outer).css({ visibility: 'hidden', position: position, |
1163 $box.add($outer).css({ visibility: 'hidden', position: position, |
1163 overflow: 'hidden', zIndex: zIndex || '0' }); |
1164 overflow: 'hidden', zIndex: zIndex || '0' }); |
1164 $box.css({ zIndex: zIndex + 2 || 2 }); |
1165 $box.css({ zIndex: zIndex + 2 || 2 }); |
1165 $area.add($border).css({ position: 'absolute', fontSize: 0 }); |
1166 $area.add($border).css({ position: 'absolute', fontSize: '0' }); |
1166 |
1167 |
1167 /* |
1168 /* |
1168 * If the image has been fully loaded, or if it is not really an image (eg. |
1169 * If the image has been fully loaded, or if it is not really an image (eg. |
1169 * a div), call imgLoad() immediately; otherwise, bind it to be called once |
1170 * a div), call imgLoad() immediately; otherwise, bind it to be called once |
1170 * on image load event. |
1171 * on image load event. |