Switched to server side scrolling.

This commit is contained in:
Jared Rewerts 2018-08-20 21:57:43 -06:00
parent 97a756a828
commit 1004777ed7
2 changed files with 23 additions and 8 deletions

View file

@ -173,6 +173,9 @@ func handleMouseEvent(ev *tcell.EventMouse) {
xInFrame := x + CurrentTab.frame.xScroll
yInFrame := y - uiHeight + CurrentTab.frame.yScroll
button := ev.Buttons()
if button == tcell.WheelUp || button == tcell.WheelDown {
handleMouseScroll(button)
}
if button == 1 {
CurrentTab.frame.maybeFocusInputBox(xInFrame, yInFrame)
}
@ -186,6 +189,26 @@ func handleMouseEvent(ev *tcell.EventMouse) {
sendMessageToWebExtension("/stdin," + string(marshalled))
}
func handleMouseScroll(scrollType tcell.ButtonMask) {
yScrollOriginal := CurrentTab.frame.yScroll
_, height := screen.Size()
height -= uiHeight
if scrollType == tcell.WheelUp {
CurrentTab.frame.yScroll -= 1
} else if scrollType == tcell.WheelDown {
CurrentTab.frame.yScroll += 1
}
CurrentTab.frame.limitScroll(height)
sendMessageToWebExtension(
fmt.Sprintf(
"/tab_command,/scroll_status,%d,%d",
CurrentTab.frame.xScroll,
CurrentTab.frame.yScroll*2))
if CurrentTab.frame.yScroll != yScrollOriginal {
renderCurrentTabWindow()
}
}
func handleTTYResize() {
width, _ := screen.Size()
urlInputBox.Width = width

View file

@ -125,14 +125,6 @@ export default MixinBase =>
}
this._mousedown = false;
break;
case 256:
console.log("ScrollUp")
this._handleScroll(0, -1)
break;
case 512:
console.log("ScrollDown")
this._handleScroll(0, 1)
break;
}
}