Package com.spinyowl.legui.style.util
Class StyleUtilities
java.lang.Object
com.spinyowl.legui.style.util.StyleUtilities
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.joml.Vector4fgetBorderRadius(Component component, Style style) Returns vector of four border radius elements where: x = top left, y = top right, z = bottom right, w = bottom left.static FloatgetFloatLength(Unit length, float baseWidth) Used to extract float value of length fromLengthvalue.static floatgetFloatLengthNullSafe(Unit length, float baseWidth) Used to extract float value of length fromLengthvalue.static org.joml.Vector4fgetInnerContentRectangle(org.joml.Vector2f componentPosition, org.joml.Vector2f componentSize, org.joml.Vector4f componentPadding) Used to calculate inner content rectangle (box-sizing: border-box)static org.joml.Vector4fgetPadding(Component component, Style style) Used to get component padding represented withVector4f.static <T> Tstatic <T> T
-
Method Details
-
getPadding
Used to get component padding represented withVector4f.- Parameters:
component- component for which padding is calculated.style- style with paddings.- Returns:
- padding represented with
Vector4fwhere x - left, y - top, z - right, w - bottom.
-
getFloatLengthNullSafe
Used to extract float value of length fromLengthvalue.- Parameters:
length- lengthbaseWidth- base width to calculate length using percentage.- Returns:
- float(pixels) representation of length.
-
getFloatLength
Used to extract float value of length fromLengthvalue.- Parameters:
length- lengthbaseWidth- base width to calculate length using percentage.- Returns:
- float(pixels) representation of length.
-
getInnerContentRectangle
public static org.joml.Vector4f getInnerContentRectangle(org.joml.Vector2f componentPosition, org.joml.Vector2f componentSize, org.joml.Vector4f componentPadding) Used to calculate inner content rectangle (box-sizing: border-box)- Parameters:
componentPosition- component position.componentSize- component size.componentPadding- component padding.- Returns:
- inner content rectangle represented with
Vector4fwhere x,y - position, z,w - width and height.
-
getBorderRadius
Returns vector of four border radius elements where: x = top left, y = top right, z = bottom right, w = bottom left.NOTE. IF radius specified in percents - radius will be calculated using only width of component - will be represented with segment of circle (not ellipse).
- Returns:
- vector of four border radius.
-
getStyle
-
getStyle
-