Opened 18 months ago

Last modified 18 months 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:

http://jsfiddle.net/e3napvsv/

Buggy behavior shows itself in both Chrome and Firefox.

thanks.

Change History (2)

comment:1 Changed 18 months ago by lorymole

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.

http://jsfiddle.net/lorymole/apocd10a/

In the above draggable, the draggable will drift left when dragged (slightly) to the right.

thanks.

Last edited 18 months ago by lorymole (previous) (diff)

comment:2 Changed 18 months ago by scottgonzalez

  • Component changed from ui.core to ui.draggable
  • Status changed from new to open
  • Summary changed from Draggable drifts of axis to Draggable drifts off axis
Note: See TracTickets for help on using tickets.