Skip to content

Commit

Permalink
feat: show current bed mesh profile name in toolhead panel (#1000)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Willner th33xitus@gmail.com
  • Loading branch information
dw-0 authored Aug 6, 2022
1 parent 4c9aab5 commit 2eb3400
Showing 1 changed file with 43 additions and 9 deletions.
52 changes: 43 additions & 9 deletions src/components/panels/ToolheadControls/MoveToControl.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
<template>
<responsive
:breakpoints="{
small: (el) => el.width <= 320,
xsmall: (el) => el.width <= 320,
small: (el) => el.width > 320 && el.width <= 460,
medium: (el) => el.width > 460 && el.width <= 560,
large: (el) => el.width > 560,
}">
<template #default="{ el }">
<v-container class="py-0">
<v-row>
<v-col class="v-subheader text--secondary pr-0">
<v-icon small class="mr-2">
<v-row class="flex-nowrap pb-1">
<v-col
:class="{
'col-5': el.is.small,
'col-4': el.is.xsmall || el.is.medium,
'col-3': el.is.large,
}"
class="v-subheader text--secondary mr-2">
<v-icon small class="mr-1">
{{ mdiCrosshairsGps }}
</v-icon>
<span>{{ $t('Panels.ToolheadControlPanel.Position') }}: {{ displayPositionAbsolute }}</span>
<span v-if="!el.is.xsmall" class="text-no-wrap">
{{ $t('Panels.ToolheadControlPanel.Position') }}:&nbsp;
</span>
<span class="text-no-wrap">{{ displayPositionAbsolute }}</span>
</v-col>
<v-col
v-if="currentProfileName"
class="v-subheader text--secondary pl-2 justify-end text-no-wrap text-truncate">
<v-icon small class="mr-1">
{{ mdiGrid }}
</v-icon>
<span class="text-no-wrap text-truncate">
{{ currentProfileName }}
</span>
</v-col>
</v-row>
<v-row dense>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<v-col :class="el.is.xsmall ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.x.pos"
:label="livePositions.x"
Expand All @@ -28,7 +50,7 @@
@validate="validate"
@submit="sendCmd"></move-to-input>
</v-col>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<v-col :class="el.is.xsmall ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.y.pos"
:label="livePositions.y"
Expand All @@ -42,7 +64,7 @@
@validate="validate"
@submit="sendCmd"></move-to-input>
</v-col>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<v-col :class="el.is.xsmall ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.z.pos"
:label="livePositions.z"
Expand All @@ -68,13 +90,14 @@ import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
import MoveToInput from '@/components/inputs/MoveToInput.vue'
import Responsive from '@/components/ui/Responsive.vue'
import { mdiCrosshairsGps } from '@mdi/js'
import { mdiCrosshairsGps, mdiGrid } from '@mdi/js'
@Component({
components: { MoveToInput, Responsive },
})
export default class MoveToControl extends Mixins(BaseMixin, ControlMixin) {
mdiCrosshairsGps = mdiCrosshairsGps
mdiGrid = mdiGrid
input: { [index: string]: any } = {
x: { pos: '', valid: true },
Expand Down Expand Up @@ -159,6 +182,17 @@ export default class MoveToControl extends Mixins(BaseMixin, ControlMixin) {
}
}
/**
* Get currently loaded bed mesh profile name
*/
get bed_mesh() {
return this.$store.state.printer.bed_mesh ?? null
}
get currentProfileName() {
return this.bed_mesh?.profile_name ?? ''
}
sendCmd(): void {
const xPos = this.input.x.pos !== this.gcodePositions.x ? ` X${this.input.x.pos}` : ''
const yPos = this.input.y.pos !== this.gcodePositions.y ? ` Y${this.input.y.pos}` : ''
Expand Down

0 comments on commit 2eb3400

Please sign in to comment.