Bit dimensions in localStorage

This commit is contained in:
David Carley
2022-07-12 18:16:09 -07:00
parent c710d124a0
commit 9a397d565f
2 changed files with 9 additions and 5 deletions

View File

@@ -22,7 +22,7 @@
let textValue = ""; let textValue = "";
$: if (textValue) { $: if (textValue) {
value = Number(textValue); value = Number.parseFloat(textValue) || null;
} }
onMount(() => { onMount(() => {

View File

@@ -83,8 +83,8 @@
export let open; export let open;
export let probeType: "xyz" | "z"; export let probeType: "xyz" | "z";
let currentStep: Step = "None"; let currentStep: Step = "None";
let cutterDiameter; let cutterDiameter: number;
let cutterLength; let cutterLength: number;
let showCancelButton = true; let showCancelButton = true;
let steps: Array<Step> = []; let steps: Array<Step> = [];
let nextButton = { let nextButton = {
@@ -96,8 +96,10 @@
$: metric = $Config.settings?.units === "METRIC"; $: metric = $Config.settings?.units === "METRIC";
$: if (open) { $: if (open) {
cutterDiameter = null; cutterDiameter =
cutterLength = null; Number.parseFloat(localStorage.getItem("cutterDiameter")) || null;
cutterLength =
Number.parseFloat(localStorage.getItem("cutterLength")) || null;
// Svelte appears not to like it when you invoke // Svelte appears not to like it when you invoke
// an async function from a reactive statement, so we // an async function from a reactive statement, so we
@@ -130,6 +132,8 @@
if (probeType === "xyz") { if (probeType === "xyz") {
await stepCompleted("BitDimensions", userAcknowledged); await stepCompleted("BitDimensions", userAcknowledged);
localStorage.setItem("cutterDiameter", cutterDiameter);
localStorage.setItem("cutterLength", cutterLength);
} }
await stepCompleted("PlaceProbeBlock", userAcknowledged); await stepCompleted("PlaceProbeBlock", userAcknowledged);