@@ -147,8 +147,8 @@ export function useDraggable(
147
147
const containerRect = container ?. getBoundingClientRect ?.( )
148
148
const targetRect = toValue ( target ) ! . getBoundingClientRect ( )
149
149
const pos = {
150
- x : e . clientX - ( container ? targetRect . left - containerRect ! . left : targetRect . left ) ,
151
- y : e . clientY - ( container ? targetRect . top - containerRect ! . top : targetRect . top ) ,
150
+ x : e . clientX - ( container ? targetRect . left - containerRect ! . left + container . scrollLeft : targetRect . left ) ,
151
+ y : e . clientY - ( container ? targetRect . top - containerRect ! . top + container . scrollTop : targetRect . top ) ,
152
152
}
153
153
if ( onStart ?.( pos , e ) === false )
154
154
return
@@ -168,12 +168,12 @@ export function useDraggable(
168
168
if ( axis === 'x' || axis === 'both' ) {
169
169
x = e . clientX - pressedDelta . value . x
170
170
if ( container )
171
- x = Math . min ( Math . max ( 0 , x ) , containerRect ! . width - targetRect ! . width )
171
+ x = Math . min ( Math . max ( 0 , x ) , containerRect ! . width + container . scrollLeft - targetRect ! . width )
172
172
}
173
173
if ( axis === 'y' || axis === 'both' ) {
174
174
y = e . clientY - pressedDelta . value . y
175
175
if ( container )
176
- y = Math . min ( Math . max ( 0 , y ) , containerRect ! . height - targetRect ! . height )
176
+ y = Math . min ( Math . max ( 0 , y ) , containerRect ! . height + container . scrollTop - targetRect ! . height )
177
177
}
178
178
position . value = {
179
179
x,
0 commit comments