Fix canvas size for reruns.

This commit is contained in:
Sebastian Serth
2020-02-13 09:43:35 +01:00
parent 8ecf1d48b7
commit 8c1fd66b92

View File

@ -76,7 +76,7 @@ Turtle.prototype.update = function () {
canvas.style.width = `${this.get_width()}px`; canvas.style.width = `${this.get_width()}px`;
canvas.style.height = `${this.get_height()}px`; canvas.style.height = `${this.get_height()}px`;
ctx = canvas.getContext('2d'); ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, this.width, this.width);
ctx.scale(devicePixelRatio, devicePixelRatio); ctx.scale(devicePixelRatio, devicePixelRatio);
length = this.items.length; length = this.items.length;
dx = canvas.width / (2 * devicePixelRatio); dx = canvas.width / (2 * devicePixelRatio);