summaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2016-01-02 18:23:39 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-04 10:00:44 -0800
commitde46f2b37cb354f8f7fbd9867800a591f24a6f5f (patch)
tree236cfadcf609327a20c60f753ccc09bc1934629a /qt-mobile
parente856f816f207d4aacb8b54a7205abd6f9b637e36 (diff)
downloadsubsurface-de46f2b37cb354f8f7fbd9867800a591f24a6f5f.tar.gz
QML UI: make profile margin scale proportional to dimensions
The QMLProfile height is specified as ~2/3 (actually 0.66) width in DiveDetailsView.qml. In order to produce an even margin around the profile, the scaling factor reduction for height needs to be 3/2 times that for width. MarginFactor is specified as 0.013 to approximate the margin calculated by commits ef653b4 and 7e2898d for my Galaxy S6. MarginFactor = margin / width = 18 / 1365 = 0.132 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qmlprofile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp
index ee0eea7bb..9c1fd32a9 100644
--- a/qt-mobile/qmlprofile.cpp
+++ b/qt-mobile/qmlprofile.cpp
@@ -40,6 +40,7 @@ void QMLProfile::setDiveId(const QString &diveId)
static bool firstRun = true;
static QTransform profileTransform;
m_diveId = diveId;
+ double marginFactor = 0.013; // margin as proportion of profile display width
struct dive *d = get_dive_by_uniq_id(m_diveId.toInt());
if (m_diveId.toInt() < 1)
return;
@@ -68,5 +69,7 @@ void QMLProfile::setDiveId(const QString &diveId)
m_profileWidget->plotDive(d);
// scale the profile to create a margin
- m_profileWidget->scale(0.95, 0.95);
+ // the profile height is ~2/3 the width, so to create an even margin,
+ // the scale reduction for height should be 3/2 the reduction for width
+ m_profileWidget->scale(1 - 2 * marginFactor, 1 - 3 * marginFactor);
}