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:
- 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() }); } });
Attachments (0)
Change History (5)
Changed December 17, 2012 12:09PM UTC by comment:1
Changed December 17, 2012 01:18PM UTC by comment:2
status: | new → open |
---|---|
summary: | Selectable lasso offset → Selectable: lasso offset issue with scrolling |
Changed December 30, 2012 03:00AM UTC by comment:3
Pull request - https://github.com/jquery/jquery-ui/pull/871.
Changed January 01, 2013 01:23PM UTC by comment:4
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
Changed January 31, 2013 02:53PM UTC by comment:5
Thank you very much!
The bug in a screenshot: http://s2.postimage.org/9oaov8w61/bug.png