Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/app/services/decoder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions src/app/services/state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
Loading