mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/UI: don't double apply the font scale factor
The mobile scale code had a fundamental flaw: we applied the scale factor once to gridUnit, but twice to the font size. So effectively we had font sizes of 72% and 132% (all of course then rounded to integers for no good reason) instead of the intended 85% and 115%. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4843ae4ede
commit
2c3d927a42
1 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#include "themeinterface.h"
|
#include "themeinterface.h"
|
||||||
|
#include "core/subsurface-string.h"
|
||||||
#include "qmlmanager.h"
|
#include "qmlmanager.h"
|
||||||
#include "core/metrics.h"
|
#include "core/metrics.h"
|
||||||
#include "core/settings/qPrefDisplay.h"
|
#include "core/settings/qPrefDisplay.h"
|
||||||
|
@ -79,16 +80,17 @@ double ThemeInterface::currentScale()
|
||||||
|
|
||||||
void ThemeInterface::set_currentScale(double newScale)
|
void ThemeInterface::set_currentScale(double newScale)
|
||||||
{
|
{
|
||||||
if (newScale != qPrefDisplay::mobile_scale()) {
|
if (!IS_FP_SAME(newScale, qPrefDisplay::mobile_scale())) {
|
||||||
|
double factor = newScale / qPrefDisplay::mobile_scale();
|
||||||
qPrefDisplay::set_mobile_scale(newScale);
|
qPrefDisplay::set_mobile_scale(newScale);
|
||||||
emit currentScaleChanged();
|
emit currentScaleChanged();
|
||||||
|
|
||||||
|
// Set current font size
|
||||||
|
m_basePointSize *= factor;
|
||||||
|
defaultModelFont().setPointSizeF(m_basePointSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current font size
|
|
||||||
defaultModelFont().setPointSizeF(m_basePointSize * qPrefDisplay::mobile_scale());
|
|
||||||
|
|
||||||
// adjust all used font sizes
|
// adjust all used font sizes
|
||||||
m_regularPointSize = m_basePointSize * qPrefDisplay::mobile_scale();
|
m_regularPointSize = m_basePointSize;
|
||||||
emit regularPointSizeChanged();
|
emit regularPointSizeChanged();
|
||||||
|
|
||||||
m_headingPointSize = m_regularPointSize * 1.2;
|
m_headingPointSize = m_regularPointSize * 1.2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue