mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 22:27:45 +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;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
|
using UniverseLib;
|
||||||
using UniverseLib.Input;
|
using UniverseLib.Input;
|
||||||
|
|
||||||
namespace UnityExplorer.UI
|
namespace UnityExplorer.UI
|
||||||
@ -57,6 +59,21 @@ namespace UnityExplorer.UI
|
|||||||
}
|
}
|
||||||
canvasCamera.targetDisplay = display;
|
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);
|
Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, MinHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void EnsureValidPosition() => EnsureValidPosition(this.Rect);
|
||||||
|
|
||||||
public static void EnsureValidPosition(RectTransform panel)
|
public static void EnsureValidPosition(RectTransform panel)
|
||||||
{
|
{
|
||||||
var pos = panel.localPosition;
|
var pos = panel.localPosition;
|
||||||
|
@ -45,7 +45,7 @@ namespace UnityExplorer.UI
|
|||||||
public static Canvas UICanvas { get; private set; }
|
public static Canvas UICanvas { get; private set; }
|
||||||
|
|
||||||
internal static GameObject PanelHolder { 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 RectTransform NavBarRect;
|
||||||
public static GameObject NavbarTabButtonHolder;
|
public static GameObject NavbarTabButtonHolder;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user