public void OnBeginDrag(PointerEventData eventData)
        {
            if (!enabled)
            {
                return;
            }

            if (_canvas.scaleFactor != _scale)
            {
                _scale = _canvas.scaleFactor;
            }
            lockedaxis = "";
            vdistance  = 0;
            hdistance  = 0;

            permanentScrollUntilLimit = 0;
            GetObjects();
            _dragging = true;
            killTweens();
            lastX = eventData.position.x;
            lastY = eventData.position.y;
            scrollEvent.Invoke(scrollerName, "begin");
            if (parentScroller)
            {
                parentScroller.OnBeginDrag(eventData);
            }
        }
Exemple #2
0
 public void Update(GameTime gameTime)
 {
     _previousState = _mouseState;
     _mouseState    = Mouse.GetState();
     if (JustPressed)
     {
         OnPressedEvent?.Invoke(_mouseState, _previousState);
     }
     else if (HeldDown)
     {
         OnHeldDownEvent?.Invoke(_mouseState, _previousState);
     }
     else if (JustReleased)
     {
         OnReleaseEvent?.Invoke(_mouseState, _previousState);
     }
     if (_mouseState.ScrollWheelValue != _previousState.ScrollWheelValue)
     {
         if (OnScrollEvent != null)
         {
             var scrollBy = _mouseState.ScrollWheelValue - _previousState.ScrollWheelValue;
             OnScrollEvent.Invoke(scrollBy);
         }
     }
 }
Exemple #3
0
 public void OnScroll(InputAction.CallbackContext context)
 {
     if (context.phase == InputActionPhase.Performed)
     {
         ScrollEvent.Invoke(context.ReadValue <float>());
     }
 }
Exemple #4
0
        void Set(float input, bool sendCallback)
        {
            //If our scrollbar is full size we don't have content to scroll
            if (size == 1)
            {
                return;
            }

            float currentValue = m_Value;

            // Clamp the input
            m_Value = Mathf.Clamp01(input);

            // If the stepped value doesn't match the last one, it's time to update
            if (currentValue == value)
            {
                return;
            }

            UpdateVisuals();
            if (sendCallback)
            {
                UISystemProfilerApi.AddMarker("Scrollbar.value", this);
                m_OnValueChanged.Invoke(value);
            }
        }
Exemple #5
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == WmVscroll ||
         m.Msg == WmHscroll ||
         m.Msg == WmKeydown ||
         m.Msg == WmMousewheel)
     {
         ScrollEvent?.Invoke(this, null);
     }
     base.WndProc(ref m);
 }
Exemple #6
0
        private void Set(float input, bool sendCallback)
        {
            float value = m_Value;

            m_Value = Mathf.Clamp01(input);
            if (value != this.value)
            {
                UpdateVisuals();
                if (sendCallback)
                {
                    m_OnValueChanged.Invoke(this.value);
                }
            }
        }
Exemple #7
0
        void Set(float input, bool sendCallback)
        {
            float currentValue = m_Value;

            // Clamp the input
            m_Value = Mathf.Clamp01(input);

            // If the stepped value doesn't match the last one, it's time to update
            if (currentValue == value)
            {
                return;
            }

            UpdateVisuals();
            if (sendCallback)
            {
                m_OnValueChanged.Invoke(value);
            }
        }
        void Set(float input, bool sendCallback = true)
        {
            float currentValue = m_Value;

            // bugfix (case 802330) clamp01 input in callee before calling this function, this allows inertia from dragging content to go past extremities without being clamped
            m_Value = input;

            // If the stepped value doesn't match the last one, it's time to update
            if (currentValue == value)
            {
                return;
            }

            UpdateVisuals();
            if (sendCallback)
            {
                UISystemProfilerApi.AddMarker("Scrollbar.value", this);
                m_OnValueChanged.Invoke(value);
            }
        }
Exemple #9
0
        private void ProcessEventStuff(ScrollBar scrollBar, ScrollEventArgs e)
        {
            if (e.Type == ScrollEventType.ThumbTrack)
            {
                ScrollProgressEvent?.Invoke(this, hScrollBar1, _zoomState,
                                            new ZoomState(GraphPane, ZoomState.StateType.Scroll));
            }
            else // if ( e.Type == ScrollEventType.ThumbPosition )
            {
                if ((_zoomState != null) && _zoomState.IsChanged(GraphPane))
                {
                    //this.GraphPane.ZoomStack.Push( _zoomState );
                    ZoomStatePush(GraphPane);

                    // Provide Callback to notify the user of pan events
                    ScrollDoneEvent?.Invoke(this, hScrollBar1, _zoomState,
                                            new ZoomState(GraphPane, ZoomState.StateType.Scroll));

                    _zoomState = null;
                }
            }

            ScrollEvent?.Invoke(scrollBar, e);
        }
Exemple #10
0
 public void CallScrollEvent()
 {
     ScrollEvent?.Invoke();
 }
Exemple #11
0
        private void OnScroll()
        {
            ScrollEventArgs eventArgs = new ScrollEventArgs(mScrollingChild.CurrentPosition);

            ScrollEvent?.Invoke(this, eventArgs);
        }
 protected virtual void OnScrollEvent()
 {
     ScrollEvent?.Invoke(this, EventArgs.Empty);
 }