Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        Dragging      = false;
        rectTransform = transform.Find("DummyItem").transform as RectTransform;
        fingerScript  = gameObject.GetComponent <FingersScript>();

        //CreateTapGesture();
        //CreateDoubleTapGesture();
        //CreateSwipeGesture();
        //CreatePanGesture();
        CreateScaleGesture();
        CreateRotateGesture();
        //CreateLongPressGesture();

        //tapGesture.RequireGestureRecognizerToFail = doubleTapGesture;

        // Pan rotate and scale can happen simultaneously.
        //panGesture.AllowSimultaneousExecution(scaleGesture);
        //panGesture.AllowSimultaneousExecution(rotateGesture);
        scaleGesture.AllowSimultaneousExecution(rotateGesture);
    }
Esempio n. 2
0
    void Start()
    {
        CreateDoubleTapGesture();
        CreateTapGesture();
        CreateSwipeGesture();
        CreatePanGesture();
        CreateScaleGesture();
        CreateRotateGesture();
        CreateLongPressGesture();

        // pan, scale and rotate can all happen simultaneously
        panGesture.AllowSimultaneousExecution(scaleGesture);
        panGesture.AllowSimultaneousExecution(rotateGesture);
        scaleGesture.AllowSimultaneousExecution(rotateGesture);

        // prevent the one special no-pass button from passing through,
        //  even though the parent scroll view allows pass through (see FingerScript.PassThroughObjects)
        FingersScript.Instance.CaptureGestureHandler = CaptureGestureHandler;

        // show touches, only do this for debugging as it can interfere with other canvases
        FingersScript.Instance.ShowTouches = true;
    }
Esempio n. 3
0
    private void Start()
    {
        Cam.transform.position = DefaultFocusPoint;

        Cam.GetComponent <CinemachineVirtualCamera>().m_Lens.OrthographicSize = DefaultZoom;

        scaleGesture = new ScaleGestureRecognizer
        {
            ZoomSpeed = 1.0f // for a touch screen you'd probably not do this, but if you are using ctrl + mouse wheel then this helps zoom faster
        };
        scaleGesture.StateUpdated += Gesture_Updated;
        FingersScript.Instance.AddGesture(scaleGesture);

        panGesture = new PanGestureRecognizer();
        panGesture.StateUpdated += PanGesture_Updated;
        FingersScript.Instance.AddGesture(panGesture);

        // the scale and pan can happen together
        scaleGesture.AllowSimultaneousExecution(panGesture);

        tapGesture = new TapGestureRecognizer();
        tapGesture.StateUpdated += TapGesture_Updated;
        FingersScript.Instance.AddGesture(tapGesture);
    }