static void UpdateFieldRectFromLabel(Label label, ref TextField textField) { Rect rect = label.layout; IResolvedStyle labelStyle = label.resolvedStyle; textField.style.left = rect.xMin; textField.style.top = rect.yMin + labelStyle.marginTop; textField.style.width = rect.width - labelStyle.marginLeft - labelStyle.marginRight; textField.style.height = rect.height - labelStyle.marginTop - labelStyle.marginBottom; }
public static void GetVisualElementRadii(VisualElement ve, out Vector2 topLeft, out Vector2 bottomLeft, out Vector2 topRight, out Vector2 bottomRight) { IResolvedStyle resolvedStyle = ve.resolvedStyle; Vector2 borderRectSize = new Vector2(resolvedStyle.width, resolvedStyle.height); ComputedStyle computedStyle = ve.computedStyle; topLeft = MeshGenerationContextUtils.ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderTopLeftRadius.value); bottomLeft = MeshGenerationContextUtils.ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderBottomLeftRadius.value); topRight = MeshGenerationContextUtils.ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderTopRightRadius.value); bottomRight = MeshGenerationContextUtils.ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderBottomRightRadius.value); }
public void CopyInto(IResolvedStyle style) { for (var index = 0; index < keys.Count; index += 1) { var value = values[index]; if (value != null) { style.SetResolvedValue(keys[index], value); } } }
public static void GetVisualElementRadii(VisualElement ve, out Vector2 topLeft, out Vector2 bottomLeft, out Vector2 topRight, out Vector2 bottomRight) { IResolvedStyle style = ve.resolvedStyle; var borderRectSize = new Vector2(style.width, style.height); var computedStyle = ve.computedStyle; topLeft = ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderTopLeftRadius.value); bottomLeft = ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderBottomLeftRadius.value); topRight = ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderTopRightRadius.value); bottomRight = ConvertBorderRadiusPercentToPoints(borderRectSize, computedStyle.borderBottomRightRadius.value); }
public static bool IsRoundRect(VisualElement ve) { IResolvedStyle resolvedStyle = ve.resolvedStyle; return(resolvedStyle.borderTopLeftRadius >= Mathf.Epsilon || resolvedStyle.borderTopRightRadius >= Mathf.Epsilon || resolvedStyle.borderBottomLeftRadius >= Mathf.Epsilon || resolvedStyle.borderBottomRightRadius >= Mathf.Epsilon); }