Esempio n. 1
0
    /* Move the list according to the dragging position and the dragging state
     */
    private void DragPositionHandler(PointerEventData pointer, TouchPhase state)
    {
        switch (state)
        {
        case TouchPhase.Began:
            break;

        case TouchPhase.Moved:
            _deltaInputPos = GetInputCanvasPosition(pointer.delta);
            // Slide the list as long as the moving distance of the pointer
            _movementCtrl.SetMovement(_deltaInputPos, true);
            break;

        case TouchPhase.Ended:
            _movementCtrl.SetMovement(_deltaInputPos / Time.deltaTime, false);
            break;
        }
    }
Esempio n. 2
0
    //dragging 위치 및 dragging 상태에 따라 목록 이동
    private void DragPositionHandler(PointerEventData pointer, TouchPhase state)
    {
        switch (state)
        {
        case TouchPhase.Began:
            break;

        case TouchPhase.Moved:
            _deltaInputPos = GetInputCanvasPosition(pointer.delta);
            // 포인터의 이동 거리만큼 목록을 밀어넣음
            _movementCtrl.SetMovement(_deltaInputPos, true);
            break;

        case TouchPhase.Ended:
            _movementCtrl.SetMovement(_deltaInputPos / Time.deltaTime, false);
            break;
        }
    }
Esempio n. 3
0
        /// <summary>
        /// Move the list according to the dragging position and the dragging state
        /// </summary>
        /// <param name="pointer">The information of the pointer</param>
        /// <param name="state">The dragging state</param>
        private void DragPositionHandler(PointerEventData pointer, TouchPhase state)
        {
            switch (state)
            {
            case TouchPhase.Began:
                _lastInputLocalPos = ScreenToLocalPos(pointer.position);
                break;

            case TouchPhase.Moved:
                _deltaInputDistance =
                    GetDeltaInputDistance(ScreenToLocalPos(pointer.position));
                // Slide the list as long as the moving distance of the pointer
                _movementCtrl.SetMovement(_deltaInputDistance, true);
                break;

            case TouchPhase.Ended:
                var deltaTime = Time.realtimeSinceStartup - _lastDraggingTime;
                _movementCtrl.SetMovement(_deltaInputDistance / deltaTime, false);
                _isEndingMovement = true;
                break;
            }

            _lastDraggingTime = Time.realtimeSinceStartup;
        }