using System; using System.Collections.Generic; using System.Linq; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.U2D.Animation; using UnityEngine.UIElements; namespace UnityEditor.U2D.Animation.SpriteLibraryEditor { internal class LabelsTab : VisualElement { public class CustomUxmlFactory : UxmlFactory { } ViewEvents m_ViewEvents; VisualElement m_LabelsContainer; Button m_AddButton; Label m_InfoLabel; IRenamableCollection m_ItemsCollection; List m_SelectedCategories = new(); List m_SelectedLabels = new(); List m_LabelData = new(); ViewType m_CurrentViewType; float m_CurrentViewSize; float m_AdjustedViewSize; const string k_LabelDragItemsStr = "SpriteLibraryLabel.DragItems"; const string k_ListLabelClassName = SpriteLibraryEditorWindow.editorWindowClassName + "__label-list-label"; const string k_GridLabelClassName = SpriteLibraryEditorWindow.editorWindowClassName + "__label-grid-label"; const string k_ListTextClassName = SpriteLibraryEditorWindow.editorWindowClassName + "__label-list-text"; const string k_GridTextClassName = SpriteLibraryEditorWindow.editorWindowClassName + "__label-grid-text"; const float k_MinListSize = 20f; const float k_MaxListSize = 30f; const float k_MinGridSize = 80f; const float k_MaxGridSize = 200f; bool m_IsFiltered; bool IsTabActive() => m_SelectedCategories != null && m_SelectedCategories.Count == 1; bool CanModifyLabels() => IsTabActive() && !m_IsFiltered; public void BindElements(ControllerEvents controllerEvents, ViewEvents viewEvents) { m_ViewEvents = viewEvents; m_CurrentViewType = SpriteLibraryEditorWindow.Settings.viewType; m_CurrentViewSize = SpriteLibraryEditorWindow.Settings.viewSize; m_LabelsContainer = this.Q("LabelsContainer"); var tabHeaderLabel = this.Q(SpriteLibraryEditorWindow.tabHeaderName).Q