Mercurial > hg > ugly-duckling
comparison src/app/waveform/waveform.component.ts @ 60:2c3d502507b4
Store the original array length before iterating, as popping off the array is causing the length to change dynamically on each iteration. Rookie mistake.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Thu, 08 Dec 2016 23:28:54 +0000 |
parents | 010871a771d3 |
children | 8b8f794942d1 |
comparison
equal
deleted
inserted
replaced
59:010871a771d3 | 60:2c3d502507b4 |
---|---|
113 const width = this.trackDiv.nativeElement.getBoundingClientRect().width; | 113 const width = this.trackDiv.nativeElement.getBoundingClientRect().width; |
114 | 114 |
115 // loop through layers and remove them, waves-ui provides methods for this but it seems to not work properly | 115 // loop through layers and remove them, waves-ui provides methods for this but it seems to not work properly |
116 const timeContextChildren = this.timeline.timeContext._children; | 116 const timeContextChildren = this.timeline.timeContext._children; |
117 | 117 |
118 for (let i = 0; i < this.disposableLayers.length; ++i) { | 118 for (let i = 0, length = this.disposableLayers.length; i < length; ++i) { |
119 let layer = this.disposableLayers.pop(); | 119 let layer = this.disposableLayers.pop(); |
120 mainTrack.remove(layer); | 120 mainTrack.remove(layer); |
121 | 121 |
122 const index = timeContextChildren.indexOf(layer.timeContext); | 122 const index = timeContextChildren.indexOf(layer.timeContext); |
123 if (index >= 0) | 123 if (index >= 0) |