From 460aa6e49acb8407df75170d6ee44336834ed35f Mon Sep 17 00:00:00 2001 From: Penny Wood Date: Wed, 13 Nov 2024 21:52:06 +0800 Subject: [PATCH 1/2] fix: Order tool rows better This uses a formula to make the tool rows be or at least approximate even lengths, rather than having the last row have len % 6 tools. --- src/components/panels/Extruder/ExtruderControlPanelTools.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/panels/Extruder/ExtruderControlPanelTools.vue b/src/components/panels/Extruder/ExtruderControlPanelTools.vue index 5cce8979d..409aca47f 100644 --- a/src/components/panels/Extruder/ExtruderControlPanelTools.vue +++ b/src/components/panels/Extruder/ExtruderControlPanelTools.vue @@ -21,7 +21,8 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin mdiPrinter3dNozzle = mdiPrinter3dNozzle get rows() { - const cols = 6 + let len = this.toolchangeMacros.length + let cols = Math.ceil(len / Math.ceil(len / 6.0)) let rows = [] for (let i = 0; i < this.toolchangeMacros.length; i += cols) { From 47f7b308281c39e1afc7fefac043a429337f2c3f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 14 Nov 2024 14:09:02 +0100 Subject: [PATCH 2/2] refactor: change let to const in ExtruderControlPanelTools.vue Signed-off-by: Stefan Dej --- src/components/panels/Extruder/ExtruderControlPanelTools.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/panels/Extruder/ExtruderControlPanelTools.vue b/src/components/panels/Extruder/ExtruderControlPanelTools.vue index 409aca47f..1ae8b6bc0 100644 --- a/src/components/panels/Extruder/ExtruderControlPanelTools.vue +++ b/src/components/panels/Extruder/ExtruderControlPanelTools.vue @@ -21,8 +21,8 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin mdiPrinter3dNozzle = mdiPrinter3dNozzle get rows() { - let len = this.toolchangeMacros.length - let cols = Math.ceil(len / Math.ceil(len / 6.0)) + const len = this.toolchangeMacros.length + const cols = Math.ceil(len / Math.ceil(len / 6)) let rows = [] for (let i = 0; i < this.toolchangeMacros.length; i += cols) {