Fix error when shrinking selection with Numpad Subtract

Fixes #278
main
Isaiah Odhner 2022-02-24 17:49:26 -05:00
parent 4a9163fb6d
commit ce8b7664e2
1 changed files with 3 additions and 1 deletions

View File

@ -273,7 +273,9 @@ class OnCanvasSelection extends OnCanvasObject {
this.replace_source_canvas(new_source_canvas);
}
scale(factor) {
const new_source_canvas = make_canvas(this.width * factor, this.height * factor);
const new_width = Math.max(1, this.width * factor);
const new_height = Math.max(1, this.height * factor);
const new_source_canvas = make_canvas(new_width, new_height);
new_source_canvas.ctx.drawImage(this.source_canvas, 0, 0, new_source_canvas.width, new_source_canvas.height);
this.replace_source_canvas(new_source_canvas);
}