Пример #1
0
        public void OnPointerClick(PointerEventData dat)
        {
            Vector2 localCursor;
            Vector2 pos = dat.position;

            if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rt, pos, null, out localCursor))
            {
                return;
            }

            localCursor.x -= rt.rect.xMin;
            localCursor.y -= rt.rect.yMin;

            localCursor.x /= rt.rect.width;
            localCursor.y /= rt.rect.height;

            Vector2 latlon = Conversion.GetLatLonFromUV(localCursor);

            if (customZoomLevel && customDuration)
            {
                map.FlyToLocation(latlon, duration, zoomLevel);
            }
            else if (customZoomLevel)
            {
                map.FlyToLocation(latlon, map.navigationTime, zoomLevel);
            }
            else if (customDuration)
            {
                map.FlyToLocation(latlon, duration);
            }
            else
            {
                map.FlyToLocation(latlon);
            }
        }