Example #1
0
        private void UpdateZoom()
        {
            if (!isAnim)
            {
                map.OnMapUpdated -= UpdateZoom;
                return;
            }

            progress      += (Time.time - lastUpdateTime) / duration;
            lastUpdateTime = Time.time;

            if (progress >= 1)
            {
                progress          = 1;
                isAnim            = false;
                map.OnMapUpdated -= UpdateZoom;
            }

            float z = Mathf.Lerp(fromZoom, toZoom, progress);

            if (control.zoomMode == OnlineMapsZoomMode.center)
            {
                map.floatZoom = z;
            }
            else
            {
                control.ZoomOnPoint(z - map.floatZoom, inputPosition);
            }
            map.Redraw();
        }
Example #2
0
        private void Update()
        {
            if (!isAnim)
            {
                return;
            }

            progress += Time.deltaTime / duration;
            if (progress >= 1)
            {
                progress = 1;
                isAnim   = false;
            }

            float z = Mathf.Lerp(fromZoom, toZoom, progress);

            if (control.zoomMode == OnlineMapsZoomMode.center)
            {
                map.floatZoom = z;
            }
            else
            {
                control.ZoomOnPoint(z - map.floatZoom, inputPosition);
            }
        }
Example #3
0
    private void EasyTouchOnOnPinch(Gesture gesture)
    {
        control.isMapDrag = false;
        float delta = gesture.deltaPinch / 100;

        if (control.zoomMode == OnlineMapsZoomMode.center)
        {
            OnlineMaps.instance.floatZoom += delta;
        }
        else
        {
            control.ZoomOnPoint(delta, gesture.position);
        }
    }
Example #4
0
    private void GestureOnTransformed(object sender, EventArgs eventArgs)
    {
        if (gesture.NumPointers != 2)
        {
            return;
        }
        control.isMapDrag = false;
        float deltaScale = gesture.DeltaScale - 1;

        if (control.zoomMode == OnlineMapsZoomMode.center)
        {
            control.map.floatZoom += deltaScale * control.zoomSensitivity;
        }
        else
        {
            control.ZoomOnPoint(deltaScale * control.zoomSensitivity, gesture.ScreenPosition);
        }

        if (rotationMode == RotationMode.camera)
        {
            if (cameraOrbit != null)
            {
                if (!cameraOrbit.lockTilt)
                {
                    cameraOrbit.rotation.x += gesture.DeltaPosition.y * speed.x;
                }
                if (!cameraOrbit.lockPan)
                {
                    cameraOrbit.rotation.y += gesture.DeltaRotation * speed.y;
                }
            }
        }
        else if (dmControl != null)
        {
            RotateMap(gesture);
        }
    }
Example #5
0
    private void GestureOnTransformed(object sender, EventArgs eventArgs)
    {
        if (gesture.NumPointers != 2)
        {
            return;
        }
        control.isMapDrag = false;
        float deltaScale = gesture.DeltaScale - 1;

        if (control.zoomMode == OnlineMapsZoomMode.center)
        {
            OnlineMaps.instance.floatZoom += deltaScale;
        }
        else
        {
            control.ZoomOnPoint(deltaScale, gesture.ScreenPosition);
        }

        if (cameraOrbit != null)
        {
            cameraOrbit.rotation.x += gesture.DeltaPosition.y * speed.x;
            cameraOrbit.rotation.y += gesture.DeltaRotation * speed.y;
        }
    }