Make sure we always have color to draw lines with

This commit is contained in:
Gina Häußge 2014-01-06 15:16:15 +01:00
parent 260a378e8c
commit ae06af9bc5

View file

@ -288,8 +288,14 @@ GCODE.renderer = (function(){
y = -cmds[i].y;
}
var tool = cmds[i].tool;
if (tool === undefined) tool = 0;
var lineColor = renderOptions["colorLine"][tool];
if (lineColor === undefined) lineColor = renderOptions["colorLine"][0];
var alpha = (renderOptions['showNextLayer'] || renderOptions['showPreviousLayer']) && isNotCurrentLayer ? 0.3 : 1.0;
var shade = cmds[i].tool * 0.15;
var shade = tool * 0.15;
if (!cmds[i].extrude && !cmds[i].noMove) {
if (cmds[i].retract == -1) {
if (renderOptions["showRetracts"]) {
@ -310,7 +316,7 @@ GCODE.renderer = (function(){
}
} else if(cmds[i].extrude) {
if (cmds[i].retract == 0) {
ctx.strokeStyle = pusher.color(renderOptions["colorLine"][cmds[i].tool]).shade(shade).alpha(alpha).html();
ctx.strokeStyle = pusher.color(renderOptions["colorLine"][tool]).shade(shade).alpha(alpha).html();
ctx.lineWidth = renderOptions['extrusionWidth'];
ctx.beginPath();
ctx.moveTo(prevX, prevY);