Skip to main content

Search and Top Navigation

#2136 closed bug (fixed)

Opened January 09, 2008 02:23PM UTC

Closed March 14, 2008 05:11PM UTC

Last modified February 26, 2009 11:23AM UTC

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:
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.

Attachments (0)
Change History (4)

Changed February 12, 2008 01:10PM UTC by paul comment:1

owner: paulcodesquare

Changed March 14, 2008 05:11PM UTC by paul comment:2

resolution: → fixed
status: newclosed

This should be fixed.

Changed May 24, 2008 03:39AM UTC by comment:3

milestone: 1.2.2

Milestone 1.2.2 deleted

Changed February 26, 2009 11:23AM UTC by paul comment:4

milestone: → 1.5