MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / insertNewSystem

Method insertNewSystem

packages/playground/src/apps/RecorderApp.ts:266–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

264 }
265
266 private insertNewSystem(): void {
267 this.insertTickThreshold = -1;
268 const currentSystemCount = Math.floor(this.score.masterBars.length / this.score.defaultSystemsLayout);
269 const neededSystemCount = currentSystemCount + 1;
270 const neededBars = neededSystemCount * this.score.defaultSystemsLayout;
271 const lastMasterBarIndex = this.score.masterBars.length - 1;
272
273 let missing = neededBars - this.score.masterBars.length;
274 while (missing > 0) {
275 const masterBar = this.insertNewMasterBar();
276 const bar = this.insertNewBar();
277 const dataBag = new Map<string, unknown>();
278 masterBar.finish(dataBag);
279 bar.finish(this.api.settings, dataBag);
280 missing--;
281 }
282
283 this.updateInsertTickThreshold();
284 this.api.renderScore(this.score, undefined, {
285 reuseViewport: currentSystemCount > 0,
286 firstChangedMasterBar: currentSystemCount > 0 ? lastMasterBarIndex : undefined
287 });
288 }
289
290 private updateInsertTickThreshold(): void {
291 if (this.score.masterBars.length < 2) {

Callers 1

constructorMethod · 0.95

Calls 6

insertNewMasterBarMethod · 0.95
insertNewBarMethod · 0.95
floorMethod · 0.80
renderScoreMethod · 0.65
finishMethod · 0.45

Tested by

no test coverage detected