Skip to content

Commit

Permalink
Invert displayMultiplier and displayOffset semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
mairas committed Sep 26, 2024
1 parent 4d4ff35 commit c482a57
Show file tree
Hide file tree
Showing 2 changed files with 1,947 additions and 1,948 deletions.
14 changes: 7 additions & 7 deletions frontend/src/pages/Configuration/ConfigCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ export function EditControl({
key={id}
label={schema.title}
value={
(Number(value) - (schema.displayOffset ?? 0)) /
(schema.displayMultiplier ?? 1)
(schema.displayMultiplier ?? 1) * Number(value) +
(schema.displayOffset ?? 0)
}
readOnly={schema.readOnly ?? false}
setValue={(value: number) => {
setValue(
value * (schema.displayMultiplier ?? 1) +
(schema.displayOffset ?? 0),
(value - (schema.displayOffset ?? 0)) /
(schema.displayMultiplier ?? 1),
);
}}
/>
Expand All @@ -86,15 +86,15 @@ export function EditControl({
key={id}
label={schema.title}
value={
Number(value) * (schema.displayMultiplier ?? 1) +
(schema.displayMultiplier ?? 1) * Number(value) +
(schema.displayOffset ?? 0)
}
readOnly={schema.readOnly ?? false}
step={1}
setValue={(value: number) => {
setValue(
value / (schema.displayMultiplier ?? 1) -
(schema.displayOffset ?? 0),
(value - (schema.displayOffset ?? 0)) /
(schema.displayMultiplier ?? 1),
);
}}
/>
Expand Down
Loading

0 comments on commit c482a57

Please sign in to comment.