From 34e935bd0b94b9c46007192e52bcfe715eefb87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 22 Mar 2022 17:09:21 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20GCV:=20Moves=20may=20be=20arcs?= =?UTF-8?q?=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4471 --- .../plugins/gcodeviewer/static/js/viewer/renderer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/viewer/renderer.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/renderer.js index f09c5d360..317e33da1 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/viewer/renderer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/viewer/renderer.js @@ -1042,7 +1042,14 @@ GCODE.renderer = (function () { if (renderOptions["showMoves"] && !isNotCurrentLayer) { // move => draw line from (prevX, prevY) to (x, y) in move color ctx.lineWidth = lineWidthFactor; - ctx.lineTo(x, y); + + if (cmd.direction !== undefined && cmd.direction !== 0) { + var arc = getArcParams(cmd); + var ccw = cmd.direction < 0; // Y-axis is inverted so direction is also inverted + ctx.arc(arc.x, arc.y, arc.r, arc.startAngle, arc.endAngle, ccw); + } else { + ctx.lineTo(x, y); + } } } else if (cmd.extrude) { if (cmd.retract == 0) {