пятница, 22 февраля 2013 г.

Jcrop + Twitter Bootstrap js фиксим баг.


Twitter Bootstrap 2.3: Crop Area Continues Moving After Selection



Споймал такой же баг https://github.com/tapmodo/Jcrop/issues/79 (описание на англ)

При выделении области для кропа, она бегает за указателем мыши. В консоли ошибка "Uncaught RangeError: Maximum call stack size exceeded" jcrop.
Оказывается лечится просто:
В Jcrop в функции https://github.com/tapmodo/Jcrop/blob/master/js/jquery.Jcrop.js#L1153
function toBack() //{{{
{
$trk.css({
zIndex: 290
});
$(document).unbind('.jcrop');
}
view raw gistfile1.js hosted with ❤ by GitHub

строку: $(document).unbind('.jcrop');
заменим на
$(document).unbind('touchmove.jcrop');
$(document).unbind('touchend.jcrop');
$(document).unbind('mousemove.jcrop');
$(document).unbind('mouseup.jcrop');
view raw gistfile1.js hosted with ❤ by GitHub
все заработало ) 

Комментариев нет:

Отправить комментарий