Make scrollbar scale according to DPI and scaling factor

This commit is contained in:
sapier 2014-07-16 10:11:05 +02:00
parent bf91d623c8
commit 4caa00cc99

@ -33,6 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/string.h" #include "util/string.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "guiFormSpecMenu.h" // for parseColor() #include "guiFormSpecMenu.h" // for parseColor()
#include "main.h"
#include "settings.h" // for settings
#include "porting.h" // for dpi
/* /*
GUITable GUITable
@ -89,6 +92,14 @@ GUITable::GUITable(gui::IGUIEnvironment *env,
setTabStop(true); setTabStop(true);
setTabOrder(-1); setTabOrder(-1);
updateAbsolutePosition(); updateAbsolutePosition();
core::rect<s32> relative_rect = m_scrollbar->getRelativePosition();
s32 width = (relative_rect.getWidth()/(2.0/3.0)) * porting::getDisplayDensity() *
g_settings->getFloat("gui_scaling");
m_scrollbar->setRelativePosition(core::rect<s32>(
relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y,
relative_rect.LowerRightCorner.X,relative_rect.LowerRightCorner.Y
));
} }
GUITable::~GUITable() GUITable::~GUITable()