Remove OnMouseDown from Widget. Define it on just the widgets that want it.
This commit is contained in:
@@ -20,6 +20,8 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
public Func<Map> Map = () => null;
|
||||
public Func<Dictionary<int2, Color>> SpawnColors = () => new Dictionary<int2, Color>();
|
||||
public Action<MouseInput> OnMouseDown = _ => {};
|
||||
|
||||
Cache<Map,Bitmap> PreviewCache = new Cache<Map, Bitmap>(stub => Minimap.RenderMapPreview( new Map( stub.Path )));
|
||||
|
||||
public MapPreviewWidget() : base() { }
|
||||
@@ -32,6 +34,15 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
public override Widget Clone() { return new MapPreviewWidget(this); }
|
||||
|
||||
public override bool HandleMouseInput(MouseInput mi)
|
||||
{
|
||||
if (mi.Event != MouseInputEvent.Down)
|
||||
return false;
|
||||
|
||||
OnMouseDown(mi);
|
||||
return true;
|
||||
}
|
||||
|
||||
public int2 ConvertToPreview(Map map, int2 point)
|
||||
{
|
||||
return new int2(MapRect.X + (int)(PreviewScale*(point.X - map.Bounds.Left)) , MapRect.Y + (int)(PreviewScale*(point.Y - map.Bounds.Top)));
|
||||
|
||||
Reference in New Issue
Block a user