Skip to content

Commit

Permalink
Make scrollbar scale according to DPI and scaling factor
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and sapier committed Aug 16, 2014
1 parent bf91d62 commit 4caa00c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/guiTable.cpp
Expand Up @@ -33,6 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/string.h"
#include "util/numeric.h"
#include "guiFormSpecMenu.h" // for parseColor()
#include "main.h"
#include "settings.h" // for settings
#include "porting.h" // for dpi

/*
GUITable
Expand Down Expand Up @@ -89,6 +92,14 @@ GUITable::GUITable(gui::IGUIEnvironment *env,
setTabStop(true);
setTabOrder(-1);
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()
Expand Down

0 comments on commit 4caa00c

Please sign in to comment.