From 69d286ea707056e5f73abf076284fc1a15022ec4 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 5 Nov 2024 22:52:04 +0100 Subject: [PATCH] fix(control): check set actionButton before display it (#1953) --- src/components/mixins/control.ts | 13 +++++++++++++ .../panels/ToolheadControls/CircleControl.vue | 4 ---- .../panels/ToolheadControls/CrossControl.vue | 4 ---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts index 95db9e2ea..e8a2b2df7 100644 --- a/src/components/mixins/control.ts +++ b/src/components/mixins/control.ts @@ -64,6 +64,19 @@ export default class ControlMixin extends Vue { return this.$store.getters['gui/getDefaultControlActionButton'] } + get actionButton(): string { + const button = this.$store.state.gui.control.actionButton ?? this.defaultActionButton + + if ( + (button === 'qgl' && !this.$store.getters['printer/existsQGL']) || + (button === 'ztilt' && !this.$store.getters['printer/existsZTilt']) + ) { + return this.defaultActionButton + } + + return button + } + /** * Axes home states */ diff --git a/src/components/panels/ToolheadControls/CircleControl.vue b/src/components/panels/ToolheadControls/CircleControl.vue index 265e8155f..b3a5c5cc4 100644 --- a/src/components/panels/ToolheadControls/CircleControl.vue +++ b/src/components/panels/ToolheadControls/CircleControl.vue @@ -582,10 +582,6 @@ export default class CircleControl extends Mixins(BaseMixin, ControlMixin) { engineOffIcon = 'M3.78 2.5L21.5 20.22l-1.27 1.28L18 19.27V20h-8l-2-2H5v-3H3v3H1v-8h2v3h2v-3l1.87-1.86L2.5 3.77L3.78 2.5M20 9v3h-2V8h-6V6h3V4H7.82l15 15H23V9h-3Z' - get actionButton(): string { - return this.$store.state.gui.control.actionButton ?? this.defaultActionButton - } - get enableXYHoming(): boolean { return this.$store.state.gui.control.enableXYHoming } diff --git a/src/components/panels/ToolheadControls/CrossControl.vue b/src/components/panels/ToolheadControls/CrossControl.vue index f462a5403..d8b000066 100644 --- a/src/components/panels/ToolheadControls/CrossControl.vue +++ b/src/components/panels/ToolheadControls/CrossControl.vue @@ -376,10 +376,6 @@ export default class CrossControl extends Mixins(BaseMixin, ControlMixin) { mdiEngineOff = mdiEngineOff mdiHome = mdiHome - get actionButton(): string { - return this.$store.state.gui.control.actionButton ?? this.defaultActionButton - } - /** * Step size selection */