(layer)
| 1171 | } |
| 1172 | |
| 1173 | remove(layer) { |
| 1174 | const idx = this.layers.indexOf(layer); |
| 1175 | const len = this.layers.length; |
| 1176 | if (idx > -1) { |
| 1177 | this.layers.splice(idx, 1); |
| 1178 | let layer_picker = document.getElementById('layers'); |
| 1179 | // divs are reversed |
| 1180 | layer_picker.children[len - idx - 1].remove(); |
| 1181 | } |
| 1182 | if (layer instanceof AudioLayer) { |
| 1183 | layer.disconnect(); |
| 1184 | } |
| 1185 | this.total_time = 0; |
| 1186 | for (let layer of this.layers) { |
| 1187 | if (layer.start_time + layer.total_time > this.total_time) { |
| 1188 | this.total_time = layer.start_time + layer.total_time; |
| 1189 | } |
| 1190 | } |
| 1191 | if (this.time > this.total_time) { |
| 1192 | this.time = this.total_time; |
| 1193 | } |
| 1194 | } |
| 1195 | |
| 1196 | add(layer) { |
| 1197 | let layer_picker = document.getElementById('layers'); |
no test coverage detected