diff --git a/src/app/services/decoder.service.ts b/src/app/services/decoder.service.ts index e250cf80..29355727 100644 --- a/src/app/services/decoder.service.ts +++ b/src/app/services/decoder.service.ts @@ -65,17 +65,13 @@ export class DecoderService { .replaceAll('~', '","'); console.log(decompressedJSON); - const compactData = JSON.parse(decompressedJSON, (key, value) => { if (typeof value === 'string') { - if (/^[0-9a-f]+$/i.test(value)) { - return parseInt(value, 16); - } if (value === 'y') return true; if (value === 'n') return false; - } + } return value; - }); + }); // Expand the compact data into full objects. console.log('compactData'); diff --git a/src/app/services/state.service.ts b/src/app/services/state.service.ts index c94a8fb1..9ae5f47e 100644 --- a/src/app/services/state.service.ts +++ b/src/app/services/state.service.ts @@ -251,9 +251,9 @@ export class StateService { // Updates the global measurement "units" and their "suffix" based on user selection. public changeUnits(units: string, suffix: string) { - const oldSuffix = this.globalUnitsSuffix.value; + const oldSuffix = this.globalUnitsSuffix.value; if (oldSuffix === suffix) return; - + // bring whatever current unit to 'cm' // 1cm = 1cm, 1cm = 0.01m, 1cm = 1/2.54in // Example: 1in = (?)m. 1in / (1/2.54in) = 2.54cm -> 2.54cm*0.01m = 0.025m. Finish convertion 1in = 0.025m @@ -274,7 +274,7 @@ export class StateService { joint.coords.y *= conversionRatio; console.log(`new 'x' coordinate conversion: ${joint.coords.x}`); console.log(`new 'y' coordinate conversion: ${joint.coords.y}`); - }); + }); this.mechanism.notifyChange(); //notify the mechanism this.globalUnits.next(units);