Fix BackgroundWidget eating input outside its bounds.

This commit is contained in:
Paul Chote
2013-07-11 19:19:02 +12:00
parent 045eb12388
commit a783321c03

View File

@@ -30,8 +30,12 @@ namespace OpenRA.Widgets
public override bool HandleMouseInput(MouseInput mi) public override bool HandleMouseInput(MouseInput mi)
{ {
if (ClickThrough) return false; if (ClickThrough || !Bounds.Contains(mi.Location))
if (!Draggable || moving && (!TakeFocus(mi) || mi.Button != MouseButton.Left)) return true; return false;
if (!Draggable || moving && (!TakeFocus(mi) || mi.Button != MouseButton.Left))
return true;
if (prevMouseLocation == null) if (prevMouseLocation == null)
prevMouseLocation = mi.Location; prevMouseLocation = mi.Location;
var vec = mi.Location - (int2)prevMouseLocation; var vec = mi.Location - (int2)prevMouseLocation;
@@ -51,6 +55,7 @@ namespace OpenRA.Widgets
Bounds = new Rectangle(Bounds.X + vec.X, Bounds.Y + vec.Y, Bounds.Width, Bounds.Height); Bounds = new Rectangle(Bounds.X + vec.X, Bounds.Y + vec.Y, Bounds.Width, Bounds.Height);
break; break;
} }
return true; return true;
} }