fix: add gcode offset to live position in gcodeviewer (#1341)

This commit is contained in:
Stefan Dej 2023-04-30 21:30:40 +02:00 committed by GitHub
parent c598d6260d
commit ab777d5e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -436,10 +436,23 @@ export default class Viewer extends Mixins(BaseMixin) {
return this.$store.state.printer.print_stats?.filename ?? ''
}
get currentPosition() {
get livePosition() {
return this.$store.state.printer.motion_report?.live_position ?? [0, 0, 0, 0]
}
get gcodeOffset() {
return this.$store.state.printer?.gcode_move?.homing_origin ?? [0, 0, 0]
}
get currentPosition() {
return [
this.livePosition[0] - this.gcodeOffset[0],
this.livePosition[1] - this.gcodeOffset[1],
this.livePosition[2] - this.gcodeOffset[2],
this.livePosition[3],
]
}
get showTrackingButton() {
return this.printerIsPrinting && this.sdCardFilePath === this.loadedFile
}