Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: zippo227 on November 04, 2014, 09:25:58 PM

Title: Can I change the tooltip's pivot to make sure it is on screen?
Post by: zippo227 on November 04, 2014, 09:25:58 PM
I have been thinking about this for awhile and was under the assumption that I just didn't know what I was talking about. The more I search though, the more I realize this might not exist.

I have a button on the bottom left of the screen that I want to put a tooltip on. Naturally, I would like for this button to produce a tooltip which has the anchor/pivot (whatever it needs to be) at the bottom left of itself. Then the tooltip will show up on screen. Is this something I'll need to write myself?
Title: Re: Can I change the tooltip's pivot to make sure it is on screen?
Post by: zippo227 on November 05, 2014, 06:43:20 PM
Bump. Any comments welcome.  :o
Title: Re: Can I change the tooltip's pivot to make sure it is on screen?
Post by: zippo227 on November 06, 2014, 12:02:01 AM
Based on the post here http://www.tasharen.com/forum/index.php?topic=8976.msg42368#msg42368 (http://www.tasharen.com/forum/index.php?topic=8976.msg42368#msg42368), I was able to determine that the author already has in place a method for making sure the tooltips are on screen. However, there is not any mention that the pivot points of the tooltip's label and background should be one of the corners. I'm now making their pivot point the top left, and they are always on screen. That was a lot of headache for something so easy.

As an aside here is my class that I place on objects to use the tooltip.

  1. public class HoverTooltip : MonoBehaviour
  2. {
  3.     public string mTooltipText;
  4.  
  5.     void OnTooltip(bool show)
  6.     {
  7.         if(show == true)
  8.         {
  9.             UITooltip.Show(mTooltipText);
  10.         }
  11.         else
  12.         {
  13.             UITooltip.Show(string.Empty);
  14.         }
  15.     }
  16. }
  17.