Skip to main content

Search and Top Navigation

#8915 closed bug (fixed)

Opened December 17, 2012 12:04PM UTC

Closed January 01, 2013 01:23PM UTC

Last modified January 31, 2013 02:53PM UTC

Selectable: lasso offset issue with scrolling

Reported by: KopiasCsaba Owned by:
Priority: minor Milestone: 1.10.0
Component: ui.selectable Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:
Description

I saw #4377, it's similar, but not the same.

This bug is there without the appendTo problem.

Test case:

What you get: A little 1x1 point over and to the left of the mouse, which is the lasso, before the resizeing.

The problem is, that it is initialized like this:

		// position helper (lasso)
		this.helper.css({
			"left": event.clientX,
			"top": event.clientY,
			"width": 0,
			"height": 0
		});

But according to W3 and maybe the more clearly sentenced Mozilla MSDN:

"For example, clicking in the top-left corner of the client area will always result in a mouse event with a clientX value of 0, regardless of whether the page is scrolled horizontally."

Solution:

So we need the scrolling offset added to it.

Workaround (one can use this before the official solution, put this before your selectable() initialization):

        $.widget("ui.selectable", $.ui.selectable, {
            _mouseStart: function(event) {
                
                this._super(event);
    
                this.helper.css({
                    "left": event.clientX + $(window).scrollLeft(),
                    "top": event.clientY + $(window).scrollTop()
                });
            }
        });
Attachments (0)
Change History (5)

Changed December 17, 2012 12:09PM UTC by KopiasCsaba comment:1

Changed December 17, 2012 01:18PM UTC by tj.vantoll comment:2

status: newopen
summary: Selectable lasso offsetSelectable: lasso offset issue with scrolling

Changed December 30, 2012 03:00AM UTC by tj.vantoll comment:3

Changed January 01, 2013 01:23PM UTC by TJ VanToll comment:4

resolution: → fixed
status: openclosed

Selectable: Account for scrolling on the helper's initial position. Fixed #8915 - Selectable: Lasso offset issue with scrolling.

Changeset: 695358983e58c9f3d0c6b755ce89fa92adbea0ea

Changed January 31, 2013 02:53PM UTC by KopiasCsaba comment:5

Thank you very much!