Opened 7 years ago
Last modified 7 years ago
#14697 open bug
Draggable drifts off axis
Reported by: | lorymole | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.draggable | Version: | 1.11.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Creating a draggable with an axis option ( $( "#divId" ).draggable({axis: 'x'}) ) can cause the draggable element to drift off axis.
For example, suppose one users draggable as the basis for creating a slider. When using certain rem values defining thumb dimensions (and centering the thumb), the thumb will drift off-axis on each drag. These errors accumulate as successive drags are performed.
One possible fix would be to conditionally set top in draggable() _mouseDrag():
_mouseDrag()
...
add this line if ( o.axis != "x")
this.helper[ 0 ].style.top = this.position.top + "px";
likewise for axis y and left ...
Fiddle Here:
Buggy behavior shows itself in both Chrome and Firefox.
thanks.
Change History (2)
comment:2 Changed 7 years ago by
Component: | ui.core → ui.draggable |
---|---|
Status: | new → open |
Summary: | Draggable drifts of axis → Draggable drifts off axis |
The left positioning of an x-axis draggable is also calculated incorrectly. This can be observed by creating an x-
axis draggable that is constrained to grid locations.
In the above draggable, the draggable will drift left when dragged (slightly) to the right.
thanks.