From: Eduardo Lundgren Date: Fri, 30 May 2008 19:18:20 +0000 (+0000) Subject: More fixes for userAction X-Git-Tag: 1.5.1~266 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=10afdceddedad72ef826cebb441b4cfd8a788270;p=jquery-ui.git More fixes for userAction --- diff --git a/ui/tests/jquery.useraction.js b/ui/tests/jquery.useraction.js index 605063184..6a94b3944 100644 --- a/ui/tests/jquery.useraction.js +++ b/ui/tests/jquery.useraction.js @@ -114,37 +114,42 @@ $.extend($.userAction.prototype, { // drag helper function, thanks Richard Worth's testmouse api. var self = this, o = this.options, center = this.findCenter(), target = $(this.target), lastx = center.x, lasty = center.y, - fake = $(StringPool.FAKE_CURSOR_EXP); + fake = $(StringPool.FAKE_CURSOR_EXP), + speed = o.speed || StringPool.SLOW, + easing = o.easing || StringPool.SWING; fake = fake.size() ? fake : $(StringPool.FAKE_CURSOR_DIV) .css({ position: StringPool.ABSOLUTE }).appendTo(document.body); fake - .animate({ left: center.x, top: center.y }, "fast", function() { + .animate({ left: center.x, top: center.y }, speed, easing, function() { target .userAction(StringPool.MOUSEOVER) .userAction(StringPool.MOUSEDOWN) .userAction(StringPool.MOUSEMOVE); }) .animate({ left: center.x + (dx||0), top: center.y + (dy||0) }, { - speed: "fast", + speed: speed, + easing: easing, step: function(i, anim) { lastx = anim.prop == StringPool.LEFT ? i : lastx; lasty = anim.prop == StringPool.TOP ? i : lasty; - target.userAction(StringPool.MOUSEMOVE, { x: lastx, y: lasty, after: o.drag }); + target.userAction(StringPool.MOUSEMOVE, { x: lastx, y: lasty, after: o.drag || o.after }); }, complete: function() { target.userAction(StringPool.MOUSEUP).userAction(StringPool.MOUSEOUT); // remove fake cursor - //$(this).remove(); + $(this).remove(); // trigger drag queue var queue = $.data(self.target, StringPool.DATA_QUEUE); if (queue) queue.shift(); + if (queue && queue[0]) self.drag(queue[0][0], queue[0][1]); + else $.removeData(self.target, StringPool.DATA_QUEUE); } }); }, @@ -278,7 +283,9 @@ var StringPool = { ABSOLUTE: 'absolute', DATA_QUEUE: 'ua-drag-queue', TOP: 'top', - LEFT: 'left' + LEFT: 'left', + SLOW: 'slow', + SWING: 'swing' }; })(jQuery); \ No newline at end of file