feat: add bar width multiplier (1x–8x horizontal zoom) for track grid

This commit is contained in:
Xiaohan-Tian
2026-04-10 18:17:36 -07:00
parent 4917e54048
commit 139684b413
8 changed files with 153 additions and 9 deletions
@@ -3,6 +3,7 @@ import { upgradeToV1 } from './upgradeToV1';
import { upgradeToV2 } from './upgradeToV2';
import { upgradeToV3 } from './upgradeToV3';
import { upgradeToV4 } from './upgradeToV4';
import { upgradeToV5 } from './upgradeToV5';
/**
* Upgrade the given project to the latest structure version, one version at a time.
@@ -38,6 +39,10 @@ export function upgradeProjectToLatest(project: KGProject): KGProject {
workingProject = upgradeToV4(workingProject);
break;
}
case 5: {
workingProject = upgradeToV5(workingProject);
break;
}
default: {
// If an upgrader is missing, throw to prevent loading incompatible structures
throw new Error(`No upgrader found for project structure version ${nextVersion}`);
+13
View File
@@ -0,0 +1,13 @@
import { KGProject } from '../KGProject';
export function upgradeToV5(project: KGProject): KGProject {
try {
const current = project.getBarWidthMultiplier?.();
if (current === undefined || current === null) {
project.setBarWidthMultiplier(1);
}
} finally {
project.setProjectStructureVersion(5);
}
return project;
}