From 9ab23e56f665188fa816ddd20b852040f0157b4f Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Sat, 7 May 2016 23:31:06 +0200 Subject: [PATCH] use deconstruction in move --- src/gcode.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/gcode.js b/src/gcode.js index f21c4e6..9c50d3d 100644 --- a/src/gcode.js +++ b/src/gcode.js @@ -68,8 +68,10 @@ export default class { } moveTo (x, y, layer) { - const layerHeight = this.settings.config['layerHeight']; - const travelSpeed = this.settings.config['travelSpeed']; + const { + layerHeight, + travelSpeed + } = this.settings; const z = (layer + 1) * layerHeight; const speed = travelSpeed * 60; @@ -90,15 +92,21 @@ export default class { lineTo (x, y, layer, type) { const newNozzlePosition = new THREE.Vector2(x, y); - const layerHeight = this.settings.config['layerHeight']; - const nozzleDiameter = this.settings.config['nozzleDiameter']; - const filamentThickness = this.settings.config['filamentThickness']; - const travelSpeed = this.settings.config['travelSpeed']; + const { + layerHeight, + nozzleDiameter, + filamentThickness, + travelSpeed + } = this.settings; const profile = this.settings.config[(this.bottom ? 'bottom' : type)]; - const speed = profile['speed'] * 60; - const flowRate = profile['flowRate']; + let { + speed, + flowRate + } = profile; + + speed *= 60; const z = (layer + 1) * layerHeight; const lineLength = this._nozzlePosition.distanceTo(newNozzlePosition);