aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-14 04:05:38 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-19 12:35:29 -0800
commit2c3d927a4290a88ca8287030f5d59128452c73ca (patch)
tree611660909b2f00b906c3434bc81ee0172e14d12f /mobile-widgets
parent4843ae4ede4317a14aa49f042863530a22589de6 (diff)
downloadsubsurface-2c3d927a4290a88ca8287030f5d59128452c73ca.tar.gz
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>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/themeinterface.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/mobile-widgets/themeinterface.cpp b/mobile-widgets/themeinterface.cpp
index 87fcd3d88..38a569746 100644
--- a/mobile-widgets/themeinterface.cpp
+++ b/mobile-widgets/themeinterface.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "themeinterface.h"
+#include "core/subsurface-string.h"
#include "qmlmanager.h"
#include "core/metrics.h"
#include "core/settings/qPrefDisplay.h"
@@ -79,16 +80,17 @@ double ThemeInterface::currentScale()
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);
emit currentScaleChanged();
- }
-
- // Set current font size
- defaultModelFont().setPointSizeF(m_basePointSize * qPrefDisplay::mobile_scale());
+ // Set current font size
+ m_basePointSize *= factor;
+ defaultModelFont().setPointSizeF(m_basePointSize);
+ }
// adjust all used font sizes
- m_regularPointSize = m_basePointSize * qPrefDisplay::mobile_scale();
+ m_regularPointSize = m_basePointSize;
emit regularPointSizeChanged();
m_headingPointSize = m_regularPointSize * 1.2;