<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — UI marker labels]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2338&amp;type=atom" />
	<updated>2025-02-22T19:02:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2338</id>
		<entry>
			<title type="html"><![CDATA[Re: UI marker labels]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9766#p9766" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[savvas_6]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1113</uri>
			</author>
			<updated>2025-02-22T19:02:57Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9766#p9766</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: UI marker labels]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9757#p9757" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2025-02-09T16:39:18Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9757#p9757</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[UI marker labels]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9756#p9756" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[savvas_6]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1113</uri>
			</author>
			<updated>2025-02-08T07:17:03Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9756#p9756</id>
		</entry>
</feed>
