@checksub_team/peaks_timeline 1.16.0-alpha.1 → 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 +4345 -4185
  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} +213 -240
  9. package/src/components/line-groups.js +584 -0
  10. package/src/{line-indicator.js → components/line-indicator.js} +308 -303
  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 -1649
  18. package/src/{sources-layer.js → components/sources-layer.js} +716 -725
  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 -71
  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 -550
  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
@@ -0,0 +1,584 @@
1
+ /**
2
+ * @file
3
+ *
4
+ * Defines the {@link lines} class.
5
+ *
6
+ * @module lines
7
+ */
8
+
9
+ define([
10
+ './segments-group',
11
+ './line-group',
12
+ './line-indicator',
13
+ '../utils'
14
+ ], function(
15
+ SegmentsGroup,
16
+ LineGroup,
17
+ LineIndicator,
18
+ Utils) {
19
+ 'use strict';
20
+
21
+ function LineGroups(peaks, view, layer) {
22
+ this._peaks = peaks;
23
+ this._view = view;
24
+ this._layer = layer;
25
+ this._lineGroupsById = {};
26
+ this._lineGroupsByPosition = {};
27
+ this._autoAddToLayer = false;
28
+ this._areSourceInteractionsAllowed = true;
29
+ this._areSegmentInteractionsAllowed = true;
30
+
31
+ this._automaticallyCreatedLineId = null;
32
+ this._automaticLineCreationPosition = null;
33
+ this._automaticLineCreationTimeout = null;
34
+
35
+ this._segmentsGroups = {};
36
+ this._segmentsGroupToLine = {};
37
+
38
+ this._lineIndicator = new LineIndicator(
39
+ peaks,
40
+ view,
41
+ document.getElementById('line-indicator-container')
42
+ );
43
+
44
+ this._peaks.on('handler.view.setFrameOffsetY', this.refreshLineYs.bind(this));
45
+
46
+ this._peaks.on('handler.lines.add', this._onLinesAdd.bind(this));
47
+ this._peaks.on('handler.lines.remove', this._onLinesRemove.bind(this));
48
+ this._peaks.on('model.line.update', this._onLineUpdate.bind(this));
49
+
50
+ this._peaks.on('handler.sources.show', this._onSourcesWrappingChanged.bind(this));
51
+ this._peaks.on('handler.sources.hide', this._onSourcesWrappingChanged.bind(this));
52
+
53
+ this._peaks.on('model.segment.updated', this._onSegmentsUpdate.bind(this));
54
+ this._peaks.on('handler.segments.add', this._onSegmentsAdd.bind(this));
55
+ this._peaks.on('handler.segments.remove', this._onSegmentsRemove.bind(this));
56
+ this._peaks.on('handler.segments.remove_all', this._onSegmentsRemoveAll.bind(this));
57
+
58
+ this._peaks.on('main.overrideInteractions', this.overrideInteractions.bind(this));
59
+ this._peaks.on('main.allowInteractions', this.allowInteractions.bind(this));
60
+
61
+ this._peaks.on('line.heightChanged', this._onLineHeightChanged.bind(this));
62
+
63
+ this._peaks.on('segments.dragend', this._onSegmentUpdated.bind(this));
64
+ }
65
+
66
+ LineGroups.prototype.fitToView = function() {
67
+ this._lineIndicator.fitToView();
68
+ };
69
+
70
+ LineGroups.prototype._onLinesAdd = function(lines) {
71
+ lines.forEach(function(line) {
72
+ this._createLineGroup(line);
73
+ }.bind(this));
74
+ };
75
+
76
+ LineGroups.prototype._onLinesRemove = function(lines) {
77
+ lines.forEach(function(line) {
78
+ this._removeLine(line);
79
+ }.bind(this));
80
+ };
81
+
82
+ LineGroups.prototype._onLineUpdate = function(line) {
83
+ const lineGroup = this._lineGroupsById[line.id];
84
+
85
+ if (!lineGroup) {
86
+ this._peaks.logger('peaks.lines.update(): line not found: ' + line.id);
87
+ return;
88
+ }
89
+
90
+ if (line.position !== lineGroup.getPosition()) {
91
+ this._setLinePosition(line.id, line.position);
92
+ }
93
+
94
+ this._lineIndicator.updateIndicator(line);
95
+ };
96
+
97
+ LineGroups.prototype._onSegmentsAdd = function(segments) {
98
+ var self = this;
99
+
100
+ segments.forEach(function(segment) {
101
+ if (!self._segmentsGroups[segment.line]) {
102
+ self._segmentsGroups[segment.line] = new SegmentsGroup(self._peaks, self._view, true);
103
+ }
104
+
105
+ self._segmentsGroups[segment.line].onSegmentsAdd([segment]);
106
+ if (Utils.objectHasProperty(self._segmentsGroupToLine, segment.line)) {
107
+ self._segmentsGroupToLine[segment.line].refreshSegmentsHeight();
108
+ }
109
+ });
110
+ };
111
+
112
+ LineGroups.prototype._onSegmentsUpdate = function(segment) {
113
+ this._segmentsGroups[segment.line].onSegmentsUpdate(segment);
114
+ };
115
+
116
+ LineGroups.prototype._onSegmentUpdated = function(segment) {
117
+ this._segmentsGroups[segment.line].onSegmentUpdated();
118
+ };
119
+
120
+ LineGroups.prototype._onSegmentsRemove = function(segments) {
121
+ var self = this;
122
+
123
+ segments.forEach(function(segment) {
124
+ self._segmentsGroups[segment.line].onSegmentsRemove([segment]);
125
+ });
126
+ };
127
+
128
+ LineGroups.prototype._onSegmentsRemoveAll = function(lineId) {
129
+ this._segmentsGroups[lineId].onSegmentsRemoveAll();
130
+
131
+ if (Utils.objectHasProperty(this._segmentsGroupToLine, lineId)) {
132
+ this._segmentsGroupToLine[lineId].refreshSegmentsHeight();
133
+ }
134
+ };
135
+
136
+ LineGroups.prototype._onLineHeightChanged = function() {
137
+ this.refreshLineYs();
138
+ this._view.updateTimeline();
139
+ };
140
+
141
+ LineGroups.prototype._onSourcesWrappingChanged = function(sources) {
142
+ sources.forEach(function(source) {
143
+ if (this._lineGroupsById[source.lineId]) {
144
+ this._lineGroupsById[source.lineId].updateLineHeight(source, 'wrappingChanged');
145
+ }
146
+ }.bind(this));
147
+ };
148
+
149
+ LineGroups.prototype.addSource = function(source, sourceGroup, sourcesAround) {
150
+ const lineGroup = this._lineGroupsById[source.lineId];
151
+
152
+ if (!lineGroup) {
153
+ this._peaks.logger('peaks.lines.addSource(): line group not found for source ' + source.id +
154
+ ' with lineId: ' + source.lineId);
155
+ this._peaks.logger('Available line groups: ' + JSON.stringify(Object.keys(this._lineGroupsById)));
156
+ return;
157
+ }
158
+
159
+ lineGroup.addSource(source, sourceGroup, sourcesAround);
160
+ };
161
+
162
+ LineGroups.prototype.addSegments = function(lineId, lineOptions) {
163
+ this._peaks.addLine(lineOptions, true);
164
+
165
+ const lineGroup = this._lineGroupsByPosition[lineOptions.position];
166
+
167
+ lineGroup.allowInteractions(this._areSegmentInteractionsAllowed);
168
+ lineGroup.addSegments(this._segmentsGroups[lineId]);
169
+
170
+ this._segmentsGroupToLine[lineId] = lineGroup;
171
+
172
+ this._setInteractions(lineGroup.getId());
173
+
174
+ this.refreshLineYs();
175
+ };
176
+
177
+ LineGroups.prototype.removeSource = function(source) {
178
+ if (!this._lineGroupsById[source.lineId]) {
179
+ return null;
180
+ }
181
+
182
+ return this._lineGroupsById[source.lineId].removeSource(source);
183
+ };
184
+
185
+ LineGroups.prototype.removeSourceGroup = function(source) {
186
+ if (!this._lineGroupsById[source.lineId]) {
187
+ return null;
188
+ }
189
+
190
+ return this._lineGroupsById[source.lineId].removeSourceGroup(source);
191
+ };
192
+
193
+ LineGroups.prototype._removeLine = function(line) {
194
+ var lineGroup = this._lineGroupsById[line.id];
195
+
196
+ if (this._automaticallyCreatedLineId === line.id) {
197
+ this._automaticallyCreatedLineId = null;
198
+ }
199
+ lineGroup.destroy();
200
+
201
+ delete this._lineGroupsByPosition[line.position];
202
+ delete this._lineGroupsById[line.id];
203
+
204
+ this._lineIndicator.removeIndicator(line.id, false);
205
+ this.refreshLineYs();
206
+
207
+ return lineGroup;
208
+ };
209
+
210
+ LineGroups.prototype.isLineVisible = function(lineId) {
211
+ return this._lineGroupsById[lineId] ? this._lineGroupsById[lineId].isVisible() : false;
212
+ };
213
+
214
+ LineGroups.prototype.getVisibleLines = function() {
215
+ var lineIds = {};
216
+
217
+ for (var id in this._lineGroupsById) {
218
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
219
+ if (this._lineGroupsById[id].isVisible()) {
220
+ lineIds[id] = true;
221
+ }
222
+ }
223
+ }
224
+ return lineIds;
225
+ };
226
+
227
+ LineGroups.prototype.getSourcesOnLineAfter = function(lineId, time) {
228
+ return this._lineGroupsById[lineId].getSourcesAfter(time);
229
+ };
230
+
231
+ LineGroups.prototype.getSegmentsGroups = function() {
232
+ return this._segmentsGroups;
233
+ };
234
+
235
+ LineGroups.prototype.addToLayer = function(layer) {
236
+ for (var id in this._lineGroupsById) {
237
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
238
+ this._lineGroupsById[id].addToLayer(layer);
239
+ }
240
+ }
241
+
242
+ this._autoAddToLayer = true;
243
+ };
244
+
245
+ LineGroups.prototype.height = function() {
246
+ var height = 2 * this._peaks.options.padding;
247
+
248
+ for (var position in this._lineGroupsByPosition) {
249
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
250
+ height += this._lineGroupsByPosition[position].lineHeight() + this._peaks.options.interline;
251
+ }
252
+ }
253
+
254
+ height -= this._peaks.options.interline;
255
+
256
+ return height;
257
+ };
258
+
259
+ LineGroups.prototype.linesLength = function() {
260
+ var length = 0;
261
+
262
+ for (var position in this._lineGroupsByPosition) {
263
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
264
+ var lineLength = this._lineGroupsByPosition[position].lineLength();
265
+
266
+ if (lineLength > length) {
267
+ length = lineLength;
268
+ }
269
+ }
270
+ }
271
+
272
+ return length;
273
+ };
274
+
275
+ LineGroups.prototype.stopAutomaticLineCreation = function() {
276
+ if (this._automaticLineCreationTimeout) {
277
+ clearTimeout(this._automaticLineCreationTimeout);
278
+ }
279
+ this._automaticLineCreationTimeout = null;
280
+ this._automaticLineCreationPosition = null;
281
+ this._automaticallyCreatedLineId = null;
282
+ };
283
+
284
+ LineGroups.prototype.manageAutomaticLineCreation = function(newLinePosition, initialPosition, sources) {
285
+ if (!Utils.isNullOrUndefined(this._automaticallyCreatedLineId)) {
286
+ return;
287
+ }
288
+ else if (
289
+ !Utils.isNullOrUndefined(this._automaticLineCreationPosition)
290
+ && this._automaticLineCreationPosition !== newLinePosition
291
+ ) {
292
+ this.stopAutomaticLineCreation();
293
+ }
294
+
295
+ if (this._automaticLineCreationTimeout) {
296
+ return;
297
+ }
298
+
299
+ this._automaticLineCreationPosition = newLinePosition;
300
+ this._automaticLineCreationTimeout = setTimeout(function() {
301
+ this._automaticLineCreationTimeout = null;
302
+
303
+ var currentLine = this._lineGroupsByPosition[initialPosition];
304
+
305
+ sources = sources.filter(function(source) {
306
+ return currentLine.hasSource(source.id);
307
+ });
308
+
309
+ if (sources.length === 0 || sources.length === currentLine.countRemainingElements()) {
310
+ this.stopAutomaticLineCreation();
311
+ return;
312
+ }
313
+
314
+ this._peaks.addLine({
315
+ position: newLinePosition,
316
+ indicatorType: this._peaks.options.defaultLineIndicatorType,
317
+ indicatorText: this._peaks.options.defaultLineIndicatorText
318
+ }, true);
319
+ const automaticallyCreatedLineGroup = this._lineGroupsByPosition[newLinePosition];
320
+
321
+ if (!automaticallyCreatedLineGroup) {
322
+ this._peaks.logger(
323
+ 'peaks.lines.manageAutomaticLineCreation(): line group not found for position ' + newLinePosition
324
+ );
325
+ return;
326
+ }
327
+
328
+ this._automaticallyCreatedLineId = automaticallyCreatedLineGroup.getId();
329
+ this._moveSourcesToPositionIfPossible(sources, newLinePosition);
330
+ }.bind(this), this._peaks.options.automaticLineCreationDelay);
331
+ };
332
+
333
+ LineGroups.prototype.manageVerticalPosition = function(sources, startTime, endTime, mouseX, mouseY) {
334
+ if (Utils.isNullOrUndefined(mouseX)) {
335
+ return;
336
+ }
337
+
338
+ const position = this._lineGroupsById[sources[0].lineId].getPosition();
339
+ const linePos = this.getLinesUnderY(mouseY);
340
+
341
+ if (linePos[0] !== linePos[1]) {
342
+ this.manageAutomaticLineCreation(linePos[0] + 1, position, sources);
343
+ }
344
+ else {
345
+ this.stopAutomaticLineCreation();
346
+
347
+ if (
348
+ !Utils.isNullOrUndefined(mouseX)
349
+ && linePos[0] !== position
350
+ && !this._lineGroupsByPosition[linePos[0]].isSegmentsLine()
351
+ ) {
352
+ var mouseTime = this._view.pixelsToTime(mouseX + this._view.getFrameOffset());
353
+ var sourceDuration = Utils.roundTime(endTime - startTime);
354
+
355
+ this._moveSourcesToPositionIfPossible(sources, linePos[0], mouseTime, sourceDuration);
356
+ }
357
+ }
358
+ };
359
+
360
+ LineGroups.prototype._hasSpaceForSourceAt = function(sourcesAround, sourceDuration) {
361
+ if (sourcesAround.overlapping) {
362
+ return false;
363
+ }
364
+ else if (!sourcesAround.right) {
365
+ return true;
366
+ }
367
+ else {
368
+ var leftLimit = sourcesAround.left ? sourcesAround.left.endTime : 0;
369
+ var rightLimit = sourcesAround.right.startTime;
370
+
371
+ return sourceDuration <= Utils.roundTime(rightLimit - leftLimit);
372
+ }
373
+ };
374
+
375
+ LineGroups.prototype.getLineByPosition = function(pos) {
376
+ return this._lineGroupsByPosition[pos];
377
+ };
378
+
379
+ LineGroups.prototype.getLastPosition = function() {
380
+ var keys = Object.keys(this._lineGroupsByPosition);
381
+
382
+ return keys.pop();
383
+ };
384
+
385
+ LineGroups.prototype.getLinesUnderY = function(y) {
386
+ var height;
387
+ var pos = [-1, this.getLastPosition() + 1];
388
+
389
+ for (var position in this._lineGroupsByPosition) {
390
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
391
+ height = this._lineGroupsByPosition[position].lineHeight();
392
+
393
+ if (y > this._lineGroupsByPosition[position].y()) {
394
+ pos[0] = Math.max(pos[0], parseInt(position, 10));
395
+ }
396
+
397
+ if (y < this._lineGroupsByPosition[position].y() + height) {
398
+ pos[1] = Math.min(pos[1], parseInt(position, 10));
399
+ }
400
+ }
401
+ }
402
+
403
+ return pos;
404
+ };
405
+
406
+ LineGroups.prototype._moveSourcesToPositionIfPossible = function(sources, targetPosition, targetTime,
407
+ sourcesDuration
408
+ ) {
409
+ const lineGroup = this._lineGroupsByPosition[targetPosition];
410
+
411
+ if (!lineGroup || lineGroup.isSegmentsLine()) {
412
+ return false;
413
+ }
414
+
415
+ if (Utils.isNullOrUndefined(targetTime)) {
416
+ targetTime = sources[0].startTime;
417
+ }
418
+
419
+ const sourcesAround = lineGroup.getSourcesAround(targetTime);
420
+
421
+ if (!this._hasSpaceForSourceAt(sourcesAround, sourcesDuration)) {
422
+ return false;
423
+ }
424
+
425
+ this._moveSourcesToLine(sources, sourcesAround, lineGroup.getId());
426
+ return true;
427
+ };
428
+
429
+ // This code assumes that all sources belong to a single line
430
+ // and are sorted by their start time
431
+ LineGroups.prototype._moveSourcesToLine = function(sources, sourcesAround, targetLineId) {
432
+ sources.forEach(function(source) {
433
+ const sourceGroup = this.removeSource(source);
434
+
435
+ source.lineId = targetLineId;
436
+
437
+ this.addSource(source, sourceGroup, sourcesAround);
438
+ sourcesAround.left = source;
439
+ }.bind(this));
440
+
441
+ this.refreshLineYs();
442
+ };
443
+
444
+ LineGroups.prototype.refreshLineYs = function() {
445
+ var y = this._peaks.options.padding - this._view.getFrameOffsetY();
446
+ var anyChange = false;
447
+
448
+ // This code assumes that lines are ordered in ascending order of position
449
+ // This is the case as the keys are integers
450
+ for (var position in this._lineGroupsByPosition) {
451
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
452
+ if (this._lineGroupsByPosition[position].y() !== y) {
453
+ anyChange = true;
454
+ this._lineGroupsByPosition[position].y(y);
455
+ }
456
+ y += this._lineGroupsByPosition[position].lineHeight() + this._peaks.options.interline;
457
+ }
458
+ }
459
+
460
+ if (anyChange && this._lineIndicator.refreshIndicators()) {
461
+ this._lineIndicator.draw();
462
+ }
463
+ };
464
+
465
+ LineGroups.prototype._setLinePosition = function(lineId, position) {
466
+ const lineGroup = this._lineGroupsById[lineId];
467
+
468
+ if (!lineGroup || position === lineGroup.getPosition()) {
469
+ return;
470
+ }
471
+
472
+ const isPositionAvailable = Utils.isNullOrUndefined(this._lineGroupsByPosition[position]);
473
+
474
+ if (isPositionAvailable) {
475
+ this._lineGroupsByPosition[position] = lineGroup;
476
+ lineGroup.updatePosition(position);
477
+ return;
478
+ }
479
+
480
+ delete this._lineGroupsByPosition[lineGroup.getPosition()];
481
+
482
+ var currentPos;
483
+ const newLinesByPosition = Object.assign({},this._lineGroupsByPosition);
484
+
485
+ // This code assumes that lines are ordered in ascending order of position
486
+ // This is the case as the keys are integers
487
+ for (var pos in this._lineGroupsByPosition) {
488
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, pos)) {
489
+ currentPos = parseInt(pos, 10);
490
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position) && currentPos >= position) {
491
+ var newPosition = currentPos + 1;
492
+
493
+ this._lineGroupsByPosition[currentPos].updatePosition(newPosition);
494
+ newLinesByPosition[newPosition] = this._lineGroupsByPosition[currentPos];
495
+
496
+ if (!this._lineGroupsByPosition[newPosition]) {
497
+ break;
498
+ }
499
+ }
500
+ }
501
+ }
502
+
503
+ lineGroup.updatePosition(position);
504
+ newLinesByPosition[position] = lineGroup;
505
+ this._lineGroupsByPosition = newLinesByPosition;
506
+ };
507
+
508
+ LineGroups.prototype._createLineGroup = function(line) {
509
+ const lineGroup = new LineGroup(this._peaks, this._view, line);
510
+
511
+ this._lineGroupsById[line.id] = lineGroup;
512
+
513
+ this._setLinePosition(line.id, line.position);
514
+
515
+ this._lineIndicator.addIndicator(lineGroup);
516
+
517
+ if (this._autoAddToLayer) {
518
+ lineGroup.addToLayer(this._layer);
519
+ }
520
+
521
+ this._setInteractions(line.id);
522
+ this.refreshLineYs();
523
+
524
+ return line.id;
525
+ };
526
+
527
+ LineGroups.prototype.updateSegments = function(frameStartTime, frameEndTime) {
528
+ for (var lineId in this._segmentsGroups) {
529
+ if (Utils.objectHasProperty(this._segmentsGroups, lineId)) {
530
+ this._segmentsGroups[lineId].updateSegments(frameStartTime, frameEndTime);
531
+ }
532
+ }
533
+ };
534
+
535
+ LineGroups.prototype.manageCollision = function(sources, newStartTime, newEndTime) {
536
+ return this._lineGroupsById[sources[0].lineId].manageCollision(sources, newStartTime, newEndTime);
537
+ };
538
+
539
+ LineGroups.prototype.manageOrder = function(sources, startTime, endTime) {
540
+ // Assuming all ordered elements have the same position
541
+ return this._lineGroupsById[sources[0].lineId].manageOrder(sources, startTime, endTime);
542
+ };
543
+
544
+ LineGroups.prototype._setInteractions = function(lineId) {
545
+ const lineGroup = this._lineGroupsById[lineId];
546
+
547
+ if (this._areInteractionsOverridden) {
548
+ lineGroup.allowInteractions(this._areInteractionsAllowed);
549
+ }
550
+ else {
551
+ lineGroup.allowInteractions(
552
+ lineGroup.isSegmentsLine() ?
553
+ this._areSegmentInteractionsAllowed :
554
+ this._areSourceInteractionsAllowed
555
+ );
556
+ }
557
+ };
558
+
559
+ LineGroups.prototype.overrideInteractions = function(bool, areInteractionsAllowed) {
560
+ this._areInteractionsOverridden = typeof bool !== 'undefined' ?
561
+ bool : this._areInteractionsOverridden;
562
+ this._areInteractionsAllowed = typeof areInteractionsAllowed !== 'undefined' ?
563
+ areInteractionsAllowed : this._areInteractionsAllowed;
564
+ for (var id in this._lineGroupsById) {
565
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
566
+ this._setInteractions(id);
567
+ }
568
+ }
569
+ };
570
+
571
+ LineGroups.prototype.allowInteractions = function(forSources, forSegments) {
572
+ this._areSourceInteractionsAllowed = typeof forSources !== 'undefined' ?
573
+ forSources : this._areSourceInteractionsAllowed;
574
+ this._areSegmentInteractionsAllowed = typeof forSegments !== 'undefined' ?
575
+ forSegments : this._areSegmentInteractionsAllowed;
576
+ for (var id in this._lineGroupsById) {
577
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
578
+ this._setInteractions(id);
579
+ }
580
+ }
581
+ };
582
+
583
+ return LineGroups;
584
+ });