Size
interludesoftware.tick¶
Interlude.Tick¶
Size Struct¶
A length used by layout helpers (Top(Size),
PushSizedHorizontal(Size[]), etc.). Either an absolute
pixel count (Interlude.Tick.SizeUnit.Pixel) or a fraction of the parent
dimension in [0, 1] (Interlude.Tick.SizeUnit.Percent).
The implicit int → Pixel and float → Percent conversions
are convenient at literal call sites but can silently mis-interpret
computed values: Left(10f) is 1000% of parent, not 10 pixels.
Prefer Pixels(int) / Percent(float) when
the unit is not obvious from context - particularly when the value
comes from arithmetic, a serialised field, or a Mathf call.
Constructors¶
Size(float) Constructor¶
Creates a percent-unit Size. Prefer Percent(float) at non-obvious call sites.
Parameters¶
value System.Single
Size(int) Constructor¶
Creates a pixel-unit Size. Prefer Pixels(int) at non-obvious call sites.
Parameters¶
value System.Int32
Size(SizeUnit, float) Constructor¶
Creates a Size with an explicit unit and value.
Parameters¶
value System.Single
Methods¶
Size.Percent(float) Method¶
Constructs a percent-unit Size as a fraction of the parent
dimension. 0.5f is half the parent, 1.0f the full parent.
Equivalent to the implicit float → Size conversion, but explicit
at the call site so a literal like 10f can't be silently treated
as 1000% - pass Pixels(10) if pixels were intended.
Parameters¶
fraction System.Single
Returns¶
Size.Pixels(float) Method¶
Constructs a pixel-unit Size from a possibly-fractional value.
Use when a pixel length comes from arithmetic (for example a computed radius)
so the implicit float → Percent conversion cannot silently misread it.
Parameters¶
value System.Single
Returns¶
Size.Pixels(int) Method¶
Constructs a pixel-unit Size. Equivalent to the implicit
int → Size conversion, but explicit at the call site, which
matters when the value comes from arithmetic that could be mistakenly
authored as float.
Parameters¶
value System.Int32
Returns¶
Operators¶
Size.implicit operator Size(float) Operator¶
Implicitly converts a System.Single literal to a percent-unit Size.
Parameters¶
value System.Single
Returns¶
Size.implicit operator Size(int) Operator¶
Implicitly converts an System.Int32 literal to a pixel-unit Size.
Parameters¶
value System.Int32