Class ResponsiveUIServices
Handles dynamic UI changes
Namespace: Unity.Industrial.Forma.StandardUI
Syntax
public static class ResponsiveUIServices
Methods
AddSafeAreaPadding(VisualElement, ResponsiveUIServices.SafeAreaAdjustmentArgs)
Adds padding based on the device Safe Area.
Declaration
public static Vector4 AddSafeAreaPadding(VisualElement element, ResponsiveUIServices.SafeAreaAdjustmentArgs args)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | element | Visual Element that needs padding |
ResponsiveUIServices.SafeAreaAdjustmentArgs | args | Which sides to apply the padding to. |
Returns
Type | Description |
---|---|
Vector4 |
AddStyleSheetsForOrientationChange(VisualElement, VisualElement, StyleSheet, StyleSheet, Func<Boolean>)
Handles orientation change for UI. On Desktop, landscape/portrait mode is determined by whether the window width/height is larger.
Declaration
public static void AddStyleSheetsForOrientationChange(VisualElement treeRootElement, VisualElement rootElement, StyleSheet portrait, StyleSheet landscape, Func<bool> conditional = null)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | treeRootElement | The top node in this UI hierarchy. The callback is registered to this element. Element should be at least one level higher than the RootElement to prevent infinite loop of callbacks. |
VisualElement | rootElement | The visual element that the portrait/landscape stylesheet should be attached to. |
StyleSheet | portrait | Stylesheet to apply in portrait mode |
StyleSheet | landscape | Stylesheet to apply in landscape mode. |
Func<Boolean> | conditional | A boolean expression used to further specify when the stylesheets are allowed to be changed. |
CalculateCardWidthForScreen(Int32)
Calculate how large a UI card should be for the given screen width. Based on max card width of 180 in portrait mode as defined in Unity.Industrial.Forma.StandardUI.ResponsiveUIServices.CalculatePortraitCardWidth(System.Int32) or 190 for landscape mode as seen in Unity.Industrial.Forma.StandardUI.ResponsiveUIServices.CalculateLandscapeCardWidth(System.Int32)
Declaration
public static int CalculateCardWidthForScreen(int screenWidth)
Parameters
Type | Name | Description |
---|---|---|
Int32 | screenWidth | Screen width |
Returns
Type | Description |
---|---|
Int32 | Suggested card size |