VisualElementExtensions.cs 665 B

1234567891011121314151617181920212223
  1. using UnityEngine.UIElements;
  2. namespace UnityEditor.U2D.Animation
  3. {
  4. internal static class VisualElementExtensions
  5. {
  6. public static void SetHiddenFromLayout(this VisualElement element, bool isHidden)
  7. {
  8. if (isHidden)
  9. {
  10. element.SetEnabled(false);
  11. element.style.display = DisplayStyle.None;
  12. element.style.position = Position.Absolute;
  13. }
  14. else
  15. {
  16. element.SetEnabled(true);
  17. element.style.display = DisplayStyle.Flex;
  18. element.style.position = Position.Relative;
  19. }
  20. }
  21. }
  22. }