()
| 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) { |
no test coverage detected