fix: unable to submit coordinate values (#878)

This commit is contained in:
th33xitus 2022-06-10 19:14:15 +02:00 committed by GitHub
parent 5f8f0469e0
commit e7b281739b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 64 deletions

View File

@ -1,28 +1,30 @@
<template>
<v-text-field
v-model="position"
:label="`[ ${label} ]`"
:suffix="suffix"
:disabled="disabled"
:readonly="readonly"
:error="!validate"
hide-details="auto"
type="number"
hide-spin-buttons
outlined
reverse
dense
@blur="onBlur"
@focus="!readonly ? $event.target.select() : {}">
<template v-if="errorMsg.length" #append>
<v-tooltip top>
<template #activator="{ on, attrs }">
<v-icon color="error" v-bind="attrs" v-on="on">{{ mdiAlert }}</v-icon>
</template>
<span>{{ errorMsg.join(', ') }}</span>
</v-tooltip>
</template>
</v-text-field>
<form @submit.prevent="submit">
<v-text-field
v-model="position"
:label="`[ ${label} ]`"
:suffix="suffix"
:disabled="disabled"
:readonly="readonly"
:error="!validate"
hide-details="auto"
type="number"
hide-spin-buttons
outlined
reverse
dense
@blur="onBlur"
@focus="!readonly ? $event.target.select() : {}">
<template v-if="errorMsg.length" #append>
<v-tooltip top>
<template #activator="{ on, attrs }">
<v-icon color="error" v-bind="attrs" v-on="on">{{ mdiAlert }}</v-icon>
</template>
<span>{{ errorMsg.join(', ') }}</span>
</v-tooltip>
</template>
</v-text-field>
</form>
</template>
<script lang="ts">
@ -67,6 +69,10 @@ export default class MoveToInput extends Mixins(BaseMixin) {
}
}
submit(): void {
this.$emit('submit')
}
get validate(): boolean {
const isValid =
this.position !== '' &&

View File

@ -13,46 +13,47 @@
<span>{{ $t('Panels.ToolheadControlPanel.Position') }}: {{ displayPositionAbsolute }}</span>
</v-col>
</v-row>
<v-form class="pt-3" @keyup.native.enter="sendCmd">
<v-row dense>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.x.pos"
:label="livePositions.x"
:suffix="'X'"
:position-max="stepperXmax"
:position-min="stepperXmin"
:current-pos="gcodePositions.x"
:readonly="['printing'].includes(printer_state)"
:disabled="!xAxisHomed"
@validate="validate"></move-to-input>
</v-col>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.y.pos"
:label="livePositions.y"
:suffix="'Y'"
:position-max="stepperYmax"
:position-min="stepperYmin"
:current-pos="gcodePositions.y"
:readonly="['printing'].includes(printer_state)"
:disabled="!yAxisHomed"
@validate="validate"></move-to-input>
</v-col>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.z.pos"
:label="livePositions.z"
:suffix="'Z'"
:position-max="stepperZmax"
:position-min="stepperZmin"
:current-pos="gcodePositions.z"
:readonly="['printing'].includes(printer_state)"
:disabled="!zAxisHomed"
@validate="validate"></move-to-input>
</v-col>
</v-row>
</v-form>
<v-row dense>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.x.pos"
:label="livePositions.x"
:suffix="'X'"
:position-max="stepperXmax"
:position-min="stepperXmin"
:current-pos="gcodePositions.x"
:readonly="['printing'].includes(printer_state)"
:disabled="!xAxisHomed"
@validate="validate"
@submit="sendCmd"></move-to-input>
</v-col>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.y.pos"
:label="livePositions.y"
:suffix="'Y'"
:position-max="stepperYmax"
:position-min="stepperYmin"
:current-pos="gcodePositions.y"
:readonly="['printing'].includes(printer_state)"
:disabled="!yAxisHomed"
@validate="validate"
@submit="sendCmd"></move-to-input>
</v-col>
<v-col :class="el.is.small ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.z.pos"
:label="livePositions.z"
:suffix="'Z'"
:position-max="stepperZmax"
:position-min="stepperZmin"
:current-pos="gcodePositions.z"
:readonly="['printing'].includes(printer_state)"
:disabled="!zAxisHomed"
@validate="validate"
@submit="sendCmd"></move-to-input>
</v-col>
</v-row>
</v-container>
</template>
</responsive>