mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app: [linux,windows,wasm] scroll horizontally when shift key is pressed
Adds support for horizontal scroll using mousewheel with a shift key. Support is added for windows, linux (wayland and x11), js (wasm). Fixes: https://todo.sr.ht/~eliasnaur/gio/398 Signed-off-by: Mearaj <mearajbhagad@gmail.com>
This commit is contained in:
@@ -236,6 +236,10 @@ func (w *window) addEventListeners() {
|
||||
w.addEventListener(w.cnv, "wheel", func(this js.Value, args []js.Value) interface{} {
|
||||
e := args[0]
|
||||
dx, dy := e.Get("deltaX").Float(), e.Get("deltaY").Float()
|
||||
// horizontal scroll if shift is pressed.
|
||||
if e.Get("shiftKey").Bool() {
|
||||
dx, dy = dy, dx
|
||||
}
|
||||
mode := e.Get("deltaMode").Int()
|
||||
switch mode {
|
||||
case 0x01: // DOM_DELTA_LINE
|
||||
|
||||
Reference in New Issue
Block a user