Skip to content

Commit

Permalink
fix: Remove mouse wheel event optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Original-Recipe committed Dec 31, 2024
1 parent 4c0393c commit 86fd69d
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class BasicToolOperation extends EventListener {
this.onKeyDown = this.onKeyDown.bind(this);
this.onKeyUp = this.onKeyUp.bind(this);
this.onWheel = this.onWheel.bind(this);
this.optimizeWheel = this.optimizeWheel.bind(this);
this.onLeftDblClick = this.onLeftDblClick.bind(this);
this.onRightDblClick = this.onRightDblClick.bind(this);
this.onClick = this.onClick.bind(this);
Expand Down Expand Up @@ -869,7 +868,7 @@ class BasicToolOperation extends EventListener {
this.container.addEventListener('mouseleave', this.onMouseLeave);
this.container.addEventListener('click', this.onClick);

this.container.addEventListener('wheel', this.optimizeWheel);
this.container.addEventListener('wheel', this.onWheel);

document.addEventListener('keydown', this.onKeyDown);
document.addEventListener('keyup', this.onKeyUp);
Expand All @@ -881,7 +880,7 @@ class BasicToolOperation extends EventListener {
this.container.removeEventListener('mousemove', this.optimizeMouseMove);
this.container.removeEventListener('mouseup', this.onMouseUp);
this.container.removeEventListener('mouseleave', this.onMouseLeave);
this.container.removeEventListener('wheel', this.optimizeWheel);
this.container.removeEventListener('wheel', this.onWheel);
this.container.removeEventListener('click', this.onClick);
document.removeEventListener('keydown', this.onKeyDown);
document.removeEventListener('keyup', this.onKeyUp);
Expand All @@ -908,8 +907,6 @@ class BasicToolOperation extends EventListener {

private moveAnimationFrameId: number | null = null;

private onWheelAnimationFrameId: number | null = null;

public optimizeMouseMove(event: MouseEvent): boolean | void {
if (this.moveAnimationFrameId) return;

Expand All @@ -919,15 +916,6 @@ class BasicToolOperation extends EventListener {
});
}

public optimizeWheel(event: MouseEvent): boolean | void {
if (this.onWheelAnimationFrameId) return;

this.onWheelAnimationFrameId = requestAnimationFrame(() => {
this.onWheel(event);
this.onWheelAnimationFrameId = null;
});
}

public onMouseDown(e: MouseEvent): void | boolean {
// e.stopPropagation();
if (!this.canvas || this.isImgError) {
Expand Down

0 comments on commit 86fd69d

Please sign in to comment.