feat: add heightmap current mesh information panel

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-10-29 00:14:56 +02:00
1 parent b5b1b44c8d
commit 0909dc1357
3 files changed
+105 -19

No files matched your search

+15 -15
View File
@@ -13,6 +13,7 @@
"@codemirror/lang-javascript": "^0.19.1",
"@codemirror/lang-json": "^0.19.1",
"@codemirror/legacy-modes": "^0.19.0",
"@codemirror/search": "^0.19.2",
"@codemirror/state": "^0.19.1",
"@codemirror/stream-parser": "^0.19.1",
"@codemirror/view": "^0.19.1",
@@ -1746,23 +1747,22 @@
}
},
"node_modules/@codemirror/search": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.0.tgz",
"integrity": "sha512-9yFHX3XENso1dzUPkHNZU96IMCs/cjDg3JTF6qiInaCOxo5cwuRn95NIem+jlpvx6fQsjstzSR55HIb5R5fb7A==",
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.2.tgz",
"integrity": "sha512-TrRxUxyJ/a7HXtUvMZhgkOUbKE1xO33UhXjn1XACEHKWhgovw1vEeEEti9dZejN8/QOOFJed39InUxmp7oQ8HA==",
"dependencies": {
"@codemirror/panel": "^0.19.0",
"@codemirror/rangeset": "^0.19.0",
"@codemirror/state": "^0.19.0",
"@codemirror/state": "^0.19.2",
"@codemirror/text": "^0.19.0",
"@codemirror/view": "^0.19.0",
"crelt": "^1.0.5"
}
},
"node_modules/@codemirror/state": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.1.tgz",
"integrity": "sha512-5NR6/h+pVp7d77F4rLpNWcYvARCvqXa1uayoNx06d1aEm6wy/K+3lxTg7taB/qaEKd+oCsSHjRL8oSE1Fm+nsw==",
"license": "MIT",
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.2.tgz",
"integrity": "sha512-dDqCrtkb0c/LYUlvQBLyLfkISEskbZnhvBbcVOF4j2AusJ1ptJ3EGMxBL9G16GP1TOdC1T613gA1J1qc3pbfGQ==",
"dependencies": {
"@codemirror/text": "^0.19.0"
}
@@ -21619,22 +21619,22 @@
}
},
"@codemirror/search": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.0.tgz",
"integrity": "sha512-9yFHX3XENso1dzUPkHNZU96IMCs/cjDg3JTF6qiInaCOxo5cwuRn95NIem+jlpvx6fQsjstzSR55HIb5R5fb7A==",
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.2.tgz",
"integrity": "sha512-TrRxUxyJ/a7HXtUvMZhgkOUbKE1xO33UhXjn1XACEHKWhgovw1vEeEEti9dZejN8/QOOFJed39InUxmp7oQ8HA==",
"requires": {
"@codemirror/panel": "^0.19.0",
"@codemirror/rangeset": "^0.19.0",
"@codemirror/state": "^0.19.0",
"@codemirror/state": "^0.19.2",
"@codemirror/text": "^0.19.0",
"@codemirror/view": "^0.19.0",
"crelt": "^1.0.5"
}
},
"@codemirror/state": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.1.tgz",
"integrity": "sha512-5NR6/h+pVp7d77F4rLpNWcYvARCvqXa1uayoNx06d1aEm6wy/K+3lxTg7taB/qaEKd+oCsSHjRL8oSE1Fm+nsw==",
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.2.tgz",
"integrity": "sha512-dDqCrtkb0c/LYUlvQBLyLfkISEskbZnhvBbcVOF4j2AusJ1ptJ3EGMxBL9G16GP1TOdC1T613gA1J1qc3pbfGQ==",
"requires": {
"@codemirror/text": "^0.19.0"
}
+9 -3
View File
@@ -188,8 +188,6 @@
"Flat": "Flat",
"Wireframe": "Wireframe",
"Scale": "Scale",
"Profiles": "Profiles",
"Deleted": "deleted",
"RenameBedMeshProfile": "Rename Bed Mesh Profile",
@@ -201,7 +199,15 @@
"DoYouReallyWantToCalibrate": "Do you really want to start the bed calibration?",
"DeleteBedMeshProfile": "Delete Bed Mesh Profile",
"DoYouReallyWantToDelete": "Do you really want to delete the profile \"{name}\"?",
"Remove": "remove"
"Remove": "remove",
"CurrentMesh": {
"Headline": "Current Mesh",
"Name": "Name",
"Size": "Size",
"Min": "Min",
"Max": "Max",
"Variance": "Variance"
}
},
"History": {
"Statistics": "Statistics",
+81 -1
View File
@@ -66,7 +66,35 @@
</panel>
</v-col>
<v-col class="col-12 col-md-4">
<panel :title="$t('Heightmap.Profiles')" card-class="heightmap-profiles-panel" icon="mdi-stack-overflow">
<panel :title="$t('Heightmap.CurrentMesh.Headline')" v-if="bed_mesh.profile_name !== ''" card-class="heightmap-current-mesh-panel" icon="mdi-information" :collapsible="true">
<v-card-text class="py-3 px-0">
<v-row class="px-3">
<v-col>{{ $t('Heightmap.CurrentMesh.Name') }}</v-col>
<v-col class="text-right">{{ bed_mesh.profile_name }}</v-col>
</v-row>
<v-divider class="my-3"></v-divider>
<v-row class="px-3">
<v-col>{{ $t('Heightmap.CurrentMesh.Size') }}</v-col>
<v-col class="text-right">{{ bed_mesh.probed_matrix[0].length }}x{{ bed_mesh.probed_matrix.length }}</v-col>
</v-row>
<v-divider class="my-3"></v-divider>
<v-row class="px-3">
<v-col>{{ $t('Heightmap.CurrentMesh.Max') }} [{{ bedMeshMaxPoint.positionX }}, {{ bedMeshMaxPoint.positionY }}]</v-col>
<v-col class="text-right">{{ bedMeshMaxPoint.value }} mm</v-col>
</v-row>
<v-divider class="my-3"></v-divider>
<v-row class="px-3">
<v-col>{{ $t('Heightmap.CurrentMesh.Min') }} [{{ bedMeshMinPoint.positionX }}, {{ bedMeshMinPoint.positionY }}]</v-col>
<v-col class="text-right">{{ bedMeshMinPoint.value }} mm</v-col>
</v-row>
<v-divider class="my-3"></v-divider>
<v-row class="px-3">
<v-col>{{ $t('Heightmap.CurrentMesh.Variance') }}</v-col>
<v-col class="text-right">{{ Math.abs(bedMeshMinPoint.value - bedMeshMaxPoint.value) }} mm</v-col>
</v-row>
</v-card-text>
</panel>
<panel :title="$t('Heightmap.Profiles')" card-class="heightmap-profiles-panel" icon="mdi-stack-overflow" :collapsible="true">
<v-card-text class="py-0 px-0" v-if="profiles.length">
<v-simple-table>
<template v-slot:default>
@@ -621,6 +649,58 @@ export default class PageHeightmap extends Mixins(BaseMixin) {
return output
}
get bedMeshMaxPoint() {
if (this.bed_mesh.profile_name === '') return { row: 0, col: 0, positionX: 0, positionY: 0, value: 0 }
const [ , max] = this.heightmapLimit
let row = 0
let col = 0
this.bed_mesh.probed_matrix.forEach((rowPoints: number[], index: number) => {
if (Math.max(...rowPoints) === max) {
row = index + 1
col = rowPoints.findIndex((point: number) => point === max) + 1
}
})
const positionX = Math.round((this.bed_mesh.mesh_min[0] + (this.bed_mesh.mesh_max[0] - this.bed_mesh.mesh_min[0]) / this.bed_mesh.probed_matrix[0].length * (col - 1)) * 10) / 10
const positionY = Math.round((this.bed_mesh.mesh_min[1] + (this.bed_mesh.mesh_max[1] - this.bed_mesh.mesh_min[1]) / this.bed_mesh.probed_matrix.length * (row - 1)) * 10) / 10
return {
row,
col,
positionX,
positionY,
value: Math.round(max * 1000) / 1000
}
}
get bedMeshMinPoint() {
if (this.bed_mesh.profile_name === '') return { row: 0, col: 0, positionX: 0, positionY: 0, value: 0 }
const [min, ] = this.heightmapLimit
let row = 0
let col = 0
this.bed_mesh.probed_matrix.forEach((rowPoints: number[], index: number) => {
if (Math.min(...rowPoints) === min) {
row = index + 1
col = rowPoints.findIndex((point: number) => point === min) + 1
}
})
const positionX = Math.round((this.bed_mesh.mesh_min[0] + (this.bed_mesh.mesh_max[0] - this.bed_mesh.mesh_min[0]) / this.bed_mesh.probed_matrix[0].length * (col - 1)) * 10) / 10
const positionY = Math.round((this.bed_mesh.mesh_min[1] + (this.bed_mesh.mesh_max[1] - this.bed_mesh.mesh_min[1]) / this.bed_mesh.probed_matrix.length * (row - 1)) * 10) / 10
return {
row,
col,
positionX,
positionY,
value: Math.round(min * 1000) / 1000
}
}
tooltipFormatter(data: any): string {
return '<b>'+data.seriesName+'</b><br />' +
'<b>' + data.dimensionNames[0]+'</b>: '+data.data[0].toFixed(1) + ' mm <br />' +