@checksub_team/peaks_timeline 1.16.1 → 2.0.0-alpha.2

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 (37) hide show
  1. package/package.json +1 -1
  2. package/peaks.js +4716 -4409
  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/components/line-group.js +692 -0
  9. package/src/components/line-groups.js +585 -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 -801
  17. package/src/{source-group.js → components/source-group.js} +1661 -1640
  18. package/src/{sources-layer.js → components/sources-layer.js} +716 -730
  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 +110 -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} +1311 -1315
  27. package/src/player.js +2 -2
  28. package/src/{timeline-segments.js → segment-handler.js} +435 -435
  29. package/src/{timeline-sources.js → source-handler.js} +521 -514
  30. package/src/utils.js +5 -1
  31. package/src/{timeline-zoomview.js → view.js} +136 -137
  32. package/src/line.js +0 -690
  33. package/src/lines.js +0 -427
  34. /package/src/{data.js → components/data.js} +0 -0
  35. /package/src/{loader.js → components/loader.js} +0 -0
  36. /package/src/{mouse-drag-handler.js → components/mouse-drag-handler.js} +0 -0
  37. /package/src/{svgs.js → components/svgs.js} +0 -0
@@ -0,0 +1,585 @@
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(segmentsGroupId, lineId) {
163
+ const lineGroup = this._lineGroupsById[lineId];
164
+
165
+ lineGroup.allowInteractions(this._areSegmentInteractionsAllowed);
166
+ lineGroup.addSegments(this._segmentsGroups[segmentsGroupId]);
167
+
168
+ this._segmentsGroupToLine[segmentsGroupId] = lineGroup;
169
+
170
+ this._setInteractions(lineGroup.getId());
171
+
172
+ this.refreshLineYs();
173
+ };
174
+
175
+ LineGroups.prototype.removeSource = function(source) {
176
+ if (!this._lineGroupsById[source.lineId]) {
177
+ return null;
178
+ }
179
+
180
+ return this._lineGroupsById[source.lineId].removeSource(source);
181
+ };
182
+
183
+ LineGroups.prototype.removeSourceGroup = function(source) {
184
+ if (!this._lineGroupsById[source.lineId]) {
185
+ return null;
186
+ }
187
+
188
+ return this._lineGroupsById[source.lineId].removeSourceGroup(source);
189
+ };
190
+
191
+ LineGroups.prototype._removeLine = function(line) {
192
+ var lineGroup = this._lineGroupsById[line.id];
193
+
194
+ if (this._automaticallyCreatedLineId === line.id) {
195
+ this._automaticallyCreatedLineId = null;
196
+ }
197
+ lineGroup.destroy();
198
+
199
+ delete this._lineGroupsByPosition[line.position];
200
+ delete this._lineGroupsById[line.id];
201
+
202
+ this._lineIndicator.removeIndicator(line.id, false);
203
+ this.refreshLineYs();
204
+
205
+ return lineGroup;
206
+ };
207
+
208
+ LineGroups.prototype.isLineVisible = function(lineId) {
209
+ return this._lineGroupsById[lineId] ? this._lineGroupsById[lineId].isVisible() : false;
210
+ };
211
+
212
+ LineGroups.prototype.getVisibleLines = function() {
213
+ var lineIds = {};
214
+
215
+ for (var id in this._lineGroupsById) {
216
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
217
+ if (this._lineGroupsById[id].isVisible()) {
218
+ lineIds[id] = true;
219
+ }
220
+ }
221
+ }
222
+ return lineIds;
223
+ };
224
+
225
+ LineGroups.prototype.getSourcesOnLineAfter = function(lineId, time) {
226
+ return this._lineGroupsById[lineId].getSourcesAfter(time);
227
+ };
228
+
229
+ LineGroups.prototype.getSegmentsGroups = function() {
230
+ return this._segmentsGroups;
231
+ };
232
+
233
+ LineGroups.prototype.addToLayer = function(layer) {
234
+ for (var id in this._lineGroupsById) {
235
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
236
+ this._lineGroupsById[id].addToLayer(layer);
237
+ }
238
+ }
239
+
240
+ this._autoAddToLayer = true;
241
+ };
242
+
243
+ LineGroups.prototype.height = function() {
244
+ var height = 2 * this._peaks.options.padding;
245
+
246
+ for (var position in this._lineGroupsByPosition) {
247
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
248
+ height += this._lineGroupsByPosition[position].lineHeight() + this._peaks.options.interline;
249
+ }
250
+ }
251
+
252
+ height -= this._peaks.options.interline;
253
+
254
+ return height;
255
+ };
256
+
257
+ LineGroups.prototype.linesLength = function() {
258
+ var length = 0;
259
+
260
+ for (var position in this._lineGroupsByPosition) {
261
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
262
+ var lineLength = this._lineGroupsByPosition[position].lineLength();
263
+
264
+ if (lineLength > length) {
265
+ length = lineLength;
266
+ }
267
+ }
268
+ }
269
+
270
+ return length;
271
+ };
272
+
273
+ LineGroups.prototype.stopAutomaticLineCreation = function() {
274
+ if (this._automaticLineCreationTimeout) {
275
+ clearTimeout(this._automaticLineCreationTimeout);
276
+ }
277
+ this._automaticLineCreationTimeout = null;
278
+ this._automaticLineCreationPosition = null;
279
+ this._automaticallyCreatedLineId = null;
280
+ };
281
+
282
+ LineGroups.prototype.manageAutomaticLineCreation = function(newLinePosition, initialPosition, sources) {
283
+ if (!Utils.isNullOrUndefined(this._automaticallyCreatedLineId)) {
284
+ return;
285
+ }
286
+ else if (
287
+ !Utils.isNullOrUndefined(this._automaticLineCreationPosition)
288
+ && this._automaticLineCreationPosition !== newLinePosition
289
+ ) {
290
+ this.stopAutomaticLineCreation();
291
+ }
292
+
293
+ if (this._automaticLineCreationTimeout) {
294
+ return;
295
+ }
296
+
297
+ this._automaticLineCreationPosition = newLinePosition;
298
+ this._automaticLineCreationTimeout = setTimeout(function() {
299
+ this._automaticLineCreationTimeout = null;
300
+
301
+ var currentLine = this._lineGroupsByPosition[initialPosition];
302
+
303
+ sources = sources.filter(function(source) {
304
+ return currentLine.hasSource(source.id);
305
+ });
306
+
307
+ if (sources.length === 0 || sources.length === currentLine.countRemainingElements()) {
308
+ this.stopAutomaticLineCreation();
309
+ return;
310
+ }
311
+
312
+ this._peaks.addLine({
313
+ position: newLinePosition,
314
+ indicatorType: this._peaks.options.defaultLineIndicatorType,
315
+ indicatorText: this._peaks.options.defaultLineIndicatorText
316
+ }, true);
317
+ const automaticallyCreatedLineGroup = this._lineGroupsByPosition[newLinePosition];
318
+
319
+ if (!automaticallyCreatedLineGroup) {
320
+ this._peaks.logger(
321
+ 'peaks.lines.manageAutomaticLineCreation(): line group not found for position ' + newLinePosition
322
+ );
323
+ return;
324
+ }
325
+
326
+ this._automaticallyCreatedLineId = automaticallyCreatedLineGroup.getId();
327
+ this._moveSourcesToPositionIfPossible(sources, newLinePosition);
328
+ }.bind(this), this._peaks.options.automaticLineCreationDelay);
329
+ };
330
+
331
+ LineGroups.prototype.manageVerticalPosition = function(sources, startTime, endTime, mouseX, mouseY) {
332
+ if (Utils.isNullOrUndefined(mouseX)) {
333
+ return;
334
+ }
335
+
336
+ const position = this._lineGroupsById[sources[0].lineId].getPosition();
337
+ const linePos = this.getLinesUnderY(mouseY);
338
+
339
+ if (linePos[0] !== linePos[1]) {
340
+ this.manageAutomaticLineCreation(linePos[0] + 1, position, sources);
341
+ }
342
+ else {
343
+ this.stopAutomaticLineCreation();
344
+
345
+ if (
346
+ !Utils.isNullOrUndefined(mouseX)
347
+ && linePos[0] !== position
348
+ && !this._lineGroupsByPosition[linePos[0]].isSegmentsLine()
349
+ ) {
350
+ var mouseTime = this._view.pixelsToTime(mouseX + this._view.getFrameOffset());
351
+ var sourceDuration = Utils.roundTime(endTime - startTime);
352
+
353
+ this._moveSourcesToPositionIfPossible(sources, linePos[0], mouseTime, sourceDuration);
354
+ }
355
+ }
356
+ };
357
+
358
+ LineGroups.prototype._hasSpaceForSourceAt = function(sourcesAround, sourceDuration) {
359
+ if (sourcesAround.overlapping) {
360
+ return false;
361
+ }
362
+ else if (!sourcesAround.right) {
363
+ return true;
364
+ }
365
+ else {
366
+ var leftLimit = sourcesAround.left ? sourcesAround.left.endTime : 0;
367
+ var rightLimit = sourcesAround.right.startTime;
368
+
369
+ return sourceDuration <= Utils.roundTime(rightLimit - leftLimit);
370
+ }
371
+ };
372
+
373
+ LineGroups.prototype.getLineByPosition = function(pos) {
374
+ return this._lineGroupsByPosition[pos];
375
+ };
376
+
377
+ LineGroups.prototype.getLastPosition = function() {
378
+ var keys = Object.keys(this._lineGroupsByPosition);
379
+
380
+ return keys.pop();
381
+ };
382
+
383
+ LineGroups.prototype.getLinesUnderY = function(y) {
384
+ var height;
385
+ var pos = [-1, this.getLastPosition() + 1];
386
+
387
+ for (var position in this._lineGroupsByPosition) {
388
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
389
+ height = this._lineGroupsByPosition[position].lineHeight();
390
+
391
+ if (y > this._lineGroupsByPosition[position].y()) {
392
+ pos[0] = Math.max(pos[0], parseInt(position, 10));
393
+ }
394
+
395
+ if (y < this._lineGroupsByPosition[position].y() + height) {
396
+ pos[1] = Math.min(pos[1], parseInt(position, 10));
397
+ }
398
+ }
399
+ }
400
+
401
+ return pos;
402
+ };
403
+
404
+ LineGroups.prototype._moveSourcesToPositionIfPossible = function(sources, targetPosition, targetTime,
405
+ sourcesDuration
406
+ ) {
407
+ const lineGroup = this._lineGroupsByPosition[targetPosition];
408
+
409
+ if (!lineGroup || lineGroup.isSegmentsLine()) {
410
+ return false;
411
+ }
412
+
413
+ if (Utils.isNullOrUndefined(targetTime)) {
414
+ targetTime = sources[0].startTime;
415
+ }
416
+
417
+ const sourcesAround = lineGroup.getSourcesAround(targetTime);
418
+
419
+ if (!this._hasSpaceForSourceAt(sourcesAround, sourcesDuration)) {
420
+ return false;
421
+ }
422
+
423
+ this._moveSourcesToLine(sources, sourcesAround, lineGroup.getId());
424
+ return true;
425
+ };
426
+
427
+ // This code assumes that all sources belong to a single line
428
+ // and are sorted by their start time
429
+ LineGroups.prototype._moveSourcesToLine = function(sources, sourcesAround, targetLineId) {
430
+ sources.forEach(function(source) {
431
+ const sourceGroup = this.removeSource(source);
432
+
433
+ source.lineId = targetLineId;
434
+
435
+ this.addSource(source, sourceGroup, sourcesAround);
436
+ sourcesAround.left = source;
437
+ }.bind(this));
438
+
439
+ this.refreshLineYs();
440
+ };
441
+
442
+ LineGroups.prototype.refreshLineYs = function() {
443
+ var y = this._peaks.options.padding - this._view.getFrameOffsetY();
444
+ var anyChange = false;
445
+
446
+ // This code assumes that lines are ordered in ascending order of position
447
+ // This is the case as the keys are integers
448
+ for (var position in this._lineGroupsByPosition) {
449
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
450
+ if (this._lineGroupsByPosition[position].y() !== y) {
451
+ anyChange = true;
452
+ this._lineGroupsByPosition[position].y(y);
453
+ }
454
+ y += this._lineGroupsByPosition[position].lineHeight() + this._peaks.options.interline;
455
+ }
456
+ }
457
+
458
+ if (anyChange && this._lineIndicator.refreshIndicators()) {
459
+ this._lineIndicator.draw();
460
+ }
461
+ };
462
+
463
+ LineGroups.prototype._setLinePosition = function(lineId, position) {
464
+ const lineGroup = this._lineGroupsById[lineId];
465
+
466
+ if (!lineGroup || position === lineGroup.getPosition()) {
467
+ return;
468
+ }
469
+
470
+ const isPositionAvailable = Utils.isNullOrUndefined(this._lineGroupsByPosition[position]);
471
+
472
+ if (isPositionAvailable) {
473
+ this._lineGroupsByPosition[position] = lineGroup;
474
+ lineGroup.updatePosition(position);
475
+ return;
476
+ }
477
+
478
+ delete this._lineGroupsByPosition[lineGroup.getPosition()];
479
+
480
+ var currentPos;
481
+ const newLinesByPosition = Object.assign({},this._lineGroupsByPosition);
482
+
483
+ // This code assumes that lines are ordered in ascending order of position
484
+ // This is the case as the keys are integers
485
+ for (var pos in this._lineGroupsByPosition) {
486
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, pos)) {
487
+ currentPos = parseInt(pos, 10);
488
+ if (Utils.objectHasProperty(this._lineGroupsByPosition, position) && currentPos >= position) {
489
+ var newPosition = currentPos + 1;
490
+
491
+ this._lineGroupsByPosition[currentPos].updatePosition(newPosition);
492
+ newLinesByPosition[newPosition] = this._lineGroupsByPosition[currentPos];
493
+
494
+ if (!this._lineGroupsByPosition[newPosition]) {
495
+ break;
496
+ }
497
+ }
498
+ }
499
+ }
500
+
501
+ lineGroup.updatePosition(position);
502
+ newLinesByPosition[position] = lineGroup;
503
+ this._lineGroupsByPosition = newLinesByPosition;
504
+ };
505
+
506
+ LineGroups.prototype._createLineGroup = function(line) {
507
+ const lineGroup = new LineGroup(this._peaks, this._view, line);
508
+
509
+ this._lineGroupsById[line.id] = lineGroup;
510
+
511
+ this._setLinePosition(line.id, line.position);
512
+
513
+ this._lineIndicator.addIndicator(lineGroup);
514
+
515
+ if (this._autoAddToLayer) {
516
+ lineGroup.addToLayer(this._layer);
517
+ }
518
+
519
+ this._setInteractions(line.id);
520
+ this.refreshLineYs();
521
+
522
+ return line.id;
523
+ };
524
+
525
+ LineGroups.prototype.updateSegments = function(frameStartTime, frameEndTime) {
526
+ for (var lineId in this._segmentsGroups) {
527
+ if (Utils.objectHasProperty(this._segmentsGroups, lineId)) {
528
+ this._segmentsGroups[lineId].updateSegments(frameStartTime, frameEndTime);
529
+ }
530
+ }
531
+ };
532
+
533
+ LineGroups.prototype.manageCollision = function(sources, newStartTime, newEndTime) {
534
+ return this._lineGroupsById[sources[0].lineId].manageCollision(sources, newStartTime, newEndTime);
535
+ };
536
+
537
+ LineGroups.prototype.manageOrder = function(sources, startTime, endTime) {
538
+ // Assuming all ordered elements have the same position
539
+ return this._lineGroupsById[sources[0].lineId].manageOrder(sources, startTime, endTime);
540
+ };
541
+
542
+ LineGroups.prototype._setInteractions = function(lineId) {
543
+ const lineGroup = this._lineGroupsById[lineId];
544
+
545
+ if (this._areInteractionsOverridden) {
546
+ lineGroup.allowInteractions(this._areInteractionsAllowed);
547
+ }
548
+ else {
549
+ lineGroup.allowInteractions(
550
+ lineGroup.isSegmentsLine() ?
551
+ this._areSegmentInteractionsAllowed :
552
+ this._areSourceInteractionsAllowed
553
+ );
554
+ }
555
+ };
556
+
557
+ LineGroups.prototype.overrideInteractions = function(bool, areInteractionsAllowed) {
558
+ this._areInteractionsOverridden = typeof bool !== 'undefined' ?
559
+ bool : this._areInteractionsOverridden;
560
+ this._areInteractionsAllowed = typeof areInteractionsAllowed !== 'undefined' ?
561
+ areInteractionsAllowed : this._areInteractionsAllowed;
562
+ for (var id in this._lineGroupsById) {
563
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
564
+ this._setInteractions(id);
565
+ }
566
+ }
567
+ };
568
+
569
+ LineGroups.prototype.allowInteractions = function(forSources, forSegments) {
570
+ this._areSourceInteractionsAllowed = !Utils.isNullOrUndefined(forSources) ?
571
+ forSources : this._areSourceInteractionsAllowed;
572
+ this._areSegmentInteractionsAllowed = !Utils.isNullOrUndefined(forSegments) ?
573
+ forSegments : this._areSegmentInteractionsAllowed;
574
+ console.log('peaks.lines.allowInteractions(): ' +
575
+ 'forSources: ' + this._areSourceInteractionsAllowed + ', forSegments: ' + this._areSegmentInteractionsAllowed
576
+ );
577
+ for (var id in this._lineGroupsById) {
578
+ if (Utils.objectHasProperty(this._lineGroupsById, id)) {
579
+ this._setInteractions(id);
580
+ }
581
+ }
582
+ };
583
+
584
+ return LineGroups;
585
+ });