Allow ImageWidget to filter mouse events.
This commit is contained in:
@@ -17,6 +17,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
public string ImageCollection = "";
|
public string ImageCollection = "";
|
||||||
public string ImageName = "";
|
public string ImageName = "";
|
||||||
|
public bool ClickThrough = true;
|
||||||
public Func<string> GetImageName;
|
public Func<string> GetImageName;
|
||||||
public Func<string> GetImageCollection;
|
public Func<string> GetImageCollection;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ namespace OpenRA.Widgets
|
|||||||
protected ImageWidget(ImageWidget other)
|
protected ImageWidget(ImageWidget other)
|
||||||
: base(other)
|
: base(other)
|
||||||
{
|
{
|
||||||
|
ClickThrough = other.ClickThrough;
|
||||||
ImageName = other.ImageName;
|
ImageName = other.ImageName;
|
||||||
GetImageName = other.GetImageName;
|
GetImageName = other.GetImageName;
|
||||||
ImageCollection = other.ImageCollection;
|
ImageCollection = other.ImageCollection;
|
||||||
@@ -48,5 +50,10 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
WidgetUtils.DrawRGBA(sprite, RenderOrigin);
|
WidgetUtils.DrawRGBA(sprite, RenderOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool HandleMouseInput(MouseInput mi)
|
||||||
|
{
|
||||||
|
return !ClickThrough && RenderBounds.Contains(mi.Location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user