From 276f7cd3cb1f11caba6b5f1cbfc0f7e0b433dba7 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Tue, 10 Jan 2023 11:50:00 +0000 Subject: [PATCH] feat: adds new Screws Tilt Adjust helper dialog Signed-off-by: Pedro Lamas --- components.d.ts | 1 + .../common/BedScrewsAdjustDialog.vue | 14 +-- .../common/ScrewsTiltAdjustDialog.vue | 110 ++++++++++++++++++ src/components/settings/ToolheadSettings.vue | 25 ++++ .../widgets/bedmesh/BedMeshControls.vue | 2 +- .../widgets/toolhead/ToolheadCard.vue | 38 +++++- src/globals.ts | 8 +- src/locales/en.yaml | 5 + src/mixins/toolhead.ts | 4 + src/store/config/state.ts | 1 + src/store/config/types.ts | 1 + src/store/printer/actions.ts | 3 + src/store/printer/getters.ts | 68 +++++++++-- src/store/printer/mutations.ts | 4 + src/store/printer/state.ts | 1 + src/store/printer/types.ts | 27 +++++ 16 files changed, 288 insertions(+), 24 deletions(-) create mode 100644 src/components/common/ScrewsTiltAdjustDialog.vue diff --git a/components.d.ts b/components.d.ts index 0005c39471..d153981e3e 100644 --- a/components.d.ts +++ b/components.d.ts @@ -55,6 +55,7 @@ declare module 'vue' { RolloverLogsDialog: typeof import('./src/components/common/RolloverLogsDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + ScrewsTiltAdjustDialog: typeof import('./src/components/common/ScrewsTiltAdjustDialog.vue')['default'] SocketDisconnected: typeof import('./src/components/common/SocketDisconnected.vue')['default'] SystemCommands: typeof import('./src/components/common/SystemCommands.vue')['default'] SystemControl: typeof import('./src/components/common/SystemControl.vue')['default'] diff --git a/src/components/common/BedScrewsAdjustDialog.vue b/src/components/common/BedScrewsAdjustDialog.vue index aa7dace41d..f41967bf9a 100644 --- a/src/components/common/BedScrewsAdjustDialog.vue +++ b/src/components/common/BedScrewsAdjustDialog.vue @@ -91,15 +91,15 @@ import { Component, Mixins, VModel, Watch } from 'vue-property-decorator' import StateMixin from '@/mixins/state' import ToolheadMixin from '@/mixins/toolhead' -import { startCase } from 'lodash-es' +import type { BedScrews } from '@/store/printer/types' @Component({}) export default class BedScrewsAdjustDialog extends Mixins(StateMixin, ToolheadMixin) { @VModel({ type: Boolean, default: false }) open!: boolean - get bedScrews () { - return this.$store.getters['printer/getBedScrews'] + get bedScrews (): BedScrews[] { + return this.$store.getters['printer/getBedScrews'] as BedScrews[] } get bedScrewsAdjust () { @@ -115,13 +115,7 @@ export default class BedScrewsAdjustDialog extends Mixins(StateMixin, ToolheadMi } get currentScrewName () { - return startCase(this.bedScrews[this.currentScrewIndex].name || this.$t('app.general.label.screw_number', { index: this.currentScrewIndex + 1 })) - } - - get currentScrewPosition () { - const [x, y] = this.bedScrews[this.currentScrewIndex][this.currentState] - - return `${x}, ${y}` + return this.bedScrews[this.currentScrewIndex].prettyName } get acceptedScrews () { diff --git a/src/components/common/ScrewsTiltAdjustDialog.vue b/src/components/common/ScrewsTiltAdjustDialog.vue new file mode 100644 index 0000000000..cd461b4943 --- /dev/null +++ b/src/components/common/ScrewsTiltAdjustDialog.vue @@ -0,0 +1,110 @@ + + + diff --git a/src/components/settings/ToolheadSettings.vue b/src/components/settings/ToolheadSettings.vue index 65f0986f77..8aece56160 100644 --- a/src/components/settings/ToolheadSettings.vue +++ b/src/components/settings/ToolheadSettings.vue @@ -281,6 +281,19 @@ + + + + + +