Skip to content

Commit 4caa00c

Browse files
sapiersapier
sapier
authored and
sapier
committedAug 16, 2014
Make scrollbar scale according to DPI and scaling factor
1 parent bf91d62 commit 4caa00c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/guiTable.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3333
#include "util/string.h"
3434
#include "util/numeric.h"
3535
#include "guiFormSpecMenu.h" // for parseColor()
36+
#include "main.h"
37+
#include "settings.h" // for settings
38+
#include "porting.h" // for dpi
3639

3740
/*
3841
GUITable
@@ -89,6 +92,14 @@ GUITable::GUITable(gui::IGUIEnvironment *env,
8992
setTabStop(true);
9093
setTabOrder(-1);
9194
updateAbsolutePosition();
95+
96+
core::rect<s32> relative_rect = m_scrollbar->getRelativePosition();
97+
s32 width = (relative_rect.getWidth()/(2.0/3.0)) * porting::getDisplayDensity() *
98+
g_settings->getFloat("gui_scaling");
99+
m_scrollbar->setRelativePosition(core::rect<s32>(
100+
relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y,
101+
relative_rect.LowerRightCorner.X,relative_rect.LowerRightCorner.Y
102+
));
92103
}
93104

94105
GUITable::~GUITable()

0 commit comments

Comments
 (0)
Please sign in to comment.