diff --git a/widget/check.go b/widget/check.go index 3466b71cfc..de22f44d53 100644 --- a/widget/check.go +++ b/widget/check.go @@ -138,8 +138,11 @@ func (c *Check) Tapped(pe *fyne.PointEvent) { if c.Disabled() { return } + + minHeight := c.minSize.Height + minY := (c.Size().Height - minHeight) / 2 if !c.minSize.IsZero() && - (pe.Position.X > c.minSize.Width || pe.Position.Y > c.minSize.Height) { + (pe.Position.X > c.minSize.Width || pe.Position.Y < minY || pe.Position.Y > minY+minHeight) { // tapped outside the active area of the widget return } diff --git a/widget/check_test.go b/widget/check_test.go index b10df751eb..374a362a5a 100644 --- a/widget/check_test.go +++ b/widget/check_test.go @@ -118,5 +118,19 @@ func TestCheck_Tapped(t *testing.T) { test.Tap(check) assert.False(t, check.Checked) assert.False(t, check.Partial) +} + +func TestCheck_Resize(t *testing.T) { + check := &widget.Check{Text: "test"} + check.Resize(fyne.NewSize(300, 200)) + min := check.MinSize() // set up min cache + assert.Less(t, min.Height, check.Size().Height) + test.TapAt(check, fyne.NewPos(10, 100)) + assert.True(t, check.Checked) + test.TapAt(check, fyne.NewPos(10, 100)) + assert.False(t, check.Checked) + + test.TapAt(check, fyne.NewPos(10, 10)) + assert.False(t, check.Checked) }