Skip to content
Source
Sign inSign up
Open History to see the last commit

androidControlSizing.ts

21 lines730 Bytes

1import { DEFAULT_BASE_FONT_SIZE, normalizeBaseFontSize } from "./appearancePreferences";
2​
3export function resolveAndroidControlSizing(baseFontSize: number) {
4 const scale = normalizeBaseFontSize(baseFontSize) / DEFAULT_BASE_FONT_SIZE;
5 const iconSize = Math.round(24 * scale);
6 const buttonSize = Math.max(48, Math.round(48 * scale));
7 const fabSize = Math.max(48, Math.round(56 * scale));
8​
9 return {
10 scale,
11 iconSize,
12 smallIconSize: Math.round(16 * scale),
13 mediumIconSize: Math.round(18 * scale),
14 buttonSize,
15 fabSize,
16 largeFabSize: Math.round(96 * scale),
17 menuWidth: Math.round(250 * scale),
18 menuItemHeight: Math.max(48, Math.round(48 * scale)),
19 fabClearance: fabSize * 2 + 36,
20 };