From 45759b9e90b83095f03f238dcdb966ca18feffb8 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 11 Jun 2022 18:55:50 +0200 Subject: [PATCH] fix remote draw --- src/js/whiteboard.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js index 12e6fd7..e3797cc 100644 --- a/src/js/whiteboard.js +++ b/src/js/whiteboard.js @@ -675,9 +675,19 @@ const whiteboard = { _this.penSmoothLastCoords.push(X, Y); if (_this.penSmoothLastCoords.length >= 8) { _this.drawPenSmoothLine(_this.penSmoothLastCoords, _this.drawcolor, _this.thickness); + let sendArray = []; + for (let i = 0; i < _this.penSmoothLastCoords.length; i++) { + sendArray.push(_this.penSmoothLastCoords[i]); + console.log(sendArray); + if (i % 2 == 0) { + sendArray[i] -= this.viewCoords.x; + } else { + sendArray[i] -= this.viewCoords.y; + } + } _this.sendFunction({ t: _this.tool, - d: _this.penSmoothLastCoords, + d: sendArray, c: _this.drawcolor, th: _this.thickness, });