Mouse wheel scrolling

Also throttle the frame rate to 40ms/ Previously it was redrawing on
every sent STDIN event.
pull/69/head
Thomas Buckley-Houston 2018-02-09 09:57:46 +08:00
rodzic f624ea00f1
commit 819a29c8b6
3 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -145,7 +145,6 @@ func readStdin() {
}
shutdown("normal")
}
log(fmt.Sprintf("EventKey: k: %d, c: %c, mod: %s", ev.Key, ev.Ch, ev.Mod))
eventMap := map[string]interface{}{
"key": int(ev.Key),
"char": string(ev.Ch),
@ -160,7 +159,6 @@ func readStdin() {
termbox.Flush()
sendTtySize()
case termbox.EventMouse:
log(fmt.Sprintf("Mouse: k: %d, x: %d, y: %d, mod: %s", ev.Key, ev.MouseX, ev.MouseY, ev.Mod))
eventMap := map[string]interface{}{
"key": int(ev.Key),
"mouse_x": int(ev.MouseX),
@ -262,7 +260,6 @@ func webSocketWriter(ws *websocket.Conn) {
}
shutdown(err.Error())
}
log(fmt.Sprintf("TTY sent: %s", message))
}
}

Wyświetl plik

@ -1,3 +1,4 @@
import _ from 'lodash';
import utils from 'utils';
// Handle commands coming in from the terminal, like; STDIN keystrokes, TTY resize, etc
@ -25,7 +26,9 @@ export default (MixinBase) => class extends MixinBase {
}
// Trigger a faster feedback response
// TODO: cancel the current FPS iteration when using this
this.sendToCurrentTab('/request_frame');
_.throttle(() => {
this.sendToCurrentTab('/request_frame')
}, 50);
break;
case '/status':
this.updateStatus('', parts.slice(1).join(','));

Wyświetl plik

@ -137,6 +137,12 @@ export default class FrameBuilder extends BaseBuilder{
case 65516: // down arrow
window.scrollBy(0, 20);
break;
case 65508: // scroll up
window.scrollBy(0, -20);
break;
case 65507: // scroll down
window.scrollBy(0, 20);
break;
case 65512: // mousedown
this._mouseAction('click', input.mouse_x, input.mouse_y);
this._mouseAction('mousedown', input.mouse_x, input.mouse_y);