diff --git a/Scripts/ToolTips/BoundTooltip/BoundTooltipItem.cs b/Scripts/ToolTips/BoundTooltip/BoundTooltipItem.cs
index 1f8b890..db9b093 100644
--- a/Scripts/ToolTips/BoundTooltip/BoundTooltipItem.cs
+++ b/Scripts/ToolTips/BoundTooltip/BoundTooltipItem.cs
@@ -3,7 +3,7 @@
namespace UnityEngine.UI.Extensions
{
- [AddComponentMenu("UI/Extensions/Bound Tooltip/Tooltip Item")]
+ [AddComponentMenu("UI/Extensions/Bound Tooltip/Bound Tooltip Item")]
public class BoundTooltipItem : MonoBehaviour
{
public bool IsActive
diff --git a/Scripts/ToolTips/BoundTooltip/BoundTooltipTrigger.cs b/Scripts/ToolTips/BoundTooltip/BoundTooltipTrigger.cs
index e91de24..051341e 100644
--- a/Scripts/ToolTips/BoundTooltip/BoundTooltipTrigger.cs
+++ b/Scripts/ToolTips/BoundTooltip/BoundTooltipTrigger.cs
@@ -4,7 +4,7 @@ using UnityEngine.EventSystems;
namespace UnityEngine.UI.Extensions
{
- [AddComponentMenu("UI/Extensions/Bound Tooltip/Tooltip Trigger")]
+ [AddComponentMenu("UI/Extensions/Bound Tooltip/Bound Tooltip Trigger")]
public class BoundTooltipTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler
{
[TextAreaAttribute]
diff --git a/Scripts/ToolTips/ToolTip.cs b/Scripts/ToolTips/ToolTip.cs
index e921b1c..902fcc2 100644
--- a/Scripts/ToolTips/ToolTip.cs
+++ b/Scripts/ToolTips/ToolTip.cs
@@ -1,7 +1,8 @@
/// Credit drHogan
/// Sourced from - http://forum.unity3d.com/threads/screenspace-camera-tooltip-controller-sweat-and-tears.293991/#post-1938929
/// updated ddreaper - refactored code to be more performant.
-/// *Note - only works for Screenspace Camera canvases at present, needs updating to include Screenspace and Worldspace!
+/// updated lucasvinbr - mixed with BoundTooltip, should work with Screenspace Camera (non-rotated) and Overlay
+/// *Note - only works for non-rotated Screenspace Camera and Screenspace Overlay canvases at present, needs updating to include rotated Screenspace Camera and Worldspace!
//ToolTip is written by Emiliano Pastorelli, H&R Tallinn (Estonia), http://www.hammerandravens.com
//Copyright (c) 2015 Emiliano Pastorelli, H&R - Hammer&Ravens, Tallinn, Estonia.
@@ -22,145 +23,293 @@
namespace UnityEngine.UI.Extensions
{
[RequireComponent(typeof(RectTransform))]
- [AddComponentMenu("UI/Extensions/Tooltip")]
+ [AddComponentMenu("UI/Extensions/Tooltip/Tooltip")]
public class ToolTip : MonoBehaviour
{
//text of the tooltip
private Text _text;
- private RectTransform _rectTransform;
+ private RectTransform _rectTransform, canvasRectTransform;
+
+ [Tooltip("The canvas used by the tooltip as positioning and scaling reference. Should usually be the root Canvas of the hierarchy this component is in")]
+ public Canvas canvas;
+
+ [Tooltip("Sets if tooltip triggers will run ForceUpdateCanvases and refresh the tooltip's layout group " +
+ "(if any) when hovered, in order to prevent momentaneous misplacement sometimes caused by ContentSizeFitters")]
+ public bool tooltipTriggersCanForceCanvasUpdate = false;
+
+ ///
+ /// the tooltip's Layout Group, if any
+ ///
+ private LayoutGroup _layoutGroup;
//if the tooltip is inside a UI element
private bool _inside;
- // private bool _xShifted, _yShifted = false;
-
private float width, height;//, canvasWidth, canvasHeight;
- // private int screenWidth, screenHeight;
+ public float YShift,xShift;
- private float YShift,xShift;
-
- private RenderMode _guiMode;
+ [HideInInspector]
+ public RenderMode guiMode;
private Camera _guiCamera;
- // Use this for initialization
- public void Awake()
- {
- var _canvas = GetComponentInParent