Skip to content

Commit

Permalink
add hasMoved to DragEventPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaSh committed Sep 30, 2024
1 parent 504dc16 commit 72771ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/builtin-plugins/DragEventPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class DragEvent {
height: number
distance: number
stopped: boolean
hasMoved: boolean
constructor(
public props: {
view: View
Expand All @@ -37,6 +38,7 @@ export class DragEvent {
stopped: boolean
target: EventTarget | null
directions: Array<Direction>
hasMoved: boolean
}
) {
this.previousX = props.previousX
Expand All @@ -53,6 +55,7 @@ export class DragEvent {
this.stopped = props.stopped
this.target = props.target
this.directions = props.directions
this.hasMoved = props.hasMoved
}
}

Expand Down Expand Up @@ -157,6 +160,7 @@ export class DragEventPlugin extends EventPlugin {
stopped: boolean = false
) {
const logs = this._viewPointerPositionLog.get(view.id)
const hasMoved = !(typeof logs === 'undefined' || logs.length <= 1)
const previousPointer =
logs && logs.length >= 2 ? logs[logs.length - 2] : null
const x = this._pointerX - this._initialPointerPerView.get(view.id)!.x
Expand Down Expand Up @@ -197,7 +201,8 @@ export class DragEventPlugin extends EventPlugin {
height,
isDragging,
directions,
stopped
stopped,
hasMoved
}
this.emit(DragEvent, eventData)
}
Expand Down

0 comments on commit 72771ba

Please sign in to comment.