From 2b4b881c5529834ca1bd4c3f14db44c997b935ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20J=C3=A4ger?= Date: Sun, 18 Jun 2023 17:06:56 +0200 Subject: [PATCH] feat: add bed aspect ratio to heightmap graph (#1420) Co-authored-by: Stefan Dej --- src/pages/Heightmap.vue | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/pages/Heightmap.vue b/src/pages/Heightmap.vue index 0fcc8212..ad624fee 100644 --- a/src/pages/Heightmap.vue +++ b/src/pages/Heightmap.vue @@ -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 }