/// <summary> /// Method that is called when you press the map. /// </summary> protected void OnMapBasePress() { isMapPress = false; lockClick = false; if (waitZeroTouches) { if (GetTouchCount() <= 1) { waitZeroTouches = false; } else { return; } } dragMarker = null; if (!HitTest()) { return; } Vector2 inputPosition = GetInputPosition(); if (IsCursorOnUIElement(inputPosition)) { return; } if (OnMapPress != null) { OnMapPress(); } lastClickTimes[0] = lastClickTimes[1]; lastClickTimes[1] = DateTime.Now.Ticks; bool hit = GetCoords(out lastPositionLng, out lastPositionLat); lastInputPosition = pressPoint = inputPosition; if (!hit) { return; } isMapPress = true; OnlineMapsMarkerBase marker = null; OnlineMapsDrawingElement drawingElement = null; IOnlineMapsInteractiveElement interactiveElement = GetInteractiveElement(inputPosition); if (interactiveElement != null) { if (interactiveElement is OnlineMapsMarkerBase) { marker = interactiveElement as OnlineMapsMarkerBase; } else if (interactiveElement is OnlineMapsDrawingElement) { drawingElement = interactiveElement as OnlineMapsDrawingElement; } } if (marker != null) { if (marker.OnPress != null) { marker.OnPress(marker); } if (map.showMarkerTooltip == OnlineMapsShowMarkerTooltip.onPress) { OnlineMapsTooltipDrawerBase.tooltipMarker = marker; OnlineMapsTooltipDrawerBase.tooltip = marker.label; } if (Input.GetKey(KeyCode.LeftControl)) { dragMarker = marker; } } else if (drawingElement != null) { if (drawingElement.OnPress != null) { drawingElement.OnPress(drawingElement); } if (map.showMarkerTooltip == OnlineMapsShowMarkerTooltip.onPress) { OnlineMapsTooltipDrawerBase.tooltipDrawingElement = drawingElement; OnlineMapsTooltipDrawerBase.tooltip = drawingElement.tooltip; } } if (dragMarker == null) { isMapDrag = true; } activeElement = interactiveElement; longPressEnumenator = WaitLongPress(); StartCoroutine(longPressEnumenator); if (allowUserControl) { OnlineMaps.isUserControl = true; } }
/// <summary> /// Method that is called when you press the map. /// </summary> protected void OnMapBasePress() { isMapPress = false; lockClick = false; if (waitZeroTouches) { if (GetTouchCount() <= 1) { waitZeroTouches = false; } else { return; } } dragMarker = null; if (!HitTest()) { return; } #if !IGUI && ((!UNITY_ANDROID && !UNITY_IOS) || UNITY_EDITOR) if (map.notInteractUnderGUI && GUIUtility.hotControl != 0) { return; } #endif Vector2 inputPosition = GetInputPosition(); if (EventSystem.current != null) { PointerEventData pe = new PointerEventData(EventSystem.current); pe.position = inputPosition; List <RaycastResult> hits = new List <RaycastResult>(); EventSystem.current.RaycastAll(pe, hits); if (hits.Count > 0 && hits[0].gameObject != gameObject) { return; } } if (OnMapPress != null) { OnMapPress(); } lastClickTimes[0] = lastClickTimes[1]; lastClickTimes[1] = DateTime.Now.Ticks; bool hit = GetCoords(out lastPositionLng, out lastPositionLat); lastInputPosition = pressPoint = inputPosition; if (!hit) { return; } isMapPress = true; OnlineMapsMarkerBase marker = null; OnlineMapsDrawingElement drawingElement = null; IOnlineMapsInteractiveElement interactiveElement = GetInteractiveElement(inputPosition); if (interactiveElement != null) { if (interactiveElement is OnlineMapsMarkerBase) { marker = interactiveElement as OnlineMapsMarkerBase; } else if (interactiveElement is OnlineMapsDrawingElement) { drawingElement = interactiveElement as OnlineMapsDrawingElement; } } if (marker != null) { if (marker.OnPress != null) { marker.OnPress(marker); } if (map.showMarkerTooltip == OnlineMapsShowMarkerTooltip.onPress) { map.tooltipMarker = marker; map.tooltip = marker.label; } if (Input.GetKey(KeyCode.LeftControl)) { dragMarker = marker; } } else if (drawingElement != null) { if (drawingElement.OnPress != null) { drawingElement.OnPress(drawingElement); } if (map.showMarkerTooltip == OnlineMapsShowMarkerTooltip.onPress) { map.tooltipDrawingElement = drawingElement; map.tooltip = drawingElement.tooltip; } } if (dragMarker == null) { isMapDrag = true; } longPressEnumenator = WaitLongPress(); StartCoroutine(longPressEnumenator); activeElement = interactiveElement; if (allowUserControl) { OnlineMaps.isUserControl = true; } }