Topic: Labels outside map
Hi. How can I make markers hide their labels when they are outside the map? I put a printscreen image as an attachment.
Thank you.
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Labels outside map
Hi. How can I make markers hide their labels when they are outside the map? I put a printscreen image as an attachment.
Thank you.
Hi.
Unfortunately, your post has no attachments.
The image will be very useful to understand the problem, because the labels should hide outside the map out of the box.
You are right. I uploaded it.
Now you can see the label "Player" of the marker still showing.
If I understand your screenshot correctly, you are using Show Marker Tooltip - Always, and have hidden part of the map using UI element.
You can make the map not show tooltip when the marker is under the UI element this way:
using UnityEngine;
namespace InfinityCode.OnlineMapsSupport
{
public class HideTooltipOverUI : MonoBehaviour
{
private static GUIContent content;
private OnlineMapsControlBase control;
private void OnDrawTooltip(GUIStyle style, string text, Vector2 position)
{
if (Event.current.type != EventType.Repaint) return;
if (control.IsCursorOnUIElement(position)) return;
content.text = text;
Vector2 size = style.CalcSize(content);
Rect rect = new Rect(position.x - size.x / 2 - 5, Screen.height - position.y - size.y - 20, size.x + 10, size.y + 5);
style.Draw(rect, content, false, false, false, false);
}
private void Start()
{
content = new GUIContent();
OnlineMapsGUITooltipDrawer.OnDrawTooltip += OnDrawTooltip;
control = OnlineMapsControlBase.instance;
}
}
}
Great! It worked!
Thank you.
Infinity Code Forum → Online Maps Help → Labels outside map
Powered by PunBB, supported by Informer Technologies, Inc.