From 41015ec049bf48f37a4166f0266851f39829ea71 Mon Sep 17 00:00:00 2001 From: erinn Date: Wed, 2 Dec 2020 22:31:16 -0800 Subject: [PATCH] wip new zoom system --- theme/Theme.qml | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/theme/Theme.qml b/theme/Theme.qml index fc5a132..ba40c9a 100644 --- a/theme/Theme.qml +++ b/theme/Theme.qml @@ -112,4 +112,60 @@ Item { property ThemeType dark: CwtchDark{} property ThemeType light: CwtchLight{} property ThemeType theme: gcd.theme == "dark" ? dark : light + + // 0-4. replace gcd.themeScale with whatever your app has! + property int scale: gcd.themeScale < 0.8 ? 0 : (gcd.themeScale < 1.2 ? 2 : 4) + + onScaleChanged: console.log("new scale:", scale) + + // magnification system: all size-sets should generally respect these semantics: + // + // scale + // 0 1 2 3 4 + // padding S M M M L + // text S S M L L + // + // use the syntax "propertyName: propertyNameBase[p[scale]]" for padding that + // has S/M/L granularity (and likewise t[scale] for text) + // use the syntax "propertyName: propertyNameBase[scale]" for things that you + // would prefer have 0/1/2/3/4 granularity. + + readonly property variant p: [0, 1, 1, 1, 2] + readonly property variant t: [0, 0, 1, 2, 2] + + ////////////////////// + // section: PADDING // + ////////////////////// + + readonly property variant paddingMinimalBase: [0, 1, 2] + readonly property int paddingMinimal: paddingMinimalBase[p[scale]] + readonly property variant paddingStandardBase: [2, 6, 10] + readonly property int paddingStandard: paddingStandardBase[p[scale]] + readonly property variant paddingLargeBase: [4, 10, 15] + readonly property int paddingLarge: paddingLargeBase[p[scale]] + + readonly property variant paddingClickTargetBase: gcd.os == "android" ? [3, 10, 15] : [1, 4, 8] + readonly property int paddingClickTarget: paddingClickTargetBase[p[scale]] + + //////////////////////// + // section: TEXT SIZE // + //////////////////////// + + readonly property variant textSmallPtBase: [8, 10, 12] + readonly property int textSmallPt: textSmallPtBase[t[scale]] + readonly property variant textMediumPtBase: [10, 12, 14] + readonly property int textMediumPt: textMediumPtBase[t[scale]] + readonly property variant textLargePtBase: [16, 20, 24] + readonly property int textLargePt: textLargePtBase[t[scale]] + + ///////////////////////////////// + // section: ELEMENT DIMENSIONS // + ///////////////////////////////// + + readonly property variant uiIconSizeSBase: [8, 16, 24] + readonly property int uiIconSizeS: uiIconSizeSBase[p[scale]] + readonly property variant uiIconSizeMBase: [24, 32, 48] + readonly property int uiIconSizeM: uiIconSizeMBase[p[scale]] + readonly property variant uiIconSizeLBase: [32, 48, 60] + readonly property int uiIconSizeL: uiIconSizeLBase[p[scale]] }