<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — How to make tooltip always display on screen and follow marker]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=496&amp;type=atom" />
	<updated>2017-04-20T09:26:11Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=496</id>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2255#p2255" />
			<content type="html"><![CDATA[<p>Thanks for the script. Now this is much clearer to me.</p><p>1. In this case, using OnDrawTooltip is very expensive. <br />This action will be called every frame, for each visible marker.<br />Subscribe to OnlineMaps.OnMapUpdated, and update the tooltips only when the map is updated.<br />Something like:<br /></p><div class="codebox"><pre><code>private void Start() {
...
    map.OnMapUpdated += OnMapUpdated;
...
}

private void OnMapUpdated()
{
   foreach (OnlineMapsMarker marker in map.markers) DrawToolTipForMarker(marker);
}

private void DrawToolTipForMarker(OnlineMapsMarker marker)
{
    TooltipData tdata = marker.customData as TooltipData;
    if (marker.inMapView)
    {
        if (tdata == null)
        {
            // Create tooltip
        }
        // Update tooltip
    }
    else if (tdata != null)
    {
        // Destroy tooltip
    }
}

public class TooltipData 
{
    public GameObject instance;
    public UIWidget widget;
    ...
    // Any other data you need
}</code></pre></div><p>2. You can store all the tooltip data in marker.customData.<br />3. If the marker is not on the screen, you need to destroy the tooltip.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-04-20T09:26:11Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2255#p2255</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2253#p2253" />
			<content type="html"><![CDATA[<p>Yeah but I used the OnUpdateLate() only. This is my script:</p>]]></content>
			<author>
				<name><![CDATA[anhdung.bka317]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=410</uri>
			</author>
			<updated>2017-04-20T03:29:17Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2253#p2253</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2250#p2250" />
			<content type="html"><![CDATA[<p>You wrote that draw tooltips using NGUI, right?!<br />If so, you need to modify NGUICustomTooltipExample.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-04-19T20:03:27Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2250#p2250</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2248#p2248" />
			<content type="html"><![CDATA[<p>You mean modify OnlineMapsMarkerBase?</p>]]></content>
			<author>
				<name><![CDATA[anhdung.bka317]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=410</uri>
			</author>
			<updated>2017-04-19T07:43:03Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2248#p2248</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2246#p2246" />
			<content type="html"><![CDATA[<p>If you draw tooltips using NGUI, you do not need to use OnMarkerDrawTooltip.<br />You need to modify this script a bit, so that it draws tooltips for all markers.<br />It&#039;s very easy. If you&#039;ll have problems with modifying the script, write to me, and I&#039;ll modify this script for you.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-04-18T22:53:34Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2246#p2246</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2244#p2244" />
			<content type="html"><![CDATA[<p>I&#039;m drawing it with nGUI.<br />I just afraid this action would affect my app&#039;s performance when it has many tooltips.<br />I expect that this action is called when I change position the map or I zoom.</p>]]></content>
			<author>
				<name><![CDATA[anhdung.bka317]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=410</uri>
			</author>
			<updated>2017-04-18T03:35:24Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2244#p2244</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2233#p2233" />
			<content type="html"><![CDATA[<p>This action is invoked for each visible marker for which you need to draw a tooltip.<br />Did you expect any other behavior for this action?</p><p>The built-in tooltips are drawn using the old GUI system.<br />If you want to draw this with uGUI, you can change this.<br />Examples:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/uGUICustomTooltipForAllMarkersExample.html">http://infinity-code.com/atlas/online-m … ample.html</a><br /><a href="http://forum.infinity-code.com/viewtopic.php?pid=1615#p1615">http://forum.infinity-code.com/viewtopi … 1615#p1615</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-04-14T13:50:08Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2233#p2233</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2228#p2228" />
			<content type="html"><![CDATA[<p>Thanks for your help,<br />But I have one more question.<br />I used OnDrawTooltip() and it have been called a lot of times.<br />I afraid that it could affect performance.<br />Do you have any solution to call draw tooltip when I change position of map or change zoom?</p>]]></content>
			<author>
				<name><![CDATA[anhdung.bka317]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=410</uri>
			</author>
			<updated>2017-04-14T04:40:24Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2228#p2228</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2177#p2177" />
			<content type="html"><![CDATA[<p>Hello.</p><p>To always show tooltips use «Online Maps / Advanced / Show Marker Tooltip - Always».<br />To change the location of the tooltips, use OnlineMapsMarkerBase.OnMarkerDrawTooltip.<br />Example:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/OnDrawTooltipExample.html">http://infinity-code.com/atlas/online-m … ample.html</a><br />Using this action, you can make almost any behavior of tooltips.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-04-12T11:39:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2177#p2177</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to make tooltip always display on screen and follow marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2172#p2172" />
			<content type="html"><![CDATA[<p>Hi,<br />I am trying to make some tooltips and I want them to always display when I create them.<br />And I want them to follow their marker when I move the map.<br />I make it with NGUI<br />Is possible to do that?<br />Thanks!</p>]]></content>
			<author>
				<name><![CDATA[anhdung.bka317]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=410</uri>
			</author>
			<updated>2017-04-11T15:37:36Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2172#p2172</id>
		</entry>
</feed>
