Skip to content

Commit

Permalink
fix scroll offset on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Jan 28, 2024
1 parent 7031bd0 commit 279d9e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vstgui/lib/ctexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,15 @@ void TextEditorView::viewOnEvent (CView* view, Event& event)
if (wheelEvent.flags & MouseWheelEvent::Flags::PreciseDeltas)
{
scrollOffset.x += std::ceil (wheelEvent.deltaX / 0.1);
scrollOffset.y += std::ceil (wheelEvent.deltaY / 0.1);
scrollOffset.y -= std::ceil (wheelEvent.deltaY / 0.1);
}
else
{
scrollOffset.x += wheelEvent.deltaX * md.lineHeight;
scrollOffset.y += wheelEvent.deltaY * md.lineHeight;
scrollOffset.y -= wheelEvent.deltaY * md.lineHeight;
}
if (wheelEvent.flags & MouseWheelEvent::DirectionInvertedFromDevice)
scrollOffset.y *= 1.;

auto viewSize = getVisibleViewSize ();
viewSize.offset (scrollOffset);
Expand Down

0 comments on commit 279d9e0

Please sign in to comment.