Topic: Right Click Function for Marker or Drawing??
Is there a right click function for marker or Drawing???
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Right Click Function for Marker or Drawing??
Is there a right click function for marker or Drawing???
Hello.
Good question. I never thought about it.
Something like that:
using UnityEngine;
namespace InfinityCode.OnlineMapsSupport
{
public class RightClickOnInteractiveElement : MonoBehaviour
{
private bool isRightPressed = false;
private IOnlineMapsInteractiveElement pressedElement;
private void OnRightClick(IOnlineMapsInteractiveElement element)
{
Debug.Log("OnRightClick");
}
private void OnRightPress(IOnlineMapsInteractiveElement element)
{
Debug.Log("OnRightPress");
}
private void OnRightRelease(IOnlineMapsInteractiveElement element)
{
Debug.Log("OnRightRelease");
}
private void Update()
{
bool rightPresses = Input.GetMouseButton(1);
if (rightPresses == isRightPressed) return;
isRightPressed = rightPresses;
Vector2 inputPosition = OnlineMapsControlBase.instance.GetInputPosition();
IOnlineMapsInteractiveElement element = OnlineMapsControlBase.instance.GetInteractiveElement(inputPosition);
if (element == null) return;
if (rightPresses)
{
pressedElement = element;
OnRightPress(element);
}
else
{
OnRightRelease(element);
if (pressedElement == element) OnRightClick(element);
pressedElement = null;
}
}
}
}
Infinity Code Forum → Online Maps Help → Right Click Function for Marker or Drawing??
Powered by PunBB, supported by Informer Technologies, Inc.