Drag.Move.calculateLimit: options.container within scrollable div content ignoring scroll offset #1010

Closed
urshofer opened this Issue Aug 17, 2011 · 3 comments

Projects

None yet

2 participants

@urshofer

Hi,

I positioned a div with draggable elements within a container of style overflow:auto.
The div with the draggable elements are in the overflow area (need to scroll down to see it)

In this case, the limitations (options.container) are wrongly calculated since the scroll offset
is ignored.

I fixed this issue with the following lines of code at the end of Drag.Move.calculateLimit:

if (element.getOffsetParent()) {
  top += element.getOffsetParent().getScroll().y;
  bottom += element.getOffsetParent().getScroll().y;            
  left += element.getOffsetParent().getScroll().x;
  right += element.getOffsetParent().getScroll().x;         
}
return {
   x: [left, right],
   y: [top, bottom]
};
@urshofer

Same with Sortables inside the overflow area of a div. Possible fix at the end of Sortables.getClone:

var x = element.getPosition(element.getOffsetParent()).x + element.getOffsetParent().getScroll().x;
var y = element.getPosition(element.getOffsetParent()).y + element.getOffsetParent().getScroll().y;
return clone.inject(this.list).setPosition([x,y]);
@arian
Member
arian commented Aug 17, 2011

hi @urshofer, thanks for your fixes. could you create a testcase (on http://jsfiddle.net) so we can quickly examine the problem and see if your fixes work or if we can do it in an even smarter way.

@urshofer

hi arian,

i made it quickly and rough: http://jsfiddle.net/jYavn/

css is included in the html - no beauty queen�!

best,
urs

Am 17.08.2011 um 20:07 schrieb arian:

hi @urshofer, thanks for your fixes. could you create a testcase (on http://jsfiddle.net) so we can quickly examine the problem and see if your fixes work or if we can do it in an even smarter way.

Reply to this email directly or view it on GitHub:
#1010 (comment)

@anutron anutron closed this in #1266 May 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment