This commit is contained in:
CortexCore
2024-07-05 15:07:38 +08:00
parent 87eae34f4b
commit b3768a7aa8
5 changed files with 36 additions and 6 deletions

View File

@@ -9,6 +9,9 @@ namespace BITKit.UX
{
public class UXToolTips : MonoBehaviour
{
[SerializeField]
[ReadOnly]
private string currentHoverName;
private VisualElement root;
private Label label;
@@ -51,10 +54,12 @@ namespace BITKit.UX
if (!EventSystem.current.IsPointerOverGameObject()) return "";
var screenPosition = Input.mousePosition;
var screenPosition = Mouse.current.position.ReadValue();
screenPosition.y = Screen.height - screenPosition.y;
VisualElement ve = panel.Pick(RuntimePanelUtils.ScreenToPanel(panel, screenPosition));
currentHoverName = ve?.name;
return ve == null ? "" : ve.tooltip;
}
}