feat: add bar width multiplier (1x–8x horizontal zoom) for track grid
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user