@rogieking/figui3 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fig.js +6 -0
- package/package.json +1 -1
package/fig.js
CHANGED
|
@@ -995,9 +995,15 @@ class FigInputText extends HTMLElement {
|
|
|
995
995
|
sanitized
|
|
996
996
|
);
|
|
997
997
|
}
|
|
998
|
+
sanitized = this.#formatNumber(sanitized);
|
|
998
999
|
}
|
|
999
1000
|
return sanitized;
|
|
1000
1001
|
}
|
|
1002
|
+
#formatNumber(num, precision = 2) {
|
|
1003
|
+
// Check if the number has any decimal places after rounding
|
|
1004
|
+
const rounded = Math.round(num * 100) / 100;
|
|
1005
|
+
return Number.isInteger(rounded) ? rounded : rounded.toFixed(precision);
|
|
1006
|
+
}
|
|
1001
1007
|
|
|
1002
1008
|
static get observedAttributes() {
|
|
1003
1009
|
return [
|