diff src/app/waveform/waveform.component.ts @ 55:214e41418460

Remove redundant LayerTimeContext's from the parent, not sure this helps anything but definitely should be handled by waves-ui when removing layers.
author Lucas Thompson <dev@lucas.im>
date Thu, 08 Dec 2016 15:26:36 +0000
parents 5fb857f8553b
children 0ecfbef9d942
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts	Thu Dec 08 15:09:03 2016 +0000
+++ b/src/app/waveform/waveform.component.ts	Thu Dec 08 15:26:36 2016 +0000
@@ -92,10 +92,17 @@
     if (this.timeline) {
       // resize
       const width = this.trackDiv.nativeElement.getBoundingClientRect().width;
+
       // loop through layers and remove them, waves-ui provides methods for this but it seems to not work properly
+      const timeContextChildren = this.timeline.timeContext._children;
+
       for (let i = 0; i < this.disposableLayers.length; ++i) {
         let layer = this.disposableLayers.pop();
         mainTrack.remove(layer);
+
+        const index = timeContextChildren.indexOf(layer.timeContext);
+        if (index >= 0)
+          timeContextChildren.splice(index, 1);
         layer.destroy();
       }
       this.timeline.visibleWidth = width;