commit 384a1a15a87219078f8e640b7aa87d0b182394b6
parent 61b787d7fd9857d814ff16c6c7b33d0f9e8f4a74
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Mon, 14 Oct 2024 13:51:37 -0700
Use whole numbers in userLength
This might lead to issues where furniture varieties are 1 1/2" or
something which will get rounded to the nearest inch and then not
count as the variety anymore, but I'm going to do it for now.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js
@@ -1270,16 +1270,16 @@ function parseUserLength(editor, length) {
}
function userLength(editor, units) {
- let a = editor.units.separate(units, editor.unitSystem, { whole: false })
+ let a = editor.units.separate(units, editor.unitSystem, { whole: true })
let words = []
for (let i in a) {
if (!a[i].unit) {
// We don't allow anything smaller than smallest defined unit,
// though maybe this should be an error condition
+ continue
}
- words.push(a[i].amount.toFixed(Math.min(2, precision(a[i].amount))) +
- (a[i].symbol ?? a[i].name ?? ""))
+ words.push(a[i].amount + (a[i].symbol ?? a[i].name ?? ""))
}
return words.join(" ")
}