Bug Tracker

Ticket #2136 (closed bug: fixed)

Opened 7 years ago

Last modified 6 years ago

Draggables aren't correctly contained in parent

Reported by: Pete Michaud Owned by: codesquare
Priority: major Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: draggable Cc:
Blocking: Blocked by:

Description

Draggable elements with containment set to parent, can only move where their parent starts out: the area doesn't update as the parent dimensions change.

The reason for this is that the draggable function defines the bounding box in terms of 4 points calculated at the time of the call. If the parent is, for example, a div that has its dimensions defined as percentages, then the containment will fail on window resize, because the containment area will stay the same while the actual element changes.

Currently it's possible to work around this by destroying the draggables and calling it again on resize. It should also be possible to get the draggable instance and manually calculate the points and assign them, also on resize (that would be a cheaper option, I think).

The problem I see is determining when the box should be recalculated--I have described one situation where the bounding box changes, but other scenarios are possible as well. What if the parent is manipulated directly by a script?

I'm not sure what the best approach is because many approaches could get expensive -- maybe we should provide an OPTION to hook in to the parent's resize event.

Change History

comment:1 Changed 7 years ago by paul

  • Owner changed from paul to codesquare

comment:2 Changed 6 years ago by paul

  • Status changed from new to closed
  • Resolution set to fixed

This should be fixed.

Note: See TracTickets for help on using tickets.