aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--examples/imageviewer/browser.go2
-rw-r--r--win/win.go3
3 files changed, 6 insertions, 3 deletions
diff --git a/README.md b/README.md
index a74dd6b..c69f1dd 100644
--- a/README.md
+++ b/README.md
@@ -100,7 +100,9 @@ case event.Matches("mo/move/%d/%d", &x, &y):
case event.Matches("mo/down/%d/%d/%s", &x, &y, &btn):
// mouse button pressed on (x, y)
case event.Matches("mo/up/%d/%d/%s", &x, &y, &btn):
- // mouse button released on (x, y)
+ // mouse button released on (x, y)
+case event.Matches("mo/scroll/%d/%d", &x, &y):
+ // mouse scrolled by (x, y)
case event.Matches("kb/type/%d", &r):
// rune r typed on the keyboard (encoded as a number in the event string)
case event.Matches("kb/down/%s", &key):
diff --git a/examples/imageviewer/browser.go b/examples/imageviewer/browser.go
index 087e596..e3df54e 100644
--- a/examples/imageviewer/browser.go
+++ b/examples/imageviewer/browser.go
@@ -157,7 +157,7 @@ func Browser(env gui.Env, theme *Theme, dir string, cd <-chan string, view chan<
env.Draw() <- redraw(r, selected, position, lineHeight, namesImage)
}
- case e.Matches("mo/scroll/%d/%d", &y, &x):
+ case e.Matches("mo/scroll/%d/%d", &x, &y):
newP := position.Sub(image.Pt(int(x*16), int(y*16)))
if newP.X > namesImage.Bounds().Max.X-r.Dx() {
newP.X = namesImage.Bounds().Max.X - r.Dx()
diff --git a/win/win.go b/win/win.go
index 55cd434..c4972c2 100644
--- a/win/win.go
+++ b/win/win.go
@@ -136,6 +136,7 @@ func makeGLFWWin(o *options) (*glfw.Window, error) {
// mo/move/<x>/<y> Mouse moved to (x, y).
// mo/down/<x>/<y>/<button> A mouse button pressed on (x, y).
// mo/up/<x>/<y>/<button> A mouse button released on (x, y).
+// mo/scroll/<x>/<y> Mouse scrolled by (x, y).
// kb/type/<code> A unicode character typed on the keyboard.
// kb/down/<key> A key on the keyboard pressed.
// kb/up/<key> A key on the keyboard released.
@@ -217,7 +218,7 @@ func (w *Win) eventThread() {
})
w.w.SetScrollCallback(func(_ *glfw.Window, xoff, yoff float64) {
- w.eventsIn <- gui.Eventf("mo/scroll/%d/%d", int(yoff), int(xoff))
+ w.eventsIn <- gui.Eventf("mo/scroll/%d/%d", int(xoff), int(yoff))
})
w.w.SetCharCallback(func(_ *glfw.Window, r rune) {