Skip to main content

Search and Top Navigation

#4781 closed feature (duplicate)

Opened August 13, 2009 10:41PM UTC

Closed March 01, 2013 01:16PM UTC

Patch: force draggable's containment property to update during drag

Reported by: AJI Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.draggable Version: 1.7.2
Keywords: containment Cc:
Blocked by: Blocking:
Description

The containment property for a draggable cannot be changed while the element is being dragged. This patch resets the containment during the drag.

Use case: a draggable element mimics a slider on a horizontal graph that can be stretched. When the draggable reaches one end of the graph, the graph widens. The slider is custom contained to the left half of the graph.

If the slider element widens the graph, its containment area will appear to shrink.

With this patch, client code can recalculate the containment area during the drag so that the containment area is maintained at half of the total width.


Patch for ui.draggable.js.

        _mouseDrag: function(event, noPropagation) {

            /// PATCH START ///
            var o = this.options;
            //Set a containment if given in the options
            if (o.containment)
                this._setContainment();
            //Recache the helper size
            this._cacheHelperProportions();
            /// PATCH END ///

            //Compute the helpers position
            this.position = this._generatePosition(event);
            this.positionAbs = this._convertPositionTo("absolute");

Attachments (0)
Change History (6)

Changed November 17, 2009 09:46AM UTC by jzaefferer comment:1

milestone: TBD1.8

Changed June 26, 2012 01:22AM UTC by scottgonzalez comment:2

type: enhancementfeature

Changed October 11, 2012 02:49PM UTC by scottgonzalez comment:3

milestone: 1.9.02.0.0

Changed November 04, 2012 05:42PM UTC by jzaefferer comment:4

status: newopen

Need to take this usecase into account for 2.0.0, not necessarily the solution.

Changed November 04, 2012 07:04PM UTC by scottgonzalez comment:5

This should be handled by refresh().

Changed March 01, 2013 01:16PM UTC by scottgonzalez comment:6

resolution: → duplicate
status: openclosed

Duplicate of #4911.We're not going to implement this as requested, but rather as part of the upcoming refresh() method. Therefore, I'm closing as s duplicate.