feat: add bed aspect ratio to heightmap graph (#1420)

Co-authored-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Michael Jäger 2023-06-18 17:06:56 +02:00 committed by GitHub
parent 7468f882c1
commit 2b4b881c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -629,6 +629,8 @@ export default class PageHeightmap extends Mixins(BaseMixin, ControlMixin) {
},
},
},
boxWidth: 100 * this.scaleX,
boxDepth: 100 * this.scaleY,
},
series: this.series,
}
@ -699,6 +701,30 @@ export default class PageHeightmap extends Mixins(BaseMixin, ControlMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'view.heightmap.scaleGradient', value: newVal })
}
get absRangeX(): number {
return this.rangeX[1] - this.rangeX[0]
}
get absRangeY(): number {
return this.rangeY[1] - this.rangeY[0]
}
get minRangeXY(): number {
return Math.min(this.absRangeX, this.absRangeY)
}
get scaleX(): number {
if (this.minRangeXY === 0) return 1
return this.absRangeX / this.minRangeXY
}
get scaleY(): number {
if (this.minRangeXY === 0) return 1
return this.absRangeY / this.minRangeXY
}
get scaleZMax(): number {
return this.$store.state.gui.view.heightmap.scaleZMax ?? 0.5
}