From: WMDE-Fisch Date: Fri, 20 Jan 2017 10:01:27 +0000 (+0100) Subject: Fix positioning error with draggable, revert and grid X-Git-Tag: 1.31.0-rc.0~4197^2 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=71e11de2a3dfc9a7c18efb6aa33b9ae45a20bd2e;p=lhc%2Fweb%2Fwiklou.git Fix positioning error with draggable, revert and grid This minor change fixes an error when using draggable revert and grid. Since upgrading of jQuery UI probably won't happen in the near future [1] I looked for another way to fix the issue. See [2]. Unlike stated in the second comment adding the lines below won't fix the bug. Moving the lines up fixed the issue. See also the description of the bug in [3]. [1] https://phabricator.wikimedia.org/T71386 [2] https://bugs.jqueryui.com/ticket/4696 [3] https://phabricator.wikimedia.org/T140965#2944610 Bug: T140965 Change-Id: Ib0f386c6a2447740f44591be70c34cf4a83b88c4 --- diff --git a/resources/lib/jquery.ui/jquery.ui.draggable.js b/resources/lib/jquery.ui/jquery.ui.draggable.js index 37680224cf..723dbd4915 100644 --- a/resources/lib/jquery.ui/jquery.ui.draggable.js +++ b/resources/lib/jquery.ui/jquery.ui.draggable.js @@ -133,9 +133,13 @@ $.widget("ui.draggable", $.ui.mouse, { }); //Generate the original position - this.originalPosition = this.position = this._generatePosition(event); this.originalPageX = event.pageX; this.originalPageY = event.pageY; + this.originalPosition = this.position = this._generatePosition(event); + // These lines where moved up to fix an issue with with draggable, revert and grid + // See: https://bugs.jqueryui.com/ticket/4696 and https://gerrit.wikimedia.org/r/#/c/333224 + // this.originalPageX = event.pageX; + // this.originalPageY = event.pageY; //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));