Esempio n. 1
0
        protected override void OnMousePositionChanged(object sender, MousePositionChangedEventArgs e)
        {
            if (Visible)
                Position = new Vector2(e.Position.X, e.Position.Y);

            base.OnMousePositionChanged(sender, e);
        }
Esempio n. 2
0
        protected virtual void OnMousePositionChanged(object sender, MousePositionChangedEventArgs e)
        {
            if (!Enabled || Texture == null || this is Cursor)
                return; //avoid null value and cursor rendoundant event

            Rectangle textureRect = this.GetRectangle();
            Rectangle cursorRect = CurrentCursor == null ? new Rectangle(e.Position.X, e.Position.Y, 16, 16) : new Rectangle(e.Position.X, e.Position.Y, CurrentCursor.Rectangle.Width, CurrentCursor.Rectangle.Height);

            if (cursorRect.Intersects(textureRect))
            {
                if (!mouseInner)
                {
                    mouseInner = true;  //enter mouse inner gui component
                    MouseEnterEventDispatcher(EventArgs.Empty);
                }
            }
            else
            {
                if (mouseInner)
                {
                    mouseInner = false; //leave mouse outer gui component
                    MouseLeaveEventDispatcher(EventArgs.Empty);
                }
            }
        }
Esempio n. 3
0
 private void MousePositionChangedEventDispatcher(MousePositionChangedEventArgs e)
 {
     var h = PositionChanged;
     if (h != null)
         h(this, e);
 }
Esempio n. 4
0
 protected override void OnMousePositionChanged(object sender, MousePositionChangedEventArgs e)
 {
     base.OnMousePositionChanged(sender, e);
 }
Esempio n. 5
0
 protected virtual void OnMousePositionChanged(object sender, MousePositionChangedEventArgs e)
 {
     //add common logic here...
 }