Use correct bounds checking on maximum
This commit is contained in:
parent
0b6659729b
commit
2e6e885071
|
@ -56,7 +56,7 @@ export class Painter {
|
|||
|
||||
public set scrollX(scrollX: number) {
|
||||
const min = this.model?.minX;
|
||||
const max = this.model?.maxX;
|
||||
const max = this.model?.maxX != null ? Math.max(0, this.model.maxX - this.width) : null;
|
||||
|
||||
this._scrollX = min != null && scrollX < min ? min : (max != null && scrollX > max ? max : scrollX);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class Painter {
|
|||
|
||||
public set scrollY(scrollY: number) {
|
||||
const min = this.model?.minY;
|
||||
const max = this.model?.maxY;
|
||||
const max = this.model?.maxY != null ? Math.max(0, this.model.maxY - this.height) : null;
|
||||
|
||||
this._scrollY = min != null && scrollY < min ? min : (max != null && scrollY > max ? max : scrollY);
|
||||
}
|
||||
|
@ -142,8 +142,8 @@ export class Painter {
|
|||
this.ctx.save();
|
||||
this.ctx.scale(this.scale, this.scale);
|
||||
this.ctx.translate(0.2, 0.2);
|
||||
this.drawBoundaries();
|
||||
this.drawPrimes();
|
||||
this.drawBoundaries();
|
||||
this.ctx.restore();
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,11 @@ export class Painter {
|
|||
this.ctx.restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the boundaries of the `Model`.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
private drawBoundaries(): void {
|
||||
this.ctx.save();
|
||||
this.ctx.beginPath();
|
||||
|
|
Loading…
Reference in New Issue