using System; using System.Collections.Generic; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.U2D.Animation; using UnityEngine.UIElements; namespace UnityEditor.U2D.Animation.SpriteLibraryEditor { #if ENABLE_UXML_SERIALIZED_DATA [UxmlElement] #endif internal partial class EditorMainWindow : VisualElement { #if ENABLE_UXML_TRAITS public class CustomUxmlFactory : UxmlFactory { } #endif ViewEvents m_ViewEvents; CategoriesTab m_CategoriesTab; LabelsTab m_LabelsTab; TwoPaneSplitView m_SplitView; const float k_MinPaneWidth = 150f; internal void BindElements(ControllerEvents controllerEvents, ViewEvents viewEvents) { m_ViewEvents = viewEvents; m_CategoriesTab = this.Q(); m_CategoriesTab.BindElements(controllerEvents, viewEvents); m_LabelsTab = this.Q(); m_LabelsTab.BindElements(controllerEvents, viewEvents); RegisterCallback(GeometryInitialized); } void GeometryInitialized(GeometryChangedEvent evt) { m_SplitView = this.Q(); m_SplitView.fixedPaneInitialDimension = m_SplitView.resolvedStyle.width * SpriteLibraryEditorWindow.Settings.splitPaneSize; m_SplitView.fixedPane.style.minWidth = m_SplitView.flexedPane.style.minWidth = k_MinPaneWidth; m_SplitView.flexedPane.RegisterCallback(OnSplitViewResize); UnregisterCallback(GeometryInitialized); } void OnSplitViewResize(GeometryChangedEvent evt) { m_ViewEvents.onMainUISplitPaneSizeChanged?.Invoke(1f - evt.newRect.width / m_SplitView.resolvedStyle.width); } } #if ENABLE_UXML_SERIALIZED_DATA [UxmlElement] #endif internal partial class EditorBottomToolbar : VisualElement { #if ENABLE_UXML_TRAITS public class CustomUxmlFactory : UxmlFactory { } #endif public void BindElements(ControllerEvents controllerEvents, ViewEvents viewEvents) { var listButton = this.Q