1 (edited by mouta 2023-05-11 08:46:21)

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.

Post's attachments

Attachment icon ptrscr.png 215.88 kb, 22 downloads since 2023-05-11 

Re: Labels outside map

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.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Labels outside map

You are right. I uploaded it.
Now you can see the label "Player" of the marker still showing.

Re: Labels outside map

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;
        }
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Labels outside map

Great! It worked!
Thank you.