Esempio n. 1
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region Methods
        //---------------------------------------------------------------
        /// <summary>
        /// Method that handles mouse events.
        /// </summary>
        /// <param name="position">The current position of the mouse.</param>
        /// <param name="button">The button that is pressed or released.</param>
        /// <param name="pressed">Flag that indicates if button is pressed or released.</param>
        public override bool OnMouse(Vector3 position, MouseButton button, bool pressed)
        {
            ButtonState newState = logic.Update(this, position, button, pressed);

            UpdateState(newState);
            return(false);
        }
Esempio n. 2
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region Methods
        //---------------------------------------------------------------
        /// <summary>
        /// Method that handles mouse events.
        /// </summary>
        /// <param name="position">The current position of the mouse.</param>
        /// <param name="button">The button that is pressed or released.</param>
        /// <param name="pressed">Flag that indicates if button is pressed or released.</param>
        /// <returns>True if the key was handled and shouldn't be passed on to the underlaying elements.</returns>
        public override bool OnMouse(Vector3 position, MouseButton button, bool pressed)
        {
            ButtonState newState = buttonLogic.Update(this, position, button, pressed);

            UpdateState(newState);
            if (newState == ButtonState.Pressed || newState == ButtonState.PressedHover)
            {
                Vector2 p      = this.InverseTransform(position.Vector2);
                float   newVal = this.Total * p.X;
                if (Current != newVal)
                {
                    Current = newVal;
                    if (this.Changed != null)
                    {
                        Changed(this);
                    }
                }
            }
            return(false);
        }