1
This commit is contained in:
@@ -10,6 +10,8 @@ namespace BITKit.UX
|
||||
{
|
||||
public class UXToolTips:IDisposable
|
||||
{
|
||||
public static VisualElement Hovering;
|
||||
|
||||
private readonly IUXService _uxService;
|
||||
private readonly IMainTicker _ticker;
|
||||
|
||||
@@ -40,7 +42,12 @@ namespace BITKit.UX
|
||||
|
||||
|
||||
}
|
||||
if(_label is null || _rootVisualElement is null)return;
|
||||
|
||||
if (_label is null || _rootVisualElement is null)
|
||||
{
|
||||
Hovering = null;
|
||||
return;
|
||||
}
|
||||
var tooltip = CurrentToolTip(_rootVisualElement.panel);
|
||||
if (tooltip != "")
|
||||
{
|
||||
@@ -71,12 +78,18 @@ namespace BITKit.UX
|
||||
{
|
||||
// https://docs.unity3d.com/2022.2/Documentation/Manual/UIE-faq-event-and-input-system.html
|
||||
|
||||
if (!EventSystem.current.IsPointerOverGameObject()) return "";
|
||||
if (!EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
Hovering = null;
|
||||
return "";
|
||||
}
|
||||
|
||||
var screenPosition = Mouse.current.position.ReadValue();
|
||||
screenPosition.y = Screen.height - screenPosition.y;
|
||||
|
||||
VisualElement ve = panel.Pick(RuntimePanelUtils.ScreenToPanel(panel, screenPosition));
|
||||
|
||||
Hovering = ve;
|
||||
|
||||
return ve == null ? "" : ve.tooltip;
|
||||
}
|
||||
|
Reference in New Issue
Block a user