From 7b0e09aa1ce323eda4e069780d9a808b81b593c8 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 5 Apr 2024 10:50:49 -0500 Subject: [PATCH] feat: Add extra space to settings tab --- bun.lockb | Bin 437424 -> 437424 bytes package.json | 1 + web/components/SettingsTab.vue | 22 +++++++++++++++++++++- web/composables/useBladeWidth.ts | 3 ++- web/composables/useCutlistConfig.ts | 2 ++ web/composables/useExtraSpace.ts | 10 ++++++++++ web/composables/useExtraSpaceSetting.ts | 8 ++++++++ 7 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 web/composables/useExtraSpace.ts create mode 100644 web/composables/useExtraSpaceSetting.ts diff --git a/bun.lockb b/bun.lockb index be3af4857b169d8e0b126629e1a0b71b27f53797..304a9eee8524f7d8b45e6cd05b6a5d0023360da2 100755 GIT binary patch delta 39 tcmdmRQ)FEiCmF?2K`idM0|t?QIn-K+L+mt%6O<1OO%14VC}^ delta 39 pcmdmRQ)FEiCmF>`V+`(B4+T0>rG_+bY +import { Distance } from '@aklinker1/cutlist'; + const optimize = useOptimizeForSetting(); const bladeWidth = useBladeWidthSetting(); const distanceUnit = useDistanceUnit(); const showPartNumbers = useShowPartNumbers(); +const extraSpace = useExtraSpaceSetting(); + +// Convert values when units change +watch(distanceUnit, (newUnit, oldUnit) => { + if (!newUnit || !oldUnit) return; + + console.log(newUnit, oldUnit); + const convertValue = (value: Ref) => { + const dist = new Distance(value.value + oldUnit); + value.value = dist[newUnit]; + }; + convertValue(bladeWidth); + convertValue(extraSpace); +});