Fix showing tooltips for tree nodes in Editor
This commit is contained in:
@@ -148,7 +148,6 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
else if (Parent is Tree tree)
|
else if (Parent is Tree tree)
|
||||||
_tree = tree;
|
_tree = tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _tree;
|
return _tree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,12 +612,6 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
{
|
{
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Manually update tooltip
|
|
||||||
if (TooltipText != null && IsMouseOver)
|
|
||||||
Tooltip.OnMouseOverControl(this, deltaTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -1006,6 +999,21 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
base.OnDragLeave();
|
base.OnDragLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool OnTestTooltipOverControl(ref Vector2 location)
|
||||||
|
{
|
||||||
|
return TestHeaderHit(ref location) && ShowTooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool OnShowTooltip(out string text, out Vector2 location, out Rectangle area)
|
||||||
|
{
|
||||||
|
text = TooltipText;
|
||||||
|
location = _headerRect.Size * new Vector2(0.5f, 1.0f);
|
||||||
|
area = new Rectangle(Vector2.Zero, _headerRect.Size);
|
||||||
|
return ShowTooltip;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OnSizeChanged()
|
protected override void OnSizeChanged()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ namespace FlaxEngine.GUI
|
|||||||
_isMouseOver = true;
|
_isMouseOver = true;
|
||||||
|
|
||||||
// Update tooltip
|
// Update tooltip
|
||||||
if (ShowTooltip)
|
if (ShowTooltip && OnTestTooltipOverControl(ref location))
|
||||||
{
|
{
|
||||||
Tooltip.OnMouseEnterControl(this);
|
Tooltip.OnMouseEnterControl(this);
|
||||||
SetUpdate(ref _tooltipUpdate, OnUpdateTooltip);
|
SetUpdate(ref _tooltipUpdate, OnUpdateTooltip);
|
||||||
@@ -608,12 +608,20 @@ namespace FlaxEngine.GUI
|
|||||||
public virtual void OnMouseMove(Vector2 location)
|
public virtual void OnMouseMove(Vector2 location)
|
||||||
{
|
{
|
||||||
// Update tooltip
|
// Update tooltip
|
||||||
if (_tooltipUpdate == null && ShowTooltip)
|
if (ShowTooltip && OnTestTooltipOverControl(ref location))
|
||||||
|
{
|
||||||
|
if (_tooltipUpdate == null)
|
||||||
{
|
{
|
||||||
Tooltip.OnMouseEnterControl(this);
|
Tooltip.OnMouseEnterControl(this);
|
||||||
SetUpdate(ref _tooltipUpdate, OnUpdateTooltip);
|
SetUpdate(ref _tooltipUpdate, OnUpdateTooltip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_tooltipUpdate != null)
|
||||||
|
{
|
||||||
|
SetUpdate(ref _tooltipUpdate, null);
|
||||||
|
Tooltip.OnMouseLeaveControl(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When mouse leaves control's area
|
/// When mouse leaves control's area
|
||||||
|
|||||||
Reference in New Issue
Block a user