Exemple #1
0
    public virtual void OnBeginDrag(PointerEventData eventData)
    {
        base.OnBeginDrag(eventData);
        _state = STATE.Down;

        var contentPosition = content.anchoredPosition;

        if (contentPosition.magnitude > _mRadius)
        {
            contentPosition = contentPosition.normalized * _mRadius;
            SetContentAnchoredPosition(contentPosition);
        }
        //pos = contentPosition/_mRadius;

        pos = contentPosition.normalized;
    }
Exemple #2
0
    public override void OnDrag(PointerEventData eventData)
    {
        base.OnDrag(eventData);

        var contentPosition = content.anchoredPosition;

        if (contentPosition.magnitude > _mRadius)
        {
            contentPosition = contentPosition.normalized * _mRadius;
            SetContentAnchoredPosition(contentPosition);
        }
        pos = contentPosition.normalized;
        //pos = contentPosition/_mRadius;
        if (_state == STATE.NONE)
        {
            _state = STATE.Down;
        }
        else
        {
            _state = STATE.DRAG;
        }
        //_state = STATE.DRAG;
    }
Exemple #3
0
 public override void OnEndDrag(PointerEventData eventData)
 {
     base.OnEndDrag(eventData);
     pos    = Vector2.zero;
     _state = STATE.Up;
 }