Class PreviewResolutionPresets
Shared reference-resolution presets and letterboxing math for the editor preview tools (the Composite
View Builder wireframe and the View Preview live render). Keeping it in one place means both tools offer
the same screen list and scale fixed-px content the same way.
Inheritance
PreviewResolutionPresets
Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
Syntax
public static class PreviewResolutionPresets
Fields
Presets
Reference screens the preview can emulate; fixed-px sizes scale against the chosen resolution and the
content is letterboxed to its aspect ratio. The last entry is a custom W×H.
Declaration
public static readonly (string label, int w, int h)[] Presets
Field Value
Methods
AspectLabel(int, int)
A reduced "W:H" aspect label (e.g. "16:9"), or "—" when undefined.
Declaration
public static string AspectLabel(int w, int h)
Parameters
| Type |
Name |
Description |
| int |
w |
|
| int |
h |
|
Returns
IsCustom(int)
True when the given preset index is the trailing "Custom…" entry.
Declaration
public static bool IsCustom(int index)
Parameters
| Type |
Name |
Description |
| int |
index |
|
Returns
Labels()
Declaration
public static string[] Labels()
Returns
Letterbox(Rect, float)
Centers a rect of the given aspect (width/height) inside area, scaled to fit
(letterbox). Returns area unchanged for degenerate inputs.
Declaration
public static Rect Letterbox(Rect area, float aspect)
Parameters
| Type |
Name |
Description |
| Rect |
area |
|
| float |
aspect |
|
Returns
Resolution(int, int, int)
Resolves the (width, height) for a preset index, using customWidth/customHeight
when the index is the custom entry.
Declaration
public static (int w, int h) Resolution(int index, int customWidth, int customHeight)
Parameters
| Type |
Name |
Description |
| int |
index |
|
| int |
customWidth |
|
| int |
customHeight |
|
Returns