From 279d9e0678ac90e19b587161b54432dc81bcbabc Mon Sep 17 00:00:00 2001 From: Arne Scheffler Date: Sun, 28 Jan 2024 17:52:13 +0100 Subject: [PATCH] fix scroll offset on Windows --- vstgui/lib/ctexteditor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vstgui/lib/ctexteditor.cpp b/vstgui/lib/ctexteditor.cpp index fc541be97..d85a58617 100644 --- a/vstgui/lib/ctexteditor.cpp +++ b/vstgui/lib/ctexteditor.cpp @@ -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);