void Window_OnPressed() { if (IsDragging || IsResizing) { return; } MouseState mouseState = Mouse.GetState(); if (mouseState.LeftButton != ButtonState.Pressed) { return; } if (DragArea.Contains(mouseState.X, mouseState.Y)) { IsDragging = true; DragStart = new Point(-LocalBounds.X + mouseState.X, -LocalBounds.Y + mouseState.Y); } else if (ResizeArea.Contains(mouseState.X, mouseState.Y)) { IsResizing = true; ResizeStartSize = new Point(LocalBounds.Width, LocalBounds.Height); ResizeStartPosition = new Point(mouseState.X, mouseState.Y); } }
public override bool IsMouseOverRecursive() { MouseState mouseState = Mouse.GetState(); Rectangle expanded = GlobalBounds; expanded.Inflate(32, 32); return(this != GUI.RootComponent && IsVisible && (expanded.Contains(mouseState.X, mouseState.Y) || DragArea.Contains(mouseState.X, mouseState.Y) || ResizeArea.Contains(mouseState.X, mouseState.Y) || base.IsMouseOverRecursive())); }