Add basic mouse wheel support to viewport

This commit is contained in:
Christian Rocha
2020-06-23 12:00:17 -04:00
parent f967f6a87f
commit c9196e5407

View File

@@ -344,6 +344,22 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
cmd = LineUp(m, lines)
}
}
case tea.MouseMsg:
switch msg.Button {
case tea.MouseWheelUp:
lines := m.ViewUp()
if m.HighPerformanceRendering {
cmd = ViewUp(m, lines)
}
case tea.MouseWheelDown:
lines := m.ViewDown()
if m.HighPerformanceRendering {
cmd = ViewDown(m, lines)
}
}
}
return m, cmd