Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8915 closed bug (fixed)

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:


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)
			"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) {
                    "left": event.clientX + $(window).scrollLeft(),
                    "top": event.clientY + $(window).scrollTop()

Change History (5)

comment:1 Changed 10 years ago by KopiasCsaba

comment:2 Changed 10 years ago by tj.vantoll

Status: newopen
Summary: Selectable lasso offsetSelectable: lasso offset issue with scrolling

comment:4 Changed 10 years ago by TJ VanToll

Resolution: fixed
Status: openclosed

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

Changeset: 695358983e58c9f3d0c6b755ce89fa92adbea0ea

comment:5 Changed 10 years ago by KopiasCsaba

Thank you very much!

Note: See TracTickets for help on using tickets.