#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: |
Description
I saw #4377, it's similar, but not the same. This bug is there without the appendTo problem.
Test case:
- Go to: http://jqueryui.com/resources/demos/selectable/display-grid.html (the selectable example page's iframe)
- Resize the window so that you get the scrollbars
- Scroll down and to the right a little
- Click (but don't move the mouse!)
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() }); } });
Change History (5)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Status: | new → open |
---|---|
Summary: | Selectable lasso offset → Selectable: lasso offset issue with scrolling |
comment:4 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Selectable: Account for scrolling on the helper's initial position. Fixed #8915 - Selectable: Lasso offset issue with scrolling.
Changeset: 695358983e58c9f3d0c6b755ce89fa92adbea0ea
The bug in a screenshot: http://s2.postimage.org/9oaov8w61/bug.png