aboutsummaryrefslogtreecommitdiffstats
path: root/examples/imageviewer/button.go
diff options
context:
space:
mode:
Diffstat (limited to 'examples/imageviewer/button.go')
-rw-r--r--examples/imageviewer/button.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/imageviewer/button.go b/examples/imageviewer/button.go
index 0078774..e012a08 100644
--- a/examples/imageviewer/button.go
+++ b/examples/imageviewer/button.go
@@ -50,7 +50,9 @@ func Button(env gui.Env, theme *Theme, text string, action func()) {
case e.Matches("mo/up/%d/%d/left", &x, &y):
if pressed {
- action()
+ if image.Pt(x, y).In(r) {
+ action()
+ }
pressed = false
env.Draw() <- redraw(r, over, pressed)
}