Opened 5 years ago

Last modified 3 years ago

#7853 open bug

Draggable: cloned helper of different dimensions than original not dragged by click point

Reported by: duncanbeevers Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.draggable Version: 1.8.16
Keywords: haspatch Cc:
Blocked by: Blocking:

Description

When a draggable is cloned and the helper has dimensions different than the original element, the drag registration point remains the click point on the original element instead of being scaled to the appropriate point on the cloned element.

Demonstration: http://jsfiddle.net/p8wXv/

Change History (7)

comment:2 Changed 5 years ago by rdworth

Proposed steps to implement:

  1. On start, calculate x and y position of mouse cursor relative to draggable: relX, relY
  2. Position helper top and left at position of mouse cursor (note: not at top/left of draggable)
  3. Use helper width / draggable width and helper height / draggable height to compute: factorX and factorY
  4. Translate helper left by relX * factorX and up by relY * factorY

This should ensure the cursor is over the helper and at an equal relative distance from the helper's top/left as the draggable's top/left

I believe https://github.com/duncanbeevers/jquery-ui/commit/bb4657e84c73f045dbe3f85620275987dc595fc8 may be missing step 2 above

comment:3 Changed 5 years ago by duncanbeevers

I found I did not immediately have access to the cloned helper's dimensions.

comment:4 Changed 4 years ago by scottgonzalez

  • Milestone changed from 1.9.0 to 2.0.0

comment:5 Changed 4 years ago by mikesherov

  • Status changed from new to open

comment:6 Changed 4 years ago by mikesherov

  • Keywords haspatch added
  • Summary changed from Draggable cloned helper of different dimensions than original not dragged by click point to Draggable: cloned helper of different dimensions than original not dragged by click point

comment:7 Changed 3 years ago by mikesherov

#9325 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.