fix: wrong min/max position in current heightmap panel

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-12-07 00:17:40 +01:00
1 parent af1809e025
commit cb4910758e
1 file changed
+17 -2
+17 -2
View File
@@ -443,6 +443,21 @@ export default class PageHeightmap extends Mixins(BaseMixin) {
return [min, max]
}
get probedHeightmapLimit(): number[] {
let min = 0
let max = 0
if (this.bed_mesh) {
const points = []
for (const row of this.bed_mesh.probed_matrix) for (const col of row) points.push(col)
min = Math.min(min, ...points)
max = Math.max(max, ...points)
}
return [min, max]
}
get heightmapRangeLimit(): number[] {
const [min, max] = this.heightmapLimit
@@ -655,7 +670,7 @@ export default class PageHeightmap extends Mixins(BaseMixin) {
get bedMeshMaxPoint() {
if (this.bed_mesh.profile_name === '') return { row: 0, col: 0, positionX: 0, positionY: 0, value: 0 }
const [ , max] = this.heightmapLimit
const [ , max] = this.probedHeightmapLimit
let row = 0
let col = 0
@@ -681,7 +696,7 @@ export default class PageHeightmap extends Mixins(BaseMixin) {
get bedMeshMinPoint() {
if (this.bed_mesh.profile_name === '') return { row: 0, col: 0, positionX: 0, positionY: 0, value: 0 }
const [min, ] = this.heightmapLimit
const [min, ] = this.probedHeightmapLimit
let row = 0
let col = 0