public override void OnMouseClick(UIMouseClickEventArgs args) { if (_backgroundRect.Transform.HitTest(args.X, args.Y)) { var buttonEventArgs = new UIButtonEventArgs(args.X, args.Y, args.X - (int)_backgroundRect.Transform.Position.X, args.Y - (int)_backgroundRect.Transform.Position.Y); var handler = OnClick; handler?.Invoke(this, buttonEventArgs); } }
public void MouseClick(MouseButton button, int x, int y) { var args = new UIMouseClickEventArgs(button, x, y); foreach (var uiComponent in Components) { uiComponent.OnMouseClick(args); } var handler = OnMouseClick; handler?.Invoke(this, args); }
public abstract void OnMouseClick(UIMouseClickEventArgs args);