(score: alphaTab.model.Score)
| 27 | } |
| 28 | |
| 29 | private rebuild(score: alphaTab.model.Score): void { |
| 30 | for (const item of this.items) { |
| 31 | item.dispose(); |
| 32 | } |
| 33 | this.items = []; |
| 34 | this.root.replaceChildren(); |
| 35 | this.selection.clear(); |
| 36 | |
| 37 | for (const track of score.tracks) { |
| 38 | const item = new TrackItem(this.api, track); |
| 39 | item.onSelect = e => { |
| 40 | e.stopPropagation(); |
| 41 | if (!e.ctrlKey) { |
| 42 | this.selection.clear(); |
| 43 | this.selection.set(track.index, track); |
| 44 | } else if (this.selection.has(track.index)) { |
| 45 | this.selection.delete(track.index); |
| 46 | } else { |
| 47 | this.selection.set(track.index, track); |
| 48 | } |
| 49 | this.api.renderTracks(Array.from(this.selection.values()).sort((a, b) => a.index - b.index)); |
| 50 | }; |
| 51 | this.items.push(item); |
| 52 | this.root.appendChild(item.root); |
| 53 | } |
| 54 | this.refreshActive(); |
| 55 | } |
| 56 | |
| 57 | private refreshActive(): void { |
| 58 | const active = new Set<number>(); |
no test coverage detected