Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bbazukun123 committed Mar 10, 2024
1 parent 1a81288 commit 778e9a2
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/ScrollBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,12 @@ export class ScrollBox extends Container
{
this._trackpad.xAxis.value = 0;
}
else if (targetPos < 0 && targetPos + this.listWidth < this.__width)
{
this._trackpad.xAxis.value = this.__width - this.listWidth;
}
else if (targetPos > 0)
{
this._trackpad.xAxis.value = 0;
}
else
{
this._trackpad.xAxis.value = targetPos;
const min = this.__width - this.listWidth;
const max = 0;

this._trackpad.xAxis.value = Math.min(max, Math.max(min, targetPos));
}
}
else if (typeof event.deltaY !== 'undefined')
Expand All @@ -553,17 +548,12 @@ export class ScrollBox extends Container
{
this._trackpad.yAxis.value = 0;
}
else if (targetPos < 0 && targetPos + this.listHeight < this.__height)
{
this._trackpad.yAxis.value = this.__height - this.listHeight;
}
else if (targetPos > 0)
{
this._trackpad.yAxis.value = 0;
}
else
{
this._trackpad.yAxis.value = targetPos;
const min = this.__height - this.listHeight;
const max = 0;

this._trackpad.yAxis.value = Math.min(max, Math.max(min, targetPos));
}
}

Expand Down

0 comments on commit 778e9a2

Please sign in to comment.