From e10f43849a40dcd361d8920707fc8937c2ff3d5f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 20 Jul 2024 22:29:46 +0200 Subject: [PATCH] fix(control): check set actionButton before display it Signed-off-by: Stefan Dej --- .../panels/ToolheadControls/CircleControl.vue | 11 ++++++++++- .../panels/ToolheadControls/CrossControl.vue | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/panels/ToolheadControls/CircleControl.vue b/src/components/panels/ToolheadControls/CircleControl.vue index 265e8155f..7888662e2 100644 --- a/src/components/panels/ToolheadControls/CircleControl.vue +++ b/src/components/panels/ToolheadControls/CircleControl.vue @@ -583,7 +583,16 @@ export default class CircleControl extends Mixins(BaseMixin, ControlMixin) { '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 + const button = this.$store.state.gui.control.actionButton ?? this.defaultActionButton + + if (button === 'qgl' && !this.$store.getters['printer/existsQGL']) { + return this.defaultActionButton + } + if (button === 'ztilt' && !this.$store.getters['printer/existsZTilt']) { + return this.defaultActionButton + } + + return button } get enableXYHoming(): boolean { diff --git a/src/components/panels/ToolheadControls/CrossControl.vue b/src/components/panels/ToolheadControls/CrossControl.vue index f462a5403..0cee656d2 100644 --- a/src/components/panels/ToolheadControls/CrossControl.vue +++ b/src/components/panels/ToolheadControls/CrossControl.vue @@ -377,7 +377,16 @@ export default class CrossControl extends Mixins(BaseMixin, ControlMixin) { mdiHome = mdiHome get actionButton(): string { - return this.$store.state.gui.control.actionButton ?? this.defaultActionButton + const button = this.$store.state.gui.control.actionButton ?? this.defaultActionButton + + if (button === 'qgl' && !this.$store.getters['printer/existsQGL']) { + return this.defaultActionButton + } + if (button === 'ztilt' && !this.$store.getters['printer/existsZTilt']) { + return this.defaultActionButton + } + + return button } /**