Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#2136 closed bug (fixed)

Draggables aren't correctly contained in parent

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


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 (4)

comment:1 Changed 15 years ago by paul

Owner: changed from paul to codesquare

comment:2 Changed 15 years ago by paul

Resolution: fixed
Status: newclosed

This should be fixed.

comment:3 Changed 15 years ago by (none)

Milestone: 1.2.2

Milestone 1.2.2 deleted

comment:4 Changed 14 years ago by paul

Milestone: 1.5
Note: See TracTickets for help on using tickets.