paint-by-numbers

Relaxing paint-by-numbers game  https://p.ce9e.org/paint-by-numbers/
git clone https://git.ce9e.org/paint-by-numbers.git

commit
d510c74aaf1b258c27aca268069bf82054252cf6
parent
7c3673c5fbe04ea2db39c4d2ec5da9d0cfdd87c3
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-15 05:18
restrict dx/dy so frame is always visible

Diffstat

M js/view.js 5 +++++

1 files changed, 5 insertions, 0 deletions


diff --git a/js/view.js b/js/view.js

@@ -56,6 +56,11 @@ export class View {
   56    56     }
   57    57 
   58    58     render() {
   -1    59         this.dx = Math.min(this.dx, this.canvas.width / 2);
   -1    60         this.dy = Math.min(this.dy, this.canvas.height / 2);
   -1    61         this.dx = Math.max(this.dx, this.canvas.width / 2 - this.frame.canvas.width * this.zoom);
   -1    62         this.dy = Math.max(this.dy, this.canvas.height / 2 - this.frame.canvas.height * this.zoom);
   -1    63 
   59    64         this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
   60    65         this.ctx.drawImage(
   61    66             this.frame.canvas,