Skip to content

Commit f7f6d59

Browse files
authored
ui: customizable minimum track height (#156)
Tracks once occupied more vertical space, which can be more comfortable especially for users with vision and motor (pointer control) difficulties. To accommodate embedding applications and users with accessibility needs, add support for customization of the height of via a new setting. For android-graphics/sokatoa#3887 Signed-off-by: Christian W. Damus <cdamus.ext@eclipsesource.com>
1 parent 62f010a commit f7f6d59

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ui/src/frontend/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,15 @@ function onCssLoaded() {
352352
defaultValue: 'light',
353353
});
354354

355+
AppImpl.instance.settings.register({
356+
id: 'track-height-min-px',
357+
name: 'Track Height',
358+
description:
359+
'Minimum height of tracks in the trace viewer page, in pixels.',
360+
schema: z.number().int().min(18),
361+
defaultValue: 18,
362+
});
363+
355364
// Add command to toggle the theme.
356365
AppImpl.instance.commands.registerCommand({
357366
id: 'dev.perfetto.ToggleTheme',

ui/src/frontend/viewer_page/track_view.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {HighPrecisionTimeSpan} from '../../base/high_precision_time_span';
3030
import {Icons} from '../../base/semantic_icons';
3131
import {TimeScale} from '../../base/time_scale';
3232
import {RequiredField} from '../../base/utils';
33+
import {AppImpl} from '../../core/app_impl';
3334
import {PerfStats, runningStatStr} from '../../core/perf_stats';
3435
import {raf} from '../../core/raf_scheduler';
3536
import {TraceImpl} from '../../core/trace_impl';
@@ -58,12 +59,16 @@ import {Popup} from '../../widgets/popup';
5859
import {Theme} from '../../public/theme';
5960
import {CodeSnippet} from '../../widgets/code_snippet';
6061

61-
const TRACK_HEIGHT_MIN_PX = 18;
62+
const DEFAULT_TRACK_HEIGHT_MIN_PX = 18;
6263

6364
function getTrackHeight(node: TrackNode, track?: TrackRenderer) {
6465
// Headless tracks have an effective height of 0.
6566
if (node.headless) return 0;
6667

68+
const TRACK_HEIGHT_MIN_PX =
69+
(AppImpl.instance.settings.get('track-height-min-px')?.get() as number) ??
70+
DEFAULT_TRACK_HEIGHT_MIN_PX;
71+
6772
// Expanded summary tracks don't show any data, so make them a little more
6873
// compact to save space.
6974
if (node.isSummary && node.expanded) return TRACK_HEIGHT_MIN_PX;

0 commit comments

Comments
 (0)