summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy <silverunicorn2011@yandex.ru>2017-12-21 22:58:06 +0300
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commitb3167d4e5748ffd14efc5981ba8349c01808b78a (patch)
treec68bc0b4447e349e8e07ca470307239cdc3c6c7e
parent8a849e893a4eedb2dd9db8e26f2dab23ac4f3c55 (diff)
downloadminetest-b3167d4e5748ffd14efc5981ba8349c01808b78a.tar.gz
minetest-b3167d4e5748ffd14efc5981ba8349c01808b78a.tar.bz2
minetest-b3167d4e5748ffd14efc5981ba8349c01808b78a.zip
Fix wrong scrolling (#6809)
-rw-r--r--src/intlGUIEditBox.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/intlGUIEditBox.cpp b/src/intlGUIEditBox.cpp
index 37687e1e4..ad59ef13a 100644
--- a/src/intlGUIEditBox.cpp
+++ b/src/intlGUIEditBox.cpp
@@ -1419,13 +1419,10 @@ void intlGUIEditBox::calculateScrollPos()
}
// vertical scroll position
- if (FrameRect.LowerRightCorner.Y < CurrentTextRect.LowerRightCorner.Y + VScrollPos)
- VScrollPos = CurrentTextRect.LowerRightCorner.Y - FrameRect.LowerRightCorner.Y + VScrollPos;
-
- else if (FrameRect.UpperLeftCorner.Y > CurrentTextRect.UpperLeftCorner.Y + VScrollPos)
- VScrollPos = CurrentTextRect.UpperLeftCorner.Y - FrameRect.UpperLeftCorner.Y + VScrollPos;
- else
- VScrollPos = 0;
+ if (FrameRect.LowerRightCorner.Y < CurrentTextRect.LowerRightCorner.Y)
+ VScrollPos += CurrentTextRect.LowerRightCorner.Y - FrameRect.LowerRightCorner.Y; // scrolling downwards
+ else if (FrameRect.UpperLeftCorner.Y > CurrentTextRect.UpperLeftCorner.Y)
+ VScrollPos += CurrentTextRect.UpperLeftCorner.Y - FrameRect.UpperLeftCorner.Y; // scrolling upwards
// todo: adjust scrollbar
}