From 48e43f1a988c13c8b8dde2092654c47e9c66be91 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 10 Nov 2020 15:46:37 -0500 Subject: [PATCH] add ability to provide custom preview colorizer --- src/mode/fdm/prepare.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 28e4cb9d..d009d9a4 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -413,10 +413,16 @@ let lastOut = null; let current = null; - function color(point) { + function colorDefault(point) { return hsv2rgb({h:point.speed / maxspd, s:1, v:0.75}, true); } + function colorCustom(point) { + return FDM.rateToColor(point.speed, maxspd); + } + + const color = FDM.rateToColor ? colorCustom : colorDefault; + levels.forEach((level, index) => { const prints = {}; const moves = [];