mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2024-12-23 01:59:40 +08:00
Fix panel draggers on display change
This commit is contained in:
parent
91bb58b020
commit
589abe6193
@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityExplorer.Config;
|
||||
using UniverseLib;
|
||||
using UniverseLib.Input;
|
||||
|
||||
namespace UnityExplorer.UI
|
||||
@ -57,6 +59,21 @@ namespace UnityExplorer.UI
|
||||
}
|
||||
canvasCamera.targetDisplay = display;
|
||||
}
|
||||
|
||||
RuntimeProvider.Instance.StartCoroutine(FixPanels());
|
||||
}
|
||||
|
||||
private static IEnumerator FixPanels()
|
||||
{
|
||||
yield return null;
|
||||
yield return null;
|
||||
|
||||
foreach (var panel in UIManager.UIPanels.Values)
|
||||
{
|
||||
panel.EnsureValidSize();
|
||||
panel.EnsureValidPosition();
|
||||
panel.Dragger.OnEndResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,8 @@ namespace UnityExplorer.UI.Panels
|
||||
Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, MinHeight);
|
||||
}
|
||||
|
||||
public void EnsureValidPosition() => EnsureValidPosition(this.Rect);
|
||||
|
||||
public static void EnsureValidPosition(RectTransform panel)
|
||||
{
|
||||
var pos = panel.localPosition;
|
||||
|
@ -45,7 +45,7 @@ namespace UnityExplorer.UI
|
||||
public static Canvas UICanvas { get; private set; }
|
||||
|
||||
internal static GameObject PanelHolder { get; private set; }
|
||||
private static readonly Dictionary<Panels, UIPanel> UIPanels = new();
|
||||
internal static readonly Dictionary<Panels, UIPanel> UIPanels = new();
|
||||
|
||||
public static RectTransform NavBarRect;
|
||||
public static GameObject NavbarTabButtonHolder;
|
||||
|
Loading…
Reference in New Issue
Block a user