diff --git a/haxe/ui/core/Component.hx b/haxe/ui/core/Component.hx index 9cec9ee48..a4deb4cca 100644 --- a/haxe/ui/core/Component.hx +++ b/haxe/ui/core/Component.hx @@ -1645,8 +1645,8 @@ class Component extends ComponentImpl /** The gap between the component and its children, on the right side **/ @:style(layout) public var paddingTop:Null; /** The gap between the component and its children, on the bottom **/ @:style(layout) public var paddingBottom:Null; - /** The gap between the component and its children, on the top **/ @:style(layout) public var horizontalSpacing:Null; - /** The gap between the component and its children, on the left side **/ @:style(layout) public var verticalSpacing:Null; + /** The horizontal spacing between the component's children in pixels **/ @:style(layout) public var horizontalSpacing:Null; + /** The vertical spacing between the component's children in pixels **/ @:style(layout) public var verticalSpacing:Null; /** The amount of left offsetting to apply to the calculated position **/ @:style public var marginLeft:Null; /** The amount of right offsetting to apply to the calculated position**/ @:style public var marginRight:Null; diff --git a/haxe/ui/styles/Style.hx b/haxe/ui/styles/Style.hx index a8c51be50..f17e191a7 100644 --- a/haxe/ui/styles/Style.hx +++ b/haxe/ui/styles/Style.hx @@ -56,8 +56,8 @@ class Style { /** The amount of right offset to apply to the calculated position **/ @:optional public var marginRight:Null; /** The amount of bottom offset to apply to the calculated position **/ @:optional public var marginBottom:Null; - /** The vertical spacing between the component's children in pixels**/ @:optional public var horizontalSpacing:Null; - /** The horizontal spacing between the component's children in pixels**/ @:optional public var verticalSpacing:Null; + /** The horizontal spacing between the component's children in pixels**/ @:optional public var horizontalSpacing:Null; + /** The vertical spacing between the component's children in pixels**/ @:optional public var verticalSpacing:Null; /** The color of the text **/ @:optional public var color:Null; diff --git a/haxe/ui/util/MathUtil.hx b/haxe/ui/util/MathUtil.hx index 5c0aae0f9..9b099cd4d 100644 --- a/haxe/ui/util/MathUtil.hx +++ b/haxe/ui/util/MathUtil.hx @@ -3,13 +3,16 @@ package haxe.ui.util; class MathUtil { public static inline var MAX_INT:Int = 2147483647; // 2**31 - 1 public static inline var MIN_INT:Int = -2147483648; - public static inline var SIGNIFICANT_DECIMAL_DIGITS:Int = 7; // 32 bit floats have 24 bits precision log10(2**24) ≈ 7.225 (for 64 bits it's 15) - public static inline var MAX_FLOAT_DIFFERENCE:Float = 0.0000001; // account for floating-point inaccuracy + public static inline var MAX_FLOAT_DIFFERENCE:Float = 0.0000001; // account for floating-point inaccuracy, 32 bit floats have 24 bits precision log10(2**24) ≈ 7.225 (for 64 bits it's 15) public static inline function distance(x1:Float, y1:Float, x2:Float, y2:Float):Float { return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } + /** + Precision is the number of significant decimal digits + Returns a precision between 0 and 7 + **/ public static inline function precision(v:Float):Int { var e = 1; var p = 0; @@ -24,7 +27,7 @@ class MathUtil { if (!Math.isFinite(v1) || !Math.isFinite(v2)) { return Math.NaN; } - var p = Std.int(Math.min(SIGNIFICANT_DECIMAL_DIGITS, Math.max(precision(v1), precision(v2)))); + var p = Std.int(Math.max(precision(v1), precision(v2))); var e = 1; for ( i in 0...p) { e *= 10; @@ -42,7 +45,7 @@ class MathUtil { if (!Math.isFinite(v) || !Math.isFinite(n)) { return Math.NaN; } - var p = Std.int(Math.min(SIGNIFICANT_DECIMAL_DIGITS, Math.max(precision(v), precision(n)))); + var p = Std.int(Math.max(precision(v), precision(n))); var inv = 1.0 / n; return round(Math.fround(v * inv) / inv, p); }