<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — UI marker labels]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=2338</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2338&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in UI marker labels.]]></description>
		<lastBuildDate>Sat, 22 Feb 2025 19:02:57 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: UI marker labels]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9766#p9766</link>
			<description><![CDATA[<p>As you suggested, I modify this part of the code and solve my problem. <br />Thank you Alex.</p><div class="codebox"><pre><code>              
                // Adjust for the scaled height of the marker
                float scaledHeight = tooltipMarker.height * tooltipMarker.scale;
                screenPosition.y += scaledHeight;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (savvas_6)]]></author>
			<pubDate>Sat, 22 Feb 2025 19:02:57 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9766#p9766</guid>
		</item>
		<item>
			<title><![CDATA[Re: UI marker labels]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9757#p9757</link>
			<description><![CDATA[<p>Hi.</p><p>Most likely your problem is that you are not using the scale of the markers when calculating the tooltip position.</p><p>If the problem persists:<br />Unfortunately, in this case it is difficult for me to understand what exactly is wrong in your case.<br />If possible send me your project via email or DM in discord. I will check and tell you exactly what is wrong.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Sun, 09 Feb 2025 16:39:18 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9757#p9757</guid>
		</item>
		<item>
			<title><![CDATA[UI marker labels]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9756#p9756</link>
			<description><![CDATA[<p>Hi, I use the following code to position labels above my markers.</p><p>I also have an option for the users to scale the markers to be bigger or smaller to the map.</p><p>I realise that when I run on standalone of device with different aspect ratio, the labels are not right above the marker. Some times labels are very far up from the markers.</p><p>How to deal with different marker scales and different screen ratio to display correctly all marker labels right above the marker?</p><p>Here is the code:</p><div class="codebox"><pre><code>private void OnUpdateLate()
        {
            OnlineMapsMarker tooltipMarker = OnlineMapsTooltipDrawerBase.tooltipMarker as OnlineMapsMarker;
            if (tooltipMarker != null)
            {
                if (tooltip == null)
                {
                    tooltip = Instantiate(tooltipPrefab) as GameObject;
                    (tooltip.transform as RectTransform).SetParent(container.transform);
                }
                Vector2 screenPosition = OnlineMapsControlBase.instance.GetScreenPosition(tooltipMarker.position);
                screenPosition.y += tooltipMarker.height;
                Vector2 point;
                Camera cam = container.renderMode == RenderMode.ScreenSpaceOverlay ? null : container.worldCamera;
                RectTransformUtility.ScreenPointToLocalPointInRectangle(container.transform as RectTransform, screenPosition, cam, out point);
                (tooltip.transform as RectTransform).localPosition = point;
                tooltip.GetComponentInChildren&lt;Text&gt;().text = tooltipMarker.label;

            }
            else
            {
                OnlineMapsUtils.Destroy(tooltip);
                tooltip = null;
            }
        }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (savvas_6)]]></author>
			<pubDate>Sat, 08 Feb 2025 07:17:03 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9756#p9756</guid>
		</item>
	</channel>
</rss>
