From 8ba1e45496407265420bff02a6eeceb88591297a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20G=C3=B6ttlicher?= Date: Mon, 29 Apr 2024 17:23:22 +0200 Subject: [PATCH] graph builder: Fix scaling --- localgraphs/src/interaction/renderer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/localgraphs/src/interaction/renderer.ts b/localgraphs/src/interaction/renderer.ts index 9c2dd2e..7b3a001 100644 --- a/localgraphs/src/interaction/renderer.ts +++ b/localgraphs/src/interaction/renderer.ts @@ -134,7 +134,10 @@ export class InteractionController { const width = this.canvas.clientWidth const height = this.canvas.clientHeight - this.ctx.reset() + + this.ctx.save() // do not reset, since the scale has to be preserved + this.ctx.fillStyle = "transparent" + this.ctx.clearRect(0, 0, width, height) const sleepState = this.system.animate({ dt, @@ -145,6 +148,8 @@ export class InteractionController { dragState: this.dragState, }) + this.ctx.restore() + this.previousTimeStamp = timeStamp if (sleepState === "Running") {