kopia lustrzana https://github.com/browsh-org/browsh
Switched to server side scrolling.
rodzic
97a756a828
commit
1004777ed7
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue