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
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -344,6 +344,22 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
cmd = LineUp(m, lines) 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 return m, cmd