Skip to content

Commit

Permalink
update DragEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
leaferjs committed Nov 3, 2024
1 parent 798d704 commit a50feb6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/event/src/DragEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { registerUIEvent, LeafList, BoundsHelper } from '@leafer/core'
import { PointerEvent } from './PointerEvent'


const move = {} as IPointData
const tempMove = {} as IPointData

@registerUIEvent()
export class DragEvent extends PointerEvent implements IDragEvent {
Expand Down Expand Up @@ -72,19 +72,19 @@ export class DragEvent extends PointerEvent implements IDragEvent {

public getPageMove(total?: boolean): IPointData {
this.assignMove(total)
return this.current.getPagePoint(move, null, true)
return this.current.getPagePoint(tempMove, null, true)
}

public getInnerMove(relative?: ILeaf, total?: boolean): IPointData {
if (!relative) relative = this.current
this.assignMove(total)
return relative.getInnerPoint(move, null, true)
return relative.getInnerPoint(tempMove, null, true)
}

public getLocalMove(relative?: ILeaf, total?: boolean): IPointData {
if (!relative) relative = this.current
this.assignMove(total)
return relative.getLocalPoint(move, null, true)
return relative.getLocalPoint(tempMove, null, true)
}

public getPageTotal(): IPointData {
Expand All @@ -109,8 +109,8 @@ export class DragEvent extends PointerEvent implements IDragEvent {
}

protected assignMove(total: boolean): void {
move.x = total ? this.totalX : this.moveX
move.y = total ? this.totalY : this.moveY
tempMove.x = total ? this.totalX : this.moveX
tempMove.y = total ? this.totalY : this.moveY
}

}
Expand Down

0 comments on commit a50feb6

Please sign in to comment.