Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: timelapse custom park position #686

Merged
merged 4 commits into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<v-text-field
ref="parkPosXElement"
:value="parkPosX"
:rules="[rules.numRequired, rules.validNum, rules.numMin(0), rules.numMax(printerMaxX)]"
:rules="[rules.numRequired, rules.validNum, rules.numMin(printerMinX), rules.numMax(printerMaxX)]"
:disabled="getCustomParkPosBlocked('x')"
:hide-details="parkPosXElement ? parkPosXElement.valid : true"
filled
Expand All @@ -27,7 +27,7 @@
<v-text-field
ref="parkPosYElement"
:value="parkPosY"
:rules="[rules.numRequired, rules.validNum, rules.numMin(0), rules.numMax(printerMaxY)]"
:rules="[rules.numRequired, rules.validNum, rules.numMin(printerMinY), rules.numMax(printerMaxY)]"
:disabled="getCustomParkPosBlocked('y')"
:hide-details="parkPosYElement ? parkPosYElement.valid : true"
filled
Expand Down Expand Up @@ -64,7 +64,7 @@ export default class LayerMacroSettings extends Mixins(StateMixin) {
numRequired: (v: number | string) => v !== '' || this.$t('app.general.simple_form.error.required'),
validNum: (v: string) => !isNaN(+v) || this.$t('app.general.simple_form.error.invalid_number'),
numMin: (min: number) => (v: number) => v >= min || this.$t('app.general.simple_form.error.min', { min }),
numMax: (max: number) => (v: number) => v <= max || this.$t('app.general.simple_form.error.min', { max })
numMax: (max: number) => (v: number) => v <= max || this.$t('app.general.simple_form.error.max', { max })
}

getCustomParkPosBlocked (axis: 'x' | 'y') {
Expand Down Expand Up @@ -99,12 +99,20 @@ export default class LayerMacroSettings extends Mixins(StateMixin) {
}
}

get printerMinX () {
return +(this.$store.getters['printer/getPrinterConfig']().stepper_x?.position_min ?? 0)
}

get printerMaxX () {
return this.$store.getters['printer/getPrinterConfig']().stepper_x?.position_max ?? Infinity
return +(this.$store.getters['printer/getPrinterConfig']().stepper_x?.position_max ?? Infinity)
}

get printerMinY () {
return +(this.$store.getters['printer/getPrinterConfig']().stepper_y?.position_min ?? 0)
}

get printerMaxY () {
return this.$store.getters['printer/getPrinterConfig']().stepper_y?.position_max ?? Infinity
return +(this.$store.getters['printer/getPrinterConfig']().stepper_y?.position_max ?? Infinity)
}

get settings (): TimelapseSettings {
Expand Down