From 508889409bec406583a7d6cb65ce8b8d3a20f11a Mon Sep 17 00:00:00 2001 From: matbgn Date: Fri, 24 Jun 2022 18:28:19 +0200 Subject: [PATCH] Fix rect rendering on move --- src/js/whiteboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js index 0ab9fd8..7395830 100644 --- a/src/js/whiteboard.js +++ b/src/js/whiteboard.js @@ -775,10 +775,10 @@ const whiteboard = { }, drawRec: function (fromX, fromY, toX, toY, color, thickness, remote) { var _this = this; - toX = toX - fromX; - toY = toY - fromY; let xOffset = remote ? _this.viewCoords.x : 0; let yOffset = remote ? _this.viewCoords.y : 0; + toX = toX - fromX - xOffset; + toY = toY - fromY - yOffset; _this.ctx.beginPath(); _this.ctx.rect(fromX + xOffset, fromY + yOffset, toX + xOffset, toY + yOffset); _this.ctx.strokeStyle = color;