From 9e9cb465ba47a34dff7fbb2ce1e3c273f71b9c84 Mon Sep 17 00:00:00 2001 From: Sophia Beluli Date: Fri, 1 Mar 2024 17:30:30 -0500 Subject: [PATCH] [MI-1390] fix job line color on finish --- src/app/widgets/Visualizer/GCodeVisualizer.js | 4 ++-- src/app/widgets/Visualizer/Visualizer.jsx | 9 +++++---- src/app/workers/colors.response.js | 3 +-- src/app/workers/colors.worker.js | 3 ++- src/package.json | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/widgets/Visualizer/GCodeVisualizer.js b/src/app/widgets/Visualizer/GCodeVisualizer.js index bdf2812fd..2b5f51028 100644 --- a/src/app/widgets/Visualizer/GCodeVisualizer.js +++ b/src/app/widgets/Visualizer/GCodeVisualizer.js @@ -44,13 +44,13 @@ class GCodeVisualizer { return this; } - render({ vertices, frames, spindleSpeeds, isLaser = false, spindleChanges }, colorArray) { + render({ vertices, frames, spindleSpeeds, isLaser = false, spindleChanges }, colorArray, savedColors) { this.vertices = new THREE.Float32BufferAttribute(vertices, 3); this.frames = frames; this.spindleSpeeds = spindleSpeeds; this.isLaser = isLaser; this.spindleChanges = spindleChanges; - this.colors = colorArray; + this.colors = savedColors; const defaultColor = new THREE.Color(this.theme.get(CUTTING_PART)); this.countdown = 16; this.frameDifferences = Array(16).fill(null); diff --git a/src/app/widgets/Visualizer/Visualizer.jsx b/src/app/widgets/Visualizer/Visualizer.jsx index 8cba8c660..215968c70 100644 --- a/src/app/widgets/Visualizer/Visualizer.jsx +++ b/src/app/widgets/Visualizer/Visualizer.jsx @@ -826,8 +826,9 @@ class Visualizer extends Component { pubsub.subscribe('visualizer:updateposition', (_, data) => { this.updateCuttingToolPosition(data, { forceUpdateAllAxes: true }); }), - pubsub.subscribe('colors:load', (_, colorArray) => { - this.handleSceneRender(this.vizualization, colorArray, this.renderCallback); + pubsub.subscribe('colors:load', (_, data) => { + const { colorArray, savedColors } = data; + this.handleSceneRender(this.vizualization, colorArray, savedColors, this.renderCallback); }) ]; this.pubsubTokens = this.pubsubTokens.concat(tokens); @@ -1671,7 +1672,7 @@ class Visualizer extends Component { this.updateScene(); } - handleSceneRender(vizualization, colorArray, callback) { + handleSceneRender(vizualization, colorArray, savedColors, callback) { const { controllerType, fileType, workPosition } = this.props; const workspaceMode = store.get('workspace.mode', WORKSPACE_MODE.DEFAULT); @@ -1681,7 +1682,7 @@ class Visualizer extends Component { return; } - const obj = this.visualizer.render(vizualization, colorArray); + const obj = this.visualizer.render(vizualization, colorArray, savedColors); obj.name = ''; this.group.add(obj); diff --git a/src/app/workers/colors.response.js b/src/app/workers/colors.response.js index 138fd8572..6ee926716 100644 --- a/src/app/workers/colors.response.js +++ b/src/app/workers/colors.response.js @@ -1,7 +1,6 @@ import pubsub from 'pubsub-js'; export const colorsResponse = ({ data }) => { - const { colorArray } = data; // Handle file load - pubsub.publish('colors:load', colorArray); + pubsub.publish('colors:load', data); }; diff --git a/src/app/workers/colors.worker.js b/src/app/workers/colors.worker.js index 143ddbad6..d429883a2 100644 --- a/src/app/workers/colors.worker.js +++ b/src/app/workers/colors.worker.js @@ -81,7 +81,8 @@ onmessage = function({ data }) { const colorArray = getColorTypedArray(colors, motionColor); const message = { - colorArray: colorArray + colorArray: colorArray, + savedColors: savedColors }; postMessage(message); diff --git a/src/package.json b/src/package.json index 5f612e399..e45afb7dc 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "gSender", - "version": "1.4.4", + "version": "1.4.4-RC1", "productName": "gSender", "description": "CNC Milling Controller", "author": {