had cursor replace uses of getDistanceUnit with using the distance unit in the users settings so that it no longer relies on local storage

This commit is contained in:
csawatzky 2026-03-26 09:43:39 -06:00
parent c6bb7aa24a
commit dc54f99abd
20 changed files with 273 additions and 199 deletions

View file

@ -19,7 +19,7 @@ import { pond } from "protobuf-ts/pond";
import { quack } from "protobuf-ts/quack";
import { getTextSecondary } from "theme/text";
// import { getTextSecondary } from "theme";
import { getDistanceUnit, roundTo } from "utils";
import { roundTo } from "utils";
import { extract } from "utils/types";
interface Enumeration {
@ -440,7 +440,8 @@ export class MeasurementDescriber {
this.details.max = 100000;
break;
case quack.MeasurementType.MEASUREMENT_TYPE_DISTANCE_CM:
let distanceUnit = getDistanceUnit();
let distanceUnit =
user?.distanceUnit() ?? pond.DistanceUnit.DISTANCE_UNIT_FEET;
this.details.label = "Distance";
this.details.unit = "cm";
if (distanceUnit === pond.DistanceUnit.DISTANCE_UNIT_FEET) {
@ -454,7 +455,8 @@ export class MeasurementDescriber {
this.details.max = 100000;
break;
case quack.MeasurementType.MEASUREMENT_TYPE_SPEED:
let speedUnit = getDistanceUnit()
let speedUnit =
user?.distanceUnit() ?? pond.DistanceUnit.DISTANCE_UNIT_FEET;
this.details.label = "Speed";
this.details.unit = speedUnit === pond.DistanceUnit.DISTANCE_UNIT_METERS ? "m/s" : "ft/m"; //yes this is meters per second and feet per minute
this.details.colour = green["500"];