use deconstruction in move

This commit is contained in:
casperlamboo 2016-05-07 23:31:06 +02:00 committed by Simon Voordouw
parent aba32d9a21
commit 9ab23e56f6

View File

@ -68,8 +68,10 @@ export default class {
} }
moveTo (x, y, layer) { moveTo (x, y, layer) {
const layerHeight = this.settings.config['layerHeight']; const {
const travelSpeed = this.settings.config['travelSpeed']; layerHeight,
travelSpeed
} = this.settings;
const z = (layer + 1) * layerHeight; const z = (layer + 1) * layerHeight;
const speed = travelSpeed * 60; const speed = travelSpeed * 60;
@ -90,15 +92,21 @@ export default class {
lineTo (x, y, layer, type) { lineTo (x, y, layer, type) {
const newNozzlePosition = new THREE.Vector2(x, y); const newNozzlePosition = new THREE.Vector2(x, y);
const layerHeight = this.settings.config['layerHeight']; const {
const nozzleDiameter = this.settings.config['nozzleDiameter']; layerHeight,
const filamentThickness = this.settings.config['filamentThickness']; nozzleDiameter,
const travelSpeed = this.settings.config['travelSpeed']; filamentThickness,
travelSpeed
} = this.settings;
const profile = this.settings.config[(this.bottom ? 'bottom' : type)]; const profile = this.settings.config[(this.bottom ? 'bottom' : type)];
const speed = profile['speed'] * 60; let {
const flowRate = profile['flowRate']; speed,
flowRate
} = profile;
speed *= 60;
const z = (layer + 1) * layerHeight; const z = (layer + 1) * layerHeight;
const lineLength = this._nozzlePosition.distanceTo(newNozzlePosition); const lineLength = this._nozzlePosition.distanceTo(newNozzlePosition);