From 553f8ce28f7c551c9183f1e473f36997703cfde7 Mon Sep 17 00:00:00 2001 From: David Rifkind Date: Mon, 30 Dec 2019 20:01:13 -0700 Subject: [PATCH] Show retracts, moves, and head position only for current layer --- src/octoprint/static/gcodeviewer/js/renderer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/octoprint/static/gcodeviewer/js/renderer.js b/src/octoprint/static/gcodeviewer/js/renderer.js index f93db508d..f4e480e1b 100644 --- a/src/octoprint/static/gcodeviewer/js/renderer.js +++ b/src/octoprint/static/gcodeviewer/js/renderer.js @@ -680,7 +680,7 @@ GCODE.renderer = (function(){ // neither extrusion nor move if (cmd.retract == -1) { // retract => draw dot if configured to do so - if (renderOptions["showRetracts"]) { + if (renderOptions["showRetracts"] && !isNotCurrentLayer) { strokePathIfNeeded("fill"); ctx.fillStyle = getColorRetractForTool(tool); ctx.strokeStyle = ctx.fillStyle; @@ -689,7 +689,7 @@ GCODE.renderer = (function(){ } strokePathIfNeeded("move", getColorMoveForTool(tool)); - if(renderOptions["showMoves"]){ + if(renderOptions["showMoves"] && !isNotCurrentLayer) { // move => draw line from (prevX, prevY) to (x, y) in move color ctx.lineWidth = lineWidthFactor; ctx.lineTo(x,y); @@ -713,7 +713,7 @@ GCODE.renderer = (function(){ } } else { // we were previously retracting, now we are restarting => draw dot if configured to do so - if (renderOptions["showRetracts"]) { + if (renderOptions["showRetracts"] && !isNotCurrentLayer) { strokePathIfNeeded("fill"); ctx.fillStyle = getColorRestartForTool(tool); ctx.strokeStyle = ctx.fillStyle; @@ -731,7 +731,7 @@ GCODE.renderer = (function(){ ctx.stroke(); } - if (renderOptions["showHead"]) { + if (renderOptions["showHead"] && !isNotCurrentLayer) { var sizeHeadSpot = renderOptions["sizeHeadSpot"] * lineWidthFactor + lineWidthFactor / 2; var shade = tool * 0.15; ctx.fillStyle = pusher.color(renderOptions["colorHead"]).shade(shade).alpha(alpha).html();