Fixing crash when X Cursor's calculated target number is an integer.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2025-04-22 05:20:50 +02:00
parent 5586f0c214
commit 45f01a9871
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160

View file

@ -78,7 +78,7 @@ export default class XCursor extends DrawableObject {
if(this.approximate) {
approx = (this.targetElement.execute(this.x.execute()))
let intLength = Math.round(approx).toString().length
let rounding = Math.min(this.rounding, approx.toString().length - intLength - 1)
let rounding = Math.max(0, Math.min(this.rounding, approx.toString().length - intLength - 1))
approx = approx.toPrecision(rounding + intLength)
}
return approx