diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts index 8e4c6834e..0e669f1a4 100644 --- a/src/components/mixins/control.ts +++ b/src/components/mixins/control.ts @@ -1,5 +1,6 @@ import Vue from 'vue' import Component from 'vue-class-component' +import { PrinterStateMacro, PrinterStateToolchangeMacro } from '@/store/printer/types' @Component export default class ControlMixin extends Vue { @@ -83,6 +84,21 @@ export default class ControlMixin extends Vue { return this.homedAxes.includes('z') } + get macros() { + return this.$store.getters['printer/getMacros'] + } + + get toolchangeMacros(): PrinterStateToolchangeMacro[] { + return this.macros + .filter((macro: PrinterStateMacro) => macro.name.toUpperCase().match(/^T\d+/)) + .sort((a: PrinterStateMacro, b: PrinterStateMacro) => { + const numberA = parseInt(a.name.slice(1)) + const numberB = parseInt(b.name.slice(1)) + + return numberA - numberB + }) + } + doHome() { this.$store.dispatch('server/addEvent', { message: 'G28', type: 'command' }) this.$socket.emit('printer.gcode.script', { script: 'G28' }, { loading: 'homeAll' }) diff --git a/src/components/panels/Extruder/EstimatedExtrusionOutput.vue b/src/components/panels/Extruder/EstimatedExtrusionOutput.vue index 251cf1f23..6d252ed84 100644 --- a/src/components/panels/Extruder/EstimatedExtrusionOutput.vue +++ b/src/components/panels/Extruder/EstimatedExtrusionOutput.vue @@ -1,5 +1,5 @@ diff --git a/src/components/panels/Extruder/ExtruderControlPanelTools.vue b/src/components/panels/Extruder/ExtruderControlPanelTools.vue index 740d1f8a8..5248d26f8 100644 --- a/src/components/panels/Extruder/ExtruderControlPanelTools.vue +++ b/src/components/panels/Extruder/ExtruderControlPanelTools.vue @@ -1,5 +1,5 @@