@@ -56,7 +56,10 @@ return $.widget("ui.selectable", $.ui.mouse, {
56
56
selectees . addClass ( "ui-selectee" ) ;
57
57
selectees . each ( function ( ) {
58
58
var $this = $ ( this ) ,
59
+ context = $ ( that . options . appendTo ) ,
59
60
pos = $this . offset ( ) ;
61
+ pos . top += context . scrollTop ( ) ;
62
+ pos . left += context . scrollLeft ( ) ;
60
63
$ . data ( this , "selectable-item" , {
61
64
element : this ,
62
65
$element : $this ,
@@ -91,9 +94,12 @@ return $.widget("ui.selectable", $.ui.mouse, {
91
94
92
95
_mouseStart : function ( event ) {
93
96
var that = this ,
94
- options = this . options ;
97
+ options = this . options ,
98
+ context = $ ( options . appendTo ) ,
99
+ scrollLeft = context . scrollLeft ( ) ,
100
+ scrollTop = context . scrollTop ( ) ;
95
101
96
- this . opos = [ event . pageX , event . pageY ] ;
102
+ this . opos = [ scrollLeft + event . pageX , scrollTop + event . pageY ] ;
97
103
98
104
if ( this . options . disabled ) {
99
105
return ;
@@ -106,8 +112,8 @@ return $.widget("ui.selectable", $.ui.mouse, {
106
112
$ ( options . appendTo ) . append ( this . helper ) ;
107
113
// position helper (lasso)
108
114
this . helper . css ( {
109
- "left" : event . pageX ,
110
- "top" : event . pageY ,
115
+ "left" : scrollLeft + event . pageX ,
116
+ "top" : scrollTop + event . pageY ,
111
117
"width" : 0 ,
112
118
"height" : 0
113
119
} ) ;
@@ -169,10 +175,11 @@ return $.widget("ui.selectable", $.ui.mouse, {
169
175
var tmp ,
170
176
that = this ,
171
177
options = this . options ,
178
+ context = $ ( options . appendTo ) ,
172
179
x1 = this . opos [ 0 ] ,
173
180
y1 = this . opos [ 1 ] ,
174
- x2 = event . pageX ,
175
- y2 = event . pageY ;
181
+ x2 = event . pageX + context . scrollLeft ( ) ,
182
+ y2 = event . pageY + context . scrollTop ( ) ;
176
183
177
184
if ( x1 > x2 ) { tmp = x2 ; x2 = x1 ; x1 = tmp ; }
178
185
if ( y1 > y2 ) { tmp = y2 ; y2 = y1 ; y1 = tmp ; }
0 commit comments