@checksub_team/peaks_timeline 1.16.0-alpha.2 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/peaks.js +4160 -3938
  3. package/peaks.js.d.ts +5 -5
  4. package/src/{timeline-axis.js → components/axis.js} +244 -244
  5. package/src/{data-retriever.js → components/data-retriever.js} +117 -117
  6. package/src/{default-segment-marker.js → components/default-segment-marker.js} +132 -132
  7. package/src/{invoker.js → components/invoker.js} +81 -81
  8. package/src/{line.js → components/line-group.js} +192 -187
  9. package/src/components/line-groups.js +584 -0
  10. package/src/{line-indicator.js → components/line-indicator.js} +308 -293
  11. package/src/{marker-factories.js → components/marker-factories.js} +1 -1
  12. package/src/{mode-layer.js → components/mode-layer.js} +8 -12
  13. package/src/{playhead-layer.js → components/playhead-layer.js} +3 -3
  14. package/src/{segment-marker.js → components/segment-marker.js} +2 -2
  15. package/src/{segment-shape.js → components/segment-shape.js} +508 -508
  16. package/src/{segments-group.js → components/segments-group.js} +805 -805
  17. package/src/{source-group.js → components/source-group.js} +1641 -1645
  18. package/src/{sources-layer.js → components/sources-layer.js} +716 -704
  19. package/src/{waveform-builder.js → components/waveform-builder.js} +2 -2
  20. package/src/{waveform-shape.js → components/waveform-shape.js} +214 -214
  21. package/src/keyboard-handler.js +9 -9
  22. package/src/line-handler.js +179 -0
  23. package/src/main.js +99 -64
  24. package/src/models/line.js +156 -0
  25. package/src/{segment.js → models/segment.js} +420 -419
  26. package/src/{source.js → models/source.js} +1262 -1269
  27. package/src/player.js +2 -2
  28. package/src/{timeline-segments.js → segment-handler.js} +427 -435
  29. package/src/{timeline-sources.js → source-handler.js} +510 -512
  30. package/src/utils.js +5 -1
  31. package/src/{timeline-zoomview.js → view.js} +133 -138
  32. package/src/lines.js +0 -533
  33. /package/src/{data.js → components/data.js} +0 -0
  34. /package/src/{loader.js → components/loader.js} +0 -0
  35. /package/src/{mouse-drag-handler.js → components/mouse-drag-handler.js} +0 -0
  36. /package/src/{svgs.js → components/svgs.js} +0 -0
@@ -1,35 +1,32 @@
1
1
  /**
2
2
  * @file
3
3
  *
4
- * Defines the {@link line} class.
4
+ * Defines the {@link lineGroup} class.
5
5
  *
6
- * @module line
6
+ * @module lineGroup
7
7
  */
8
8
 
9
9
  define([
10
10
  './source-group',
11
- 'konva',
12
- './utils'
13
- ], function(SourceGroup, Konva, Utils) {
11
+ '../utils',
12
+ 'konva'
13
+ ], function(SourceGroup, Utils, Konva) {
14
14
  'use strict';
15
15
 
16
- function Line(peaks, view, y, id, position) {
16
+ function LineGroup(peaks, view, line) {
17
17
  this._peaks = peaks;
18
18
  this._view = view;
19
19
 
20
- this._id = id;
21
- this._position = position;
20
+ this._line = line;
21
+ this._position = null;
22
22
 
23
23
  this._firstSourceId = null;
24
24
  this._sources = {};
25
25
 
26
26
  this._sourcesGroup = {};
27
27
  this._wrapped = false;
28
- this._y = y;
29
28
 
30
29
  this._group = new Konva.Group({
31
- x: 0,
32
- y: y - this._view.getFrameOffsetY(),
33
30
  draggable: true,
34
31
  dragBoundFunc: function() {
35
32
  return {
@@ -44,31 +41,35 @@ define([
44
41
  this._unwrappedCount = 0;
45
42
  }
46
43
 
47
- Line.prototype.getPosition = function() {
44
+ LineGroup.prototype.getPosition = function() {
48
45
  return this._position;
49
46
  };
50
47
 
51
- Line.prototype.getId = function() {
52
- return this._id;
48
+ LineGroup.prototype.getId = function() {
49
+ return this._line.id;
53
50
  };
54
51
 
55
- Line.prototype.countRemainingElements = function() {
52
+ LineGroup.prototype.getLine = function() {
53
+ return this._line;
54
+ };
55
+
56
+ LineGroup.prototype.countRemainingElements = function() {
56
57
  return this.isSegmentsLine() ?
57
58
  this._segmentsGroup.countRemainingElements() :
58
59
  Object.keys(this._sources).length;
59
60
  };
60
61
 
61
- Line.prototype.isSegmentsLine = function() {
62
+ LineGroup.prototype.isSegmentsLine = function() {
62
63
  return Boolean(this._segmentsGroup);
63
64
  };
64
65
 
65
- Line.prototype.updateSegments = function(frameStartTime, frameEndTime) {
66
+ LineGroup.prototype.updateSegments = function(frameStartTime, frameEndTime) {
66
67
  if (this.isSegmentsLine()) {
67
68
  this._segmentsGroup.updateSegments(frameStartTime, frameEndTime);
68
69
  }
69
70
  };
70
71
 
71
- Line.prototype.lineLength = function() {
72
+ LineGroup.prototype.lineLength = function() {
72
73
  var length = 0;
73
74
 
74
75
  if (this.isSegmentsLine()) {
@@ -90,11 +91,11 @@ define([
90
91
  return length;
91
92
  };
92
93
 
93
- Line.prototype.lineHeight = function() {
94
+ LineGroup.prototype.lineHeight = function() {
94
95
  return this._height;
95
96
  };
96
97
 
97
- Line.prototype._addHeight = function(height) {
98
+ LineGroup.prototype._addHeight = function(height) {
98
99
  if (this._sourceHeights[height]) {
99
100
  this._sourceHeights[height]++;
100
101
  }
@@ -106,7 +107,7 @@ define([
106
107
  }
107
108
  };
108
109
 
109
- Line.prototype._subtractHeight = function(height) {
110
+ LineGroup.prototype._subtractHeight = function(height) {
110
111
  if (Object.keys(this._sources).length === 0) {
111
112
  this._height = this._peaks.options.emptyLineHeight;
112
113
  this._sourceHeights = {};
@@ -131,7 +132,7 @@ define([
131
132
  }
132
133
  };
133
134
 
134
- Line.prototype.updateLineHeight = function(source, action) {
135
+ LineGroup.prototype.updateLineHeight = function(source, action) {
135
136
  var oldHeight = this._height;
136
137
  var sourceGroup = this._sourcesGroup[source.id];
137
138
  var sourceGroupHeight;
@@ -162,16 +163,16 @@ define([
162
163
  }
163
164
 
164
165
  if (this._height !== oldHeight) {
165
- this._peaks.emit('line.heightChanged', this._position);
166
+ this._peaks.emit('line.heightChanged', this._line);
166
167
  }
167
168
  };
168
169
 
169
- Line.prototype.isVisible = function() {
170
- return this._y < this._view.getFrameOffsetY() + this._view.getHeight()
171
- && this._view.getFrameOffsetY() < this._y + this._height;
170
+ LineGroup.prototype.isVisible = function() {
171
+ return this.y() < this._view.getHeight()
172
+ && this.y() + this._height > 0;
172
173
  };
173
174
 
174
- Line.prototype.addToLayer = function(layer) {
175
+ LineGroup.prototype.addToLayer = function(layer) {
175
176
  layer.add(this._group);
176
177
  };
177
178
 
@@ -181,110 +182,128 @@ define([
181
182
  * @param {SourceGroup} sourceGroup - The source group of the source (optional).
182
183
  * @returns {void}
183
184
  */
184
- Line.prototype.addSourceGroup = function(source, sourceGroup) {
185
+ LineGroup.prototype.addSource = function(source, sourceGroup, sourcesAround) {
185
186
  if (sourceGroup) {
186
187
  this._sourcesGroup[source.id] = sourceGroup;
188
+ if (!sourceGroup.getParent() || !sourceGroup.isDescendantOf(this._group)) {
189
+ sourceGroup.moveTo(this._group);
190
+ }
187
191
  }
188
192
 
189
193
  if (!this._sources[source.id]) {
190
- var newSource = {
194
+ var sourceData = {
191
195
  source: source,
192
196
  prevSourceId: null,
193
197
  nextSourceId: null
194
198
  };
195
199
 
196
- if (this._firstSourceId) {
197
- var currentSource = null;
200
+ if (Utils.isNullOrUndefined(this._firstSourceId)) {
201
+ this._firstSourceId = source.id;
202
+ this._sources[source.id] = sourceData;
203
+ }
204
+ else if (Utils.isNullOrUndefined(sourcesAround)) {
205
+ this._addSourceWherePossible(sourceData);
206
+ }
207
+ else {
208
+ if (sourcesAround.left) {
209
+ this._sources[sourcesAround.left.id].nextSourceId = source.id;
210
+ sourceData.prevSourceId = sourcesAround.left.id;
211
+ }
212
+ else {
213
+ this._firstSourceId = source.id;
214
+ }
215
+ if (sourcesAround.right) {
216
+ this._sources[sourcesAround.right.id].prevSourceId = source.id;
217
+ sourceData.nextSourceId = sourcesAround.right.id;
218
+ }
219
+ this._sources[source.id] = sourceData;
220
+ }
221
+
222
+ this.updateLineHeight(source, 'add');
223
+ }
224
+ };
198
225
 
199
- do {
200
- if (!currentSource) {
201
- currentSource = this._sources[this._firstSourceId];
226
+ LineGroup.prototype._addSourceWherePossible = function(sourceData) {
227
+ const source = sourceData.source;
228
+ var currentSource = null;
229
+
230
+ do {
231
+ if (!currentSource) {
232
+ currentSource = this._sources[this._firstSourceId];
233
+ }
234
+ else {
235
+ currentSource = this._sources[currentSource.nextSourceId];
236
+ }
237
+
238
+ if (source.endTime <= currentSource.source.startTime) {
239
+ var startLimit = currentSource.prevSourceId
240
+ ? this._sources[currentSource.prevSourceId].source.endTime
241
+ : 0;
242
+
243
+ const { newStartTime, newEndTime } = this._canBePlacedBetween(
244
+ source.startTime,
245
+ source.endTime,
246
+ startLimit,
247
+ currentSource.source.startTime
248
+ );
249
+
250
+ if (!Utils.isNullOrUndefined(newStartTime) && !Utils.isNullOrUndefined(newEndTime)) {
251
+ source.updateTimes(newStartTime, newEndTime);
252
+
253
+ if (currentSource.prevSourceId) {
254
+ this._sources[currentSource.prevSourceId].nextSourceId = source.id;
255
+ sourceData.prevSourceId = currentSource.prevSourceId;
202
256
  }
203
257
  else {
204
- currentSource = this._sources[currentSource.nextSourceId];
258
+ this._firstSourceId = source.id;
205
259
  }
206
260
 
207
- if (source.endTime <= currentSource.source.startTime) {
208
- var startLimit = currentSource.prevSourceId
209
- ? this._sources[currentSource.prevSourceId].source.endTime
210
- : 0;
211
-
212
- const { newStartTime, newEndTime } = this._canBePlacedBetween(
213
- source.startTime,
214
- source.endTime,
215
- startLimit,
216
- currentSource.source.startTime
217
- );
218
-
219
- if (newStartTime !== null && newEndTime !== null) {
220
- source.updateTimes(newStartTime, newEndTime);
221
-
222
- if (currentSource.prevSourceId) {
223
- this._sources[currentSource.prevSourceId].nextSourceId = source.id;
224
- newSource.prevSourceId = currentSource.prevSourceId;
225
- }
226
- else {
227
- this._firstSourceId = source.id;
228
- }
229
-
230
- currentSource.prevSourceId = source.id;
231
- newSource.nextSourceId = currentSource.source.id;
232
-
233
- this._sources[source.id] = newSource;
234
- break;
235
- }
236
- }
237
- } while (currentSource.nextSourceId);
261
+ currentSource.prevSourceId = source.id;
262
+ sourceData.nextSourceId = currentSource.source.id;
238
263
 
239
- if (!newSource.prevSourceId && !newSource.nextSourceId) {
240
- if (source.startTime < currentSource.source.endTime) {
241
- // Overlapping with last source
242
- var timeWidth = source.endTime - source.startTime;
243
-
244
- source.updateTimes(
245
- currentSource.source.endTime,
246
- currentSource.source.endTime + timeWidth
247
- );
248
- }
249
- currentSource.nextSourceId = source.id;
250
- newSource.prevSourceId = currentSource.source.id;
251
- this._sources[source.id] = newSource;
264
+ this._sources[source.id] = sourceData;
265
+ break;
252
266
  }
253
267
  }
254
- else {
255
- this._firstSourceId = source.id;
256
- this._sources[source.id] = newSource;
257
- }
268
+ } while (currentSource.nextSourceId);
258
269
 
259
- this.updateLineHeight(source, 'add');
260
- }
270
+ if (!sourceData.prevSourceId && !sourceData.nextSourceId) {
271
+ if (source.startTime < currentSource.source.endTime) {
272
+ // Overlapping with last source
273
+ var timeWidth = source.endTime - source.startTime;
261
274
 
262
- if (sourceGroup && (!sourceGroup.getParent() || !sourceGroup.isDescendantOf(this._group))) {
263
- sourceGroup.addToGroup(this._group);
275
+ source.updateTimes(
276
+ currentSource.source.endTime,
277
+ currentSource.source.endTime + timeWidth
278
+ );
279
+ }
280
+ currentSource.nextSourceId = source.id;
281
+ sourceData.prevSourceId = currentSource.source.id;
282
+ this._sources[source.id] = sourceData;
264
283
  }
265
284
  };
266
285
 
267
- Line.prototype.addSegments = function(segmentsGroup) {
286
+ LineGroup.prototype.addSegments = function(segmentsGroup) {
268
287
  this._segmentsGroup = segmentsGroup;
269
288
 
270
289
  this._height = this._segmentsGroup.getCurrentHeight();
271
290
 
272
- segmentsGroup.addToGroup(this._group);
291
+ segmentsGroup.moveTo(this._group);
273
292
  };
274
293
 
275
- Line.prototype.refreshSegmentsHeight = function() {
294
+ LineGroup.prototype.refreshSegmentsHeight = function() {
276
295
  if (this.isSegmentsLine) {
277
296
  var oldHeight = this._height;
278
297
 
279
298
  this._height = this._segmentsGroup.getCurrentHeight();
280
299
 
281
300
  if (this._height !== oldHeight) {
282
- this._peaks.emit('line.heightChanged', this._position);
301
+ this._peaks.emit('line.heightChanged', this._line);
283
302
  }
284
303
  }
285
304
  };
286
305
 
287
- Line.prototype._canBePlacedBetween = function(startTime, endTime, startLimit, endLimit) {
306
+ LineGroup.prototype._canBePlacedBetween = function(startTime, endTime, startLimit, endLimit) {
288
307
  var timeWidth = Utils.roundTime(endTime - startTime);
289
308
  var newStartTime, newEndTime;
290
309
 
@@ -308,68 +327,61 @@ define([
308
327
  return { newStartTime, newEndTime };
309
328
  };
310
329
 
311
- Line.prototype.removeSourceGroup = function(source, isPermanent) {
312
- var sourceGroup = this._sourcesGroup[source.id];
330
+ LineGroup.prototype.removeSourceGroup = function(source) {
331
+ const sourceGroup = this._sourcesGroup[source.id];
313
332
 
314
333
  delete this._sourcesGroup[source.id];
315
334
 
316
- if (isPermanent) {
317
- var sourceData = this._sources[source.id];
335
+ if (sourceGroup) {
336
+ sourceGroup.hideButKeepFocus();
337
+ }
338
+
339
+ return sourceGroup;
340
+ };
318
341
 
319
- delete this._sources[source.id];
342
+ LineGroup.prototype.removeSource = function(source) {
343
+ const sourceGroup = this.removeSourceGroup(source);
320
344
 
321
- if (Object.keys(this._sources).length === 0) {
322
- setTimeout(function() {
323
- this._peaks.emit('line.remove', this._position);
324
- }.bind(this), 0);
325
- return sourceGroup;
326
- }
345
+ var sourceData = this._sources[source.id];
327
346
 
328
- if (sourceData.prevSourceId) {
329
- this._sources[sourceData.prevSourceId].nextSourceId
330
- = sourceData.nextSourceId;
331
- }
347
+ delete this._sources[source.id];
332
348
 
333
- if (sourceData.nextSourceId) {
334
- this._sources[sourceData.nextSourceId].prevSourceId
335
- = sourceData.prevSourceId;
336
- }
349
+ if (Object.keys(this._sources).length === 0) {
350
+ this._peaks.destroyLine(this._line.id, true);
351
+ return sourceGroup;
352
+ }
337
353
 
338
- if (this._firstSourceId === source.id) {
339
- this._firstSourceId = sourceData.nextSourceId;
340
- }
354
+ if (sourceData.prevSourceId) {
355
+ this._sources[sourceData.prevSourceId].nextSourceId
356
+ = sourceData.nextSourceId;
357
+ }
341
358
 
342
- this.updateLineHeight(source, 'remove');
359
+ if (sourceData.nextSourceId) {
360
+ this._sources[sourceData.nextSourceId].prevSourceId
361
+ = sourceData.prevSourceId;
343
362
  }
344
363
 
345
- return sourceGroup;
346
- };
364
+ if (this._firstSourceId === source.id) {
365
+ this._firstSourceId = sourceData.nextSourceId;
366
+ }
347
367
 
348
- Line.prototype.getKonvaGroup = function() {
349
- return this._group;
350
- };
368
+ this.updateLineHeight(source, 'remove');
351
369
 
352
- Line.prototype.getY = function() {
353
- return this._group.y();
370
+ return sourceGroup;
354
371
  };
355
372
 
356
- Line.prototype.getInitialY = function() {
357
- return this._y;
373
+ LineGroup.prototype.getKonvaGroup = function() {
374
+ return this._group;
358
375
  };
359
376
 
360
- Line.prototype.y = function(value, changeInitialY) {
361
- this._group.y(value);
362
- if (changeInitialY) {
363
- this._y = value;
377
+ LineGroup.prototype.y = function(value) {
378
+ if (typeof value !== 'number') {
379
+ return this._group.y();
364
380
  }
381
+ this._group.y(value);
365
382
  };
366
383
 
367
- Line.prototype.moveOnY = function(dy) {
368
- this._y += dy;
369
- this._group.y(this._group.y() + dy);
370
- };
371
-
372
- Line.prototype.manageOrder = function(sources, startTime, endTime) {
384
+ LineGroup.prototype.manageOrder = function(sources, startTime, endTime) {
373
385
  const firstSource = sources[0];
374
386
  const lastSource = sources[sources.length - 1];
375
387
  const cursorTime = this._view.pixelsToTime(this._view.getPointerPosition().x);
@@ -422,7 +434,7 @@ define([
422
434
  return { newStartTime, newEndTime };
423
435
  };
424
436
 
425
- Line.prototype._changeSourcesPosition = function(sources, sourceDuration, time) {
437
+ LineGroup.prototype._changeSourcesPosition = function(sources, sourceDuration, time) {
426
438
  var currentRange = {
427
439
  start: null,
428
440
  end: null
@@ -481,7 +493,7 @@ define([
481
493
  return { newStartTime, newEndTime };
482
494
  };
483
495
 
484
- Line.prototype._moveSource = function(source, prevSourceId) {
496
+ LineGroup.prototype._moveSource = function(source, prevSourceId) {
485
497
  // Remove source from the list
486
498
  var sourceObj = this._sources[source.id];
487
499
  var prevSource = this._sources[sourceObj.prevSourceId];
@@ -519,7 +531,7 @@ define([
519
531
  this._sources[source.id] = sourceObj;
520
532
  };
521
533
 
522
- Line.prototype.manageCollision = function(sources, newStartTime, newEndTime) {
534
+ LineGroup.prototype.manageCollision = function(sources, newStartTime, newEndTime) {
523
535
  var originalStartTime = newStartTime;
524
536
  var originalEndTime = newEndTime;
525
537
  var startLimited = false;
@@ -529,42 +541,36 @@ define([
529
541
 
530
542
  if (typeof newStartTime === 'number') {
531
543
  // startMarker changed
532
- if (firstSource.startTime > newStartTime) {
533
- // startMarker moved to the left
534
- if (this._sources[firstSource.id].prevSourceId) {
535
- // there is another source to the left
536
- var previousSource = this._sources[this._sources[firstSource.id].prevSourceId]
537
- .source;
538
-
539
- if (newStartTime < previousSource.endTime) {
540
- // there is collision
541
- newStartTime = previousSource.endTime;
542
- startLimited = true;
543
- }
544
+ if (this._sources[firstSource.id].prevSourceId) {
545
+ // there is another source to the left
546
+ var previousSource = this._sources[this._sources[firstSource.id].prevSourceId]
547
+ .source;
548
+
549
+ if (newStartTime < previousSource.endTime) {
550
+ // there is collision
551
+ newStartTime = previousSource.endTime;
552
+ startLimited = true;
544
553
  }
545
- else {
546
- if (newStartTime < 0) {
547
- newStartTime = 0;
548
- startLimited = true;
549
- }
554
+ }
555
+ else {
556
+ if (newStartTime < 0) {
557
+ newStartTime = 0;
558
+ startLimited = true;
550
559
  }
551
560
  }
552
561
  }
553
562
 
554
563
  if (typeof newEndTime === 'number') {
555
564
  // endMarker changed
556
- if (lastSource.endTime < newEndTime) {
557
- // endMarker moved to the right
558
- if (this._sources[lastSource.id].nextSourceId) {
559
- // there is another source to the right
560
- var nextSource = this._sources[this._sources[lastSource.id].nextSourceId]
561
- .source;
562
-
563
- if (newEndTime > nextSource.startTime) {
564
- // there is collision
565
- newEndTime = nextSource.startTime;
566
- endLimited = true;
567
- }
565
+ if (this._sources[lastSource.id].nextSourceId) {
566
+ // there is another source to the right
567
+ var nextSource = this._sources[this._sources[lastSource.id].nextSourceId]
568
+ .source;
569
+
570
+ if (newEndTime > nextSource.startTime) {
571
+ // there is collision
572
+ newEndTime = nextSource.startTime;
573
+ endLimited = true;
568
574
  }
569
575
  }
570
576
  }
@@ -608,37 +614,37 @@ define([
608
614
  return { newStartTime, newEndTime };
609
615
  };
610
616
 
611
- Line.prototype.getSourcesAfter = function(time) {
617
+ LineGroup.prototype.getSourcesAfter = function(time) {
612
618
  const sources = [];
613
619
  var currentId = this._firstSourceId;
614
620
 
615
621
  while (currentId) {
616
- var lineSource = this._sources[currentId];
622
+ var sourceData = this._sources[currentId];
617
623
 
618
- if (lineSource.source.startTime >= time) {
624
+ if (sourceData.source.startTime >= time) {
619
625
  while (currentId) {
620
- lineSource = this._sources[currentId];
626
+ sourceData = this._sources[currentId];
621
627
 
622
- sources.push(lineSource.source);
623
- currentId = lineSource.nextSourceId;
628
+ sources.push(sourceData.source);
629
+ currentId = sourceData.nextSourceId;
624
630
  }
625
631
  break;
626
632
  }
627
- currentId = lineSource.nextSourceId;
633
+ currentId = sourceData.nextSourceId;
628
634
  }
629
635
 
630
636
  return sources;
631
637
  };
632
638
 
633
- Line.prototype.getSourcesAround = function(time) {
639
+ LineGroup.prototype.getSourcesAround = function(time) {
634
640
  var left = null;
635
641
  var right = null;
636
642
  var overlapping = null;
637
643
  var currentId = this._firstSourceId;
638
644
 
639
645
  while (currentId) {
640
- var lineSource = this._sources[currentId];
641
- var source = lineSource.source;
646
+ var sourceData = this._sources[currentId];
647
+ var source = sourceData.source;
642
648
 
643
649
  if (time < source.startTime) {
644
650
  right = source;
@@ -651,7 +657,7 @@ define([
651
657
  else {
652
658
  left = source;
653
659
  }
654
- currentId = lineSource.nextSourceId;
660
+ currentId = sourceData.nextSourceId;
655
661
  }
656
662
 
657
663
  if (overlapping) {
@@ -662,26 +668,25 @@ define([
662
668
  }
663
669
  };
664
670
 
665
- Line.prototype.updatePosition = function(pos) {
666
- for (var sourceId in this._sources) {
667
- if (Utils.objectHasProperty(this._sources, sourceId)) {
668
- this._sources[sourceId].source.position = pos;
669
- }
670
- }
671
-
671
+ LineGroup.prototype.updatePosition = function(pos) {
672
+ this._line.position = pos;
672
673
  this._position = pos;
673
674
  };
674
675
 
675
- Line.prototype.destroy = function() {
676
+ LineGroup.prototype.hasSource = function(sourceId) {
677
+ return Boolean(this._sources[sourceId]);
678
+ };
679
+
680
+ LineGroup.prototype.destroy = function() {
676
681
  this._firstSourceId = null;
677
682
  this._sources = {};
678
683
  this._sourcesGroup = {};
679
684
  this._group.destroy();
680
685
  };
681
686
 
682
- Line.prototype.allowInteractions = function(bool) {
687
+ LineGroup.prototype.allowInteractions = function(bool) {
683
688
  this._group.listening(bool);
684
689
  };
685
690
 
686
- return Line;
691
+ return LineGroup;
687
692
  });