Skip to content

Commit 6896094

Browse files
authoredMay 14, 2022
Fix prevent scroll 485 (#492)
1 parent 6b8c74c commit 6896094

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed
 

‎.changeset/bright-parents-exist.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@use-gesture/core': patch
3+
---
4+
5+
fix: preventScroll should resist to multiple fingers drag

‎packages/core/src/EventStore.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export class EventStore {
1818
const type = toDomEventType(device, action)
1919
const eventOptions = { ...this._ctrl.config.shared.eventOptions, ...options }
2020
element.addEventListener(type, handler, eventOptions)
21-
this._listeners.push(() => element.removeEventListener(type, handler, eventOptions))
21+
this._listeners.push(() => {
22+
element.removeEventListener(type, handler, eventOptions)
23+
})
2224
}
2325

2426
clean() {

‎packages/core/src/engines/DragEngine.ts

-2
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,6 @@ export class DragEngine extends CoordinatesEngine<'drag'> {
293293
persistEvent(event)
294294
// we add window listeners that will prevent the scroll when the user has started dragging
295295
this.eventStore.add(this.sharedConfig.window!, 'touch', 'change', this.preventScroll.bind(this), { passive: false })
296-
this.eventStore.add(this.sharedConfig.window!, 'touch', 'end', this.clean.bind(this))
297-
this.eventStore.add(this.sharedConfig.window!, 'touch', 'cancel', this.clean.bind(this))
298296
this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay!, event)
299297
}
300298

0 commit comments

Comments
 (0)
Please sign in to comment.