Skip to main content

Search and Top Navigation

#2059 closed bug (fixed)

Opened December 16, 2007 05:52PM UTC

Closed December 27, 2007 01:27PM UTC

Last modified February 26, 2009 11:21AM UTC

ui.mouse: accounting for parent scrollLeft/scrollTop

Reported by: Max_B Owned by: paul
Priority: major Milestone: 1.5
Component: ui.core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:
Description

This report is very close to the #2052. I open a separate because this is not related to fixed parent.

In an absolute div with fixed width and scroll: auto; the draggable inside are not correctly positioned if the div is scrolled. The wrong offset comes is the scrollLeft/scrollTop value.

I fixed it for my use, without further testing of nested blocks with following code:

ui.mouse.js, line 142 of rev 3626

	var cp = a.parentNode;
	while (cp) {
		if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) {
			o.pp = cp;
			o.po = $(cp).offset();
			o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO!
			//Max_B
			if (o.ppOverflow) {
				o.po.left -= cp.scrollLeft;
				o.po.top -= cp.scrollTop;
			}
			//Max_B
			break;	
		}
		cp = cp.parentNode ? cp.parentNode : null;
	};

Lines added are surrounded by //Max_B comments.

Attachments (0)
Change History (4)

Changed December 27, 2007 01:27PM UTC by paul comment:1

owner: → paul
status: newassigned

This is fixed with my new rewritten version that will be released together with 1.1. Thanks for pointing it out!

Changed December 27, 2007 01:27PM UTC by paul comment:2

resolution: → fixed
status: assignedclosed

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

milestone: 1.2.2

Milestone 1.2.2 deleted

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

milestone: → 1.5