diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2013-10-20 19:33:40 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2013-10-20 19:46:05 -0400 |
commit | 94f8c4d5e9ef461973a504d65dd906c1120da71d (patch) | |
tree | f99a37641756c081ad6cb50ebdb66bf7017cc9fc /ui | |
parent | 9ca0a19a00640716e2387f42436324606ddd43ad (diff) | |
download | jquery-ui-94f8c4d5e9ef461973a504d65dd906c1120da71d.tar.gz jquery-ui-94f8c4d5e9ef461973a504d65dd906c1120da71d.zip |
Draggable: apply axis options to position instead of style. Fixes #7251 - Draggable: constrained axis option returns incorrect position.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.draggable.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 3b18f28f0..651dee3d7 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -221,12 +221,9 @@ $.widget("ui.draggable", $.ui.mouse, { this.position = ui.position; } - if(!this.options.axis || this.options.axis !== "y") { - this.helper[0].style.left = this.position.left+"px"; - } - if(!this.options.axis || this.options.axis !== "x") { - this.helper[0].style.top = this.position.top+"px"; - } + this.helper[ 0 ].style.left = this.position.left + "px"; + this.helper[ 0 ].style.top = this.position.top + "px"; + if($.ui.ddmanager) { $.ui.ddmanager.drag(this, event); } @@ -554,6 +551,13 @@ $.widget("ui.draggable", $.ui.mouse, { pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; } + if ( o.axis === "y" ) { + pageX = this.originalPageX; + } + + if ( o.axis === "x" ) { + pageY = this.originalPageY; + } } return { |