Merge pull request 'new zoom system prototype' (#34) from newzoom into master

Reviewed-on: #34
This commit is contained in:
Sarah Jamie Lewis 2020-12-08 17:44:00 -08:00
commit 48d9d1d11f
1 changed files with 56 additions and 0 deletions

View File

@ -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]]
}