Browse Source

Only click when pointer is over the button.

Previously a button click was carried out when `:pointerover` was set, but because the button captures mouse input on mouse down, this is always true while the mouse is held. Check that the pointer was released within the bounds of the control.

Fixes #938
pull/1011/head
Steven Kirk 9 years ago
parent
commit
4d30de7c09
  1. 2
      src/Avalonia.Controls/Button.cs

2
src/Avalonia.Controls/Button.cs

@ -234,7 +234,7 @@ namespace Avalonia.Controls
PseudoClasses.Remove(":pressed");
e.Handled = true;
if (ClickMode == ClickMode.Release && Classes.Contains(":pointerover"))
if (ClickMode == ClickMode.Release && new Rect(Bounds.Size).Contains(e.GetPosition(this)))
{
RaiseClickEvent();
}

Loading…
Cancel
Save