@checksub_team/peaks_timeline 1.4.25 → 1.4.28
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.
- package/package.json +1 -1
- package/peaks.js +269 -85
- package/src/line.js +38 -1
- package/src/lines.js +62 -5
- package/src/main.js +30 -3
- package/src/mode-layer.js +47 -17
- package/src/playhead-layer.js +36 -26
- package/src/segment-shape.js +10 -1
- package/src/segment.js +30 -6
- package/src/segments-group.js +30 -16
- package/src/source.js +1 -1
- package/src/sources-layer.js +39 -8
- package/src/timeline-segments.js +7 -5
- package/src/timeline-zoomview.js +13 -1
package/peaks.js
CHANGED
|
@@ -14754,6 +14754,35 @@ module.exports = function (Konva, Utils) {
|
|
|
14754
14754
|
Line.prototype.lineHeight = function () {
|
|
14755
14755
|
return this._height;
|
|
14756
14756
|
};
|
|
14757
|
+
Line.prototype.changeHeight = function (from, to) {
|
|
14758
|
+
if (this._sourceHeights[from]) {
|
|
14759
|
+
var oldHeight = this._height;
|
|
14760
|
+
if (this._sourceHeights[to]) {
|
|
14761
|
+
this._sourceHeights[to] += this._sourceHeights[from];
|
|
14762
|
+
} else {
|
|
14763
|
+
this._sourceHeights[to] = this._sourceHeights[from];
|
|
14764
|
+
}
|
|
14765
|
+
if (to > this._height) {
|
|
14766
|
+
this._height = to;
|
|
14767
|
+
} else if (from === this._height) {
|
|
14768
|
+
this._height = 0;
|
|
14769
|
+
for (var height in this._sourceHeights) {
|
|
14770
|
+
if (Utils.objectHasProperty(this._sourceHeights, height)) {
|
|
14771
|
+
var parsedHeight = parseInt(height, 10);
|
|
14772
|
+
if (parsedHeight !== from) {
|
|
14773
|
+
if (parsedHeight > this._height) {
|
|
14774
|
+
this._height = parsedHeight;
|
|
14775
|
+
}
|
|
14776
|
+
}
|
|
14777
|
+
}
|
|
14778
|
+
}
|
|
14779
|
+
}
|
|
14780
|
+
if (this._height !== oldHeight) {
|
|
14781
|
+
this._peaks.emit('line.heightChanged', this._position);
|
|
14782
|
+
}
|
|
14783
|
+
delete this._sourceHeights[from];
|
|
14784
|
+
}
|
|
14785
|
+
};
|
|
14757
14786
|
Line.prototype.updateLineHeight = function (sourceGroup, action) {
|
|
14758
14787
|
var oldHeight = this._height;
|
|
14759
14788
|
var sourceGroupHeight;
|
|
@@ -14782,7 +14811,7 @@ module.exports = function (Konva, Utils) {
|
|
|
14782
14811
|
for (var height in this._sourceHeights) {
|
|
14783
14812
|
if (Utils.objectHasProperty(this._sourceHeights, height)) {
|
|
14784
14813
|
var parsedHeight = parseInt(height, 10);
|
|
14785
|
-
if (
|
|
14814
|
+
if (parsedHeight > this._height) {
|
|
14786
14815
|
this._height = parsedHeight;
|
|
14787
14816
|
}
|
|
14788
14817
|
}
|
|
@@ -15117,7 +15146,7 @@ module.exports = function (Konva, Utils) {
|
|
|
15117
15146
|
return Line;
|
|
15118
15147
|
}(_dereq_('konva'), _dereq_('./utils'));
|
|
15119
15148
|
},{"./utils":110,"konva":43}],92:[function(_dereq_,module,exports){
|
|
15120
|
-
module.exports = function (Line, LineIndicator, Utils) {
|
|
15149
|
+
module.exports = function (SegmentsGroup, Line, LineIndicator, Utils) {
|
|
15121
15150
|
'use strict';
|
|
15122
15151
|
function Lines(peaks, view, layer) {
|
|
15123
15152
|
this._peaks = peaks;
|
|
@@ -15128,12 +15157,42 @@ module.exports = function (Line, LineIndicator, Utils) {
|
|
|
15128
15157
|
this._autoAddToLayer = false;
|
|
15129
15158
|
this._areSourceInteractionsAllowed = true;
|
|
15130
15159
|
this._areSegmentInteractionsAllowed = true;
|
|
15160
|
+
this._segmentsGroups = {};
|
|
15131
15161
|
this._lineId = 0;
|
|
15132
15162
|
this._lineIndicator = new LineIndicator(peaks, view, document.getElementById('line-indicator-container'));
|
|
15133
15163
|
this._peaks.on('line.heightChanged', this._onLineHeightChanged.bind(this));
|
|
15134
15164
|
this._peaks.on('line.add', this._onLineAdd.bind(this));
|
|
15135
15165
|
this._peaks.on('line.remove', this._onLineRemove.bind(this));
|
|
15166
|
+
this._peaks.on('segment.updated', this._onSegmentsUpdate.bind(this));
|
|
15167
|
+
this._peaks.on('segments.add', this._onSegmentsAdd.bind(this));
|
|
15168
|
+
this._peaks.on('segments.remove', this._onSegmentsRemove.bind(this));
|
|
15169
|
+
this._peaks.on('segments.remove_all', this._onSegmentsRemoveAll.bind(this));
|
|
15170
|
+
this._peaks.on('segments.dragend', this._onSegmentUpdated.bind(this));
|
|
15136
15171
|
}
|
|
15172
|
+
Lines.prototype._onSegmentsAdd = function (segments) {
|
|
15173
|
+
var self = this;
|
|
15174
|
+
segments.forEach(function (segment) {
|
|
15175
|
+
if (!self._segmentsGroups[segment.line]) {
|
|
15176
|
+
self._segmentsGroups[segment.line] = new SegmentsGroup(self._peaks, self._view, true);
|
|
15177
|
+
}
|
|
15178
|
+
self._segmentsGroups[segment.line].onSegmentsAdd([segment]);
|
|
15179
|
+
});
|
|
15180
|
+
};
|
|
15181
|
+
Lines.prototype._onSegmentsUpdate = function (segment) {
|
|
15182
|
+
this._segmentsGroups[segment.line].onSegmentsUpdate(segment);
|
|
15183
|
+
};
|
|
15184
|
+
Lines.prototype._onSegmentUpdated = function (segment) {
|
|
15185
|
+
this._segmentsGroups[segment.line].onSegmentUpdated();
|
|
15186
|
+
};
|
|
15187
|
+
Lines.prototype._onSegmentsRemove = function (segments) {
|
|
15188
|
+
var self = this;
|
|
15189
|
+
segments.forEach(function (segment) {
|
|
15190
|
+
self._segmentsGroups[segment.line].onSegmentsRemove([segment]);
|
|
15191
|
+
});
|
|
15192
|
+
};
|
|
15193
|
+
Lines.prototype._onSegmentsRemoveAll = function (lineId) {
|
|
15194
|
+
this._segmentsGroups[lineId].onSegmentsRemoveAll();
|
|
15195
|
+
};
|
|
15137
15196
|
Lines.prototype._onLineHeightChanged = function (position) {
|
|
15138
15197
|
this._updateLinesPosition(position);
|
|
15139
15198
|
this._view.updateTimeline();
|
|
@@ -15148,6 +15207,15 @@ module.exports = function (Line, LineIndicator, Utils) {
|
|
|
15148
15207
|
var lineNewY = oldLine.getY();
|
|
15149
15208
|
this._updateLinesPosition(position, lineNewY);
|
|
15150
15209
|
};
|
|
15210
|
+
Lines.prototype.changeLineHeight = function (from, to) {
|
|
15211
|
+
for (var position in this._linesByPosition) {
|
|
15212
|
+
if (Utils.objectHasProperty(this._linesByPosition, position)) {
|
|
15213
|
+
if (!this._linesByPosition[position].isSegmentsLine()) {
|
|
15214
|
+
this._linesByPosition[position].changeHeight(from, to);
|
|
15215
|
+
}
|
|
15216
|
+
}
|
|
15217
|
+
}
|
|
15218
|
+
};
|
|
15151
15219
|
Lines.prototype.addSourceGroup = function (sourceGroup, position) {
|
|
15152
15220
|
if (!this._linesByPosition[position]) {
|
|
15153
15221
|
this._createLine(position);
|
|
@@ -15157,11 +15225,10 @@ module.exports = function (Line, LineIndicator, Utils) {
|
|
|
15157
15225
|
this._linesByPosition[position].addSourceGroup(sourceGroup);
|
|
15158
15226
|
this._linesBySourceId[sourceGroup.getSource().id] = this._linesByPosition[position];
|
|
15159
15227
|
};
|
|
15160
|
-
Lines.prototype.addSegments = function (
|
|
15228
|
+
Lines.prototype.addSegments = function (lineId, position) {
|
|
15161
15229
|
this._createLine(position);
|
|
15162
15230
|
this._linesByPosition[position].allowInteractions(this._areSegmentInteractionsAllowed);
|
|
15163
|
-
this._linesByPosition[position].addSegments(
|
|
15164
|
-
this._segmentsLine = this._linesByPosition[position];
|
|
15231
|
+
this._linesByPosition[position].addSegments(this._segmentsGroups[lineId]);
|
|
15165
15232
|
this._setInteractions(position);
|
|
15166
15233
|
this._updateLinesPosition(position);
|
|
15167
15234
|
};
|
|
@@ -15194,6 +15261,9 @@ module.exports = function (Line, LineIndicator, Utils) {
|
|
|
15194
15261
|
}
|
|
15195
15262
|
return positions;
|
|
15196
15263
|
};
|
|
15264
|
+
Lines.prototype.getSegmentsGroups = function () {
|
|
15265
|
+
return this._segmentsGroups;
|
|
15266
|
+
};
|
|
15197
15267
|
Lines.prototype.addToLayer = function (layer) {
|
|
15198
15268
|
for (var position in this._linesByPosition) {
|
|
15199
15269
|
if (Utils.objectHasProperty(this._linesByPosition, position)) {
|
|
@@ -15326,8 +15396,10 @@ module.exports = function (Line, LineIndicator, Utils) {
|
|
|
15326
15396
|
this._linesByPosition = newLinesByPosition;
|
|
15327
15397
|
};
|
|
15328
15398
|
Lines.prototype.updateSegments = function (frameStartTime, frameEndTime) {
|
|
15329
|
-
|
|
15330
|
-
this.
|
|
15399
|
+
for (var lineId in this._segmentsGroups) {
|
|
15400
|
+
if (Utils.objectHasProperty(this._segmentsGroups, lineId)) {
|
|
15401
|
+
this._segmentsGroups[lineId].updateSegments(frameStartTime, frameEndTime);
|
|
15402
|
+
}
|
|
15331
15403
|
}
|
|
15332
15404
|
};
|
|
15333
15405
|
Lines.prototype.manageCollision = function (source, newStartX, newEndX) {
|
|
@@ -15363,8 +15435,8 @@ module.exports = function (Line, LineIndicator, Utils) {
|
|
|
15363
15435
|
}
|
|
15364
15436
|
};
|
|
15365
15437
|
return Lines;
|
|
15366
|
-
}(_dereq_('./line'), _dereq_('./line-indicator'), _dereq_('./utils'));
|
|
15367
|
-
},{"./line":91,"./line-indicator":90,"./utils":110}],93:[function(_dereq_,module,exports){
|
|
15438
|
+
}(_dereq_('./segments-group'), _dereq_('./line'), _dereq_('./line-indicator'), _dereq_('./utils'));
|
|
15439
|
+
},{"./line":91,"./line-indicator":90,"./segments-group":102,"./utils":110}],93:[function(_dereq_,module,exports){
|
|
15368
15440
|
module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSources, KeyboardHandler, Player, MarkerFactories, TimelineZoomView, Utils) {
|
|
15369
15441
|
'use strict';
|
|
15370
15442
|
function Peaks() {
|
|
@@ -15541,8 +15613,11 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15541
15613
|
Peaks.prototype.hideSource = function (sourceId) {
|
|
15542
15614
|
this.sources.hideById(sourceId);
|
|
15543
15615
|
};
|
|
15544
|
-
Peaks.prototype.showSegments = function (position) {
|
|
15545
|
-
this.segments.addSegmentsToPosition(position);
|
|
15616
|
+
Peaks.prototype.showSegments = function (lineId, position) {
|
|
15617
|
+
this.segments.addSegmentsToPosition(lineId, position);
|
|
15618
|
+
};
|
|
15619
|
+
Peaks.prototype.destroySegment = function (segmentId) {
|
|
15620
|
+
this.segments.removeById(segmentId);
|
|
15546
15621
|
};
|
|
15547
15622
|
Peaks.prototype.setDefaultMode = function () {
|
|
15548
15623
|
this.emit('default_mode');
|
|
@@ -15562,6 +15637,12 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15562
15637
|
Peaks.prototype.allowInteractions = function (forSources, forSegments) {
|
|
15563
15638
|
return this.view.allowInteractions(forSources, forSegments);
|
|
15564
15639
|
};
|
|
15640
|
+
Peaks.prototype.selectSourceById = function (sourceId) {
|
|
15641
|
+
return this.view.selectSourceById(sourceId);
|
|
15642
|
+
};
|
|
15643
|
+
Peaks.prototype.deselectSource = function () {
|
|
15644
|
+
return this.view.deselectElement();
|
|
15645
|
+
};
|
|
15565
15646
|
Peaks.prototype._addWindowResizeHandler = function () {
|
|
15566
15647
|
this._onResize = this._onResize.bind(this);
|
|
15567
15648
|
window.addEventListener('resize', this._onResize);
|
|
@@ -15572,6 +15653,11 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15572
15653
|
Peaks.prototype._removeWindowResizeHandler = function () {
|
|
15573
15654
|
window.removeEventListener('resize', this._onResize);
|
|
15574
15655
|
};
|
|
15656
|
+
Peaks.prototype.setLineHeight = function (newLineHeight) {
|
|
15657
|
+
var oldHeight = this.options.lineHeight;
|
|
15658
|
+
this.options.lineHeight = newLineHeight;
|
|
15659
|
+
this.emit('options.set.line_height', oldHeight);
|
|
15660
|
+
};
|
|
15575
15661
|
Peaks.prototype.destroy = function () {
|
|
15576
15662
|
this._removeWindowResizeHandler();
|
|
15577
15663
|
if (this.keyboardHandler) {
|
|
@@ -15644,6 +15730,33 @@ module.exports = function (Utils, SourceGroup, Konva) {
|
|
|
15644
15730
|
ModeLayer.prototype.addToStage = function (stage) {
|
|
15645
15731
|
stage.add(this._layer);
|
|
15646
15732
|
};
|
|
15733
|
+
ModeLayer.prototype.selectElement = function (element, notify) {
|
|
15734
|
+
this.deselectElement(notify);
|
|
15735
|
+
if (element) {
|
|
15736
|
+
this._selectedElement = element;
|
|
15737
|
+
this._selectedElement.setSelected(true);
|
|
15738
|
+
if (notify) {
|
|
15739
|
+
if (element instanceof SourceGroup) {
|
|
15740
|
+
this._peaks.emit('source.selected', this._selectedElement.getSource());
|
|
15741
|
+
} else {
|
|
15742
|
+
this._peaks.emit('segment.selected', this._selectedElement.getSegment());
|
|
15743
|
+
}
|
|
15744
|
+
}
|
|
15745
|
+
}
|
|
15746
|
+
};
|
|
15747
|
+
ModeLayer.prototype.deselectElement = function (notify) {
|
|
15748
|
+
if (this._selectedElement) {
|
|
15749
|
+
this._selectedElement.setSelected(false);
|
|
15750
|
+
if (notify) {
|
|
15751
|
+
if (this._selectedElement instanceof SourceGroup) {
|
|
15752
|
+
this._peaks.emit('source.deselected', this._selectedElement.getSource());
|
|
15753
|
+
} else {
|
|
15754
|
+
this._peaks.emit('segment.deselected', this._selectedElement.getSegment());
|
|
15755
|
+
}
|
|
15756
|
+
}
|
|
15757
|
+
this._selectedElement = null;
|
|
15758
|
+
}
|
|
15759
|
+
};
|
|
15647
15760
|
ModeLayer.prototype._prepareDefaultMode = function () {
|
|
15648
15761
|
this._selectedElement = null;
|
|
15649
15762
|
};
|
|
@@ -15695,21 +15808,22 @@ module.exports = function (Utils, SourceGroup, Konva) {
|
|
|
15695
15808
|
ModeLayer.prototype._onMouseClickInDefaultMode = function () {
|
|
15696
15809
|
var hoveredElement = this._view.getHoveredElement();
|
|
15697
15810
|
if (hoveredElement) {
|
|
15698
|
-
|
|
15699
|
-
this._selectedElement.setSelected(false);
|
|
15700
|
-
}
|
|
15701
|
-
this._selectedElement = hoveredElement;
|
|
15702
|
-
this._selectedElement.setSelected(true);
|
|
15811
|
+
this.selectElement(hoveredElement, true);
|
|
15703
15812
|
} else {
|
|
15704
|
-
|
|
15705
|
-
this._selectedElement.setSelected(false);
|
|
15706
|
-
this._selectedElement = null;
|
|
15707
|
-
}
|
|
15813
|
+
this.deselectElement(true);
|
|
15708
15814
|
}
|
|
15709
15815
|
};
|
|
15710
15816
|
ModeLayer.prototype._onKeyboardDelete = function () {
|
|
15711
|
-
if (this._selectedElement
|
|
15712
|
-
this.
|
|
15817
|
+
if (this._selectedElement) {
|
|
15818
|
+
var selectedElement = this._selectedElement;
|
|
15819
|
+
this.deselectElement(true);
|
|
15820
|
+
if (selectedElement instanceof SourceGroup) {
|
|
15821
|
+
this._peaks.destroySource(selectedElement.getSource().id);
|
|
15822
|
+
} else {
|
|
15823
|
+
if (selectedElement.getSegment().allowDeletion) {
|
|
15824
|
+
this._peaks.destroySegment(selectedElement.getSegment().id);
|
|
15825
|
+
}
|
|
15826
|
+
}
|
|
15713
15827
|
}
|
|
15714
15828
|
};
|
|
15715
15829
|
ModeLayer.prototype._onMouseEnterInCutMode = function () {
|
|
@@ -15825,12 +15939,9 @@ module.exports = function (Utils, SourceGroup, Konva) {
|
|
|
15825
15939
|
case 'default':
|
|
15826
15940
|
this._stage.off('click', this._onMouseClickInDefaultMode);
|
|
15827
15941
|
this._peaks.off('keyboard.delete', this._onKeyboardDelete);
|
|
15828
|
-
if (this._selectedElement) {
|
|
15829
|
-
this._selectedElement.setSelected(false);
|
|
15830
|
-
}
|
|
15831
15942
|
break;
|
|
15832
15943
|
}
|
|
15833
|
-
this.
|
|
15944
|
+
this.deselectElement(true);
|
|
15834
15945
|
switch (mode) {
|
|
15835
15946
|
case 'cut':
|
|
15836
15947
|
this._stage.on('mouseover', this._onMouseEnterInCutMode);
|
|
@@ -16052,18 +16163,18 @@ module.exports = function (Utils) {
|
|
|
16052
16163
|
module.exports = function (Utils, Konva) {
|
|
16053
16164
|
'use strict';
|
|
16054
16165
|
var HANDLE_RADIUS = 10;
|
|
16055
|
-
function PlayheadLayer(peaks, view,
|
|
16166
|
+
function PlayheadLayer(peaks, view, lines, showTime) {
|
|
16056
16167
|
this._peaks = peaks;
|
|
16057
16168
|
this._view = view;
|
|
16058
|
-
this.
|
|
16169
|
+
this._lines = lines;
|
|
16059
16170
|
this._playheadPixel = 0;
|
|
16060
16171
|
this._playheadLineAnimation = null;
|
|
16061
16172
|
this._playheadVisible = false;
|
|
16062
16173
|
this._playheadColor = peaks.options.playheadColor;
|
|
16063
16174
|
this._playheadTextColor = peaks.options.playheadTextColor;
|
|
16064
16175
|
this._playheadLayer = new Konva.Layer();
|
|
16065
|
-
this.
|
|
16066
|
-
this.
|
|
16176
|
+
this._activeSegments = {};
|
|
16177
|
+
this._lastActiveSegments = {};
|
|
16067
16178
|
this._createPlayhead(this._playheadColor);
|
|
16068
16179
|
if (showTime) {
|
|
16069
16180
|
this._createPlayheadText(this._playheadTextColor);
|
|
@@ -16074,20 +16185,20 @@ module.exports = function (Utils, Konva) {
|
|
|
16074
16185
|
this._peaks.on('segments.remove', this._onSegmentsRemove.bind(this));
|
|
16075
16186
|
}
|
|
16076
16187
|
PlayheadLayer.prototype._onSegmentsRemoveAll = function () {
|
|
16077
|
-
this.
|
|
16078
|
-
this.
|
|
16188
|
+
this._activeSegments = {};
|
|
16189
|
+
this._lastActiveSegments = {};
|
|
16079
16190
|
};
|
|
16080
16191
|
PlayheadLayer.prototype._onSegmentsRemove = function (segments) {
|
|
16081
|
-
if (this.
|
|
16082
|
-
var activeSegmentId = this._activeSegment ? this._activeSegment.id : null;
|
|
16083
|
-
var lastActiveSegmentId = this._lastActiveSegmentId ? this._lastActiveSegmentId.id : null;
|
|
16192
|
+
if (this._activeSegments || this._lastActiveSegments) {
|
|
16084
16193
|
for (var id in segments) {
|
|
16085
16194
|
if (Utils.objectHasProperty(segments, id)) {
|
|
16195
|
+
var activeSegmentId = this._activeSegments[segments[id].line] ? this._activeSegments[segments[id].line].id : null;
|
|
16196
|
+
var lastActiveSegmentId = this._lastActiveSegments[segments[id].line] ? this._lastActiveSegments[segments[id].line].id : null;
|
|
16086
16197
|
if (segments[id].id === activeSegmentId) {
|
|
16087
|
-
this.
|
|
16198
|
+
delete this._activeSegments[segments[id].line];
|
|
16088
16199
|
}
|
|
16089
16200
|
if (segments[id].id === lastActiveSegmentId) {
|
|
16090
|
-
this.
|
|
16201
|
+
delete this._lastActiveSegments[segments[id].line];
|
|
16091
16202
|
}
|
|
16092
16203
|
}
|
|
16093
16204
|
}
|
|
@@ -16205,16 +16316,21 @@ module.exports = function (Utils, Konva) {
|
|
|
16205
16316
|
}
|
|
16206
16317
|
var playheadPositionDiff = this._playheadGroup.x() - playheadX;
|
|
16207
16318
|
if (playheadPositionDiff) {
|
|
16208
|
-
var
|
|
16209
|
-
|
|
16210
|
-
if (
|
|
16211
|
-
this.
|
|
16212
|
-
this.
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16319
|
+
var segmentsGroup = this._lines.getSegmentsGroups();
|
|
16320
|
+
for (var lineId in segmentsGroup) {
|
|
16321
|
+
if (Utils.objectHasProperty(segmentsGroup, lineId)) {
|
|
16322
|
+
var newActiveSegment = segmentsGroup[lineId].getActiveSegment(this._view.pixelsToTime(playheadX + frameOffset), null, true);
|
|
16323
|
+
if (newActiveSegment !== this._activeSegments[lineId]) {
|
|
16324
|
+
if (this._activeSegments[lineId]) {
|
|
16325
|
+
this._peaks.emit('segments.exit', this._activeSegments[lineId]);
|
|
16326
|
+
delete this._activeSegments[lineId];
|
|
16327
|
+
}
|
|
16328
|
+
if (newActiveSegment) {
|
|
16329
|
+
this._peaks.emit('segments.enter', newActiveSegment);
|
|
16330
|
+
this._activeSegments[lineId] = newActiveSegment;
|
|
16331
|
+
this._lastActiveSegments[lineId] = this._activeSegments[lineId];
|
|
16332
|
+
}
|
|
16333
|
+
}
|
|
16218
16334
|
}
|
|
16219
16335
|
}
|
|
16220
16336
|
}
|
|
@@ -16388,6 +16504,7 @@ module.exports = function (Konva, SegmentMarker) {
|
|
|
16388
16504
|
this._startMarker = null;
|
|
16389
16505
|
this._endMarker = null;
|
|
16390
16506
|
this._rectangle = null;
|
|
16507
|
+
this._isSelected = false;
|
|
16391
16508
|
this._segmentHeight = this._peaks.options.segmentHeight;
|
|
16392
16509
|
this._rectangle = new Konva.Rect({
|
|
16393
16510
|
x: this._view.timeToPixels(this._segment.startTime),
|
|
@@ -16546,12 +16663,14 @@ module.exports = function (Konva, SegmentMarker) {
|
|
|
16546
16663
|
};
|
|
16547
16664
|
SegmentShape.prototype._onMouseEnter = function () {
|
|
16548
16665
|
this._view.setCursor('pointer');
|
|
16549
|
-
this.
|
|
16666
|
+
this._view.setHoveredElement(this);
|
|
16667
|
+
this._rectangle.fill(this._segment.activeColor + Math.round(this._segment.opacity * 255).toString(16));
|
|
16550
16668
|
this._view.drawSourcesLayer();
|
|
16551
16669
|
this._peaks.emit('segments.mouseenter', this._segment);
|
|
16552
16670
|
};
|
|
16553
16671
|
SegmentShape.prototype._onMouseLeave = function () {
|
|
16554
16672
|
this._view.setCursor('default');
|
|
16673
|
+
this._view.setHoveredElement(null);
|
|
16555
16674
|
this._rectangle.fill(this._segment.color + Math.round(this._segment.opacity * 255).toString(16));
|
|
16556
16675
|
this._view.drawSourcesLayer();
|
|
16557
16676
|
this._peaks.emit('segments.mouseleave', this._segment);
|
|
@@ -16583,6 +16702,9 @@ module.exports = function (Konva, SegmentMarker) {
|
|
|
16583
16702
|
var startMarker = segmentMarker.isStartMarker();
|
|
16584
16703
|
this._peaks.emit('segments.dragend', this._segment, startMarker);
|
|
16585
16704
|
};
|
|
16705
|
+
SegmentShape.prototype.setSelected = function (isSelected) {
|
|
16706
|
+
this._isSelected = isSelected;
|
|
16707
|
+
};
|
|
16586
16708
|
SegmentShape.prototype.fitToView = function () {
|
|
16587
16709
|
if (this._startMarker) {
|
|
16588
16710
|
this._startMarker.fitToView();
|
|
@@ -16635,8 +16757,11 @@ module.exports = function (Utils) {
|
|
|
16635
16757
|
} else if (!Utils.isString(options.labelText)) {
|
|
16636
16758
|
throw new TypeError('peaks.segments.' + context + ': labelText must be a string');
|
|
16637
16759
|
}
|
|
16760
|
+
if (!Utils.isInteger(options.line)) {
|
|
16761
|
+
throw new TypeError('peaks.segments.' + context + ': line must be an integer');
|
|
16762
|
+
}
|
|
16638
16763
|
}
|
|
16639
|
-
function Segment(peaks, id, startTime, endTime, labelText, color, textColor, handleTextColor, opacity, editable) {
|
|
16764
|
+
function Segment(peaks, id, startTime, endTime, labelText, color, textColor, handleTextColor, opacity, editable, allowDeletion, line) {
|
|
16640
16765
|
var opts = {
|
|
16641
16766
|
startTime: startTime,
|
|
16642
16767
|
endTime: endTime,
|
|
@@ -16645,7 +16770,9 @@ module.exports = function (Utils) {
|
|
|
16645
16770
|
textColor: textColor,
|
|
16646
16771
|
handleTextColor: handleTextColor,
|
|
16647
16772
|
opacity: opacity,
|
|
16648
|
-
editable: editable
|
|
16773
|
+
editable: editable,
|
|
16774
|
+
allowDeletion: allowDeletion,
|
|
16775
|
+
line: line
|
|
16649
16776
|
};
|
|
16650
16777
|
validateSegment(peaks, opts, 'add()');
|
|
16651
16778
|
this._peaks = peaks;
|
|
@@ -16654,11 +16781,13 @@ module.exports = function (Utils) {
|
|
|
16654
16781
|
this._endTime = opts.endTime;
|
|
16655
16782
|
this._labelText = opts.labelText;
|
|
16656
16783
|
this._color = opts.color;
|
|
16657
|
-
this.
|
|
16784
|
+
this._activeColor = Utils.shadeColor(color, 20);
|
|
16658
16785
|
this._textColor = opts.textColor;
|
|
16659
16786
|
this._handleTextColor = opts.handleTextColor;
|
|
16660
16787
|
this._opacity = opts.opacity;
|
|
16661
16788
|
this._editable = opts.editable;
|
|
16789
|
+
this._allowDeletion = opts.allowDeletion;
|
|
16790
|
+
this._line = opts.line;
|
|
16662
16791
|
this._minSize = peaks.options.minSegmentSize;
|
|
16663
16792
|
}
|
|
16664
16793
|
Object.defineProperties(Segment.prototype, {
|
|
@@ -16698,10 +16827,10 @@ module.exports = function (Utils) {
|
|
|
16698
16827
|
return this._color;
|
|
16699
16828
|
}
|
|
16700
16829
|
},
|
|
16701
|
-
|
|
16830
|
+
activeColor: {
|
|
16702
16831
|
enumerable: true,
|
|
16703
16832
|
get: function () {
|
|
16704
|
-
return this.
|
|
16833
|
+
return this._activeColor;
|
|
16705
16834
|
}
|
|
16706
16835
|
},
|
|
16707
16836
|
textColor: {
|
|
@@ -16728,6 +16857,18 @@ module.exports = function (Utils) {
|
|
|
16728
16857
|
return this._editable;
|
|
16729
16858
|
}
|
|
16730
16859
|
},
|
|
16860
|
+
allowDeletion: {
|
|
16861
|
+
enumerable: true,
|
|
16862
|
+
get: function () {
|
|
16863
|
+
return this._allowDeletion;
|
|
16864
|
+
}
|
|
16865
|
+
},
|
|
16866
|
+
line: {
|
|
16867
|
+
enumerable: true,
|
|
16868
|
+
get: function () {
|
|
16869
|
+
return this._line;
|
|
16870
|
+
}
|
|
16871
|
+
},
|
|
16731
16872
|
minSize: {
|
|
16732
16873
|
enumerable: true,
|
|
16733
16874
|
get: function () {
|
|
@@ -16744,7 +16885,9 @@ module.exports = function (Utils) {
|
|
|
16744
16885
|
textColor: this.textColor,
|
|
16745
16886
|
handleTextColor: this.handleTextColor,
|
|
16746
16887
|
opacity: this.opacity,
|
|
16747
|
-
editable: this.editable
|
|
16888
|
+
editable: this.editable,
|
|
16889
|
+
allowDeletion: this.allowDeletion,
|
|
16890
|
+
line: this.line
|
|
16748
16891
|
};
|
|
16749
16892
|
Utils.extend(opts, options);
|
|
16750
16893
|
validateSegment(this._peaks, opts, 'update()');
|
|
@@ -16756,6 +16899,8 @@ module.exports = function (Utils) {
|
|
|
16756
16899
|
this._handleTextColor = opts.handleTextColor;
|
|
16757
16900
|
this._opacity = opts.opacity;
|
|
16758
16901
|
this._editable = opts.editable;
|
|
16902
|
+
this._allowDeletion = opts.allowDeletion;
|
|
16903
|
+
this._line = opts.line;
|
|
16759
16904
|
this._peaks.emit('segment.updated', this);
|
|
16760
16905
|
};
|
|
16761
16906
|
Segment.prototype.isVisible = function (startTime, endTime) {
|
|
@@ -16777,11 +16922,6 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16777
16922
|
this._group = new Konva.Group();
|
|
16778
16923
|
this._updatedSegments = [];
|
|
16779
16924
|
this._isMagnetized = false;
|
|
16780
|
-
this._peaks.on('segment.updated', this._onSegmentsUpdate.bind(this));
|
|
16781
|
-
this._peaks.on('segments.add', this._onSegmentsAdd.bind(this));
|
|
16782
|
-
this._peaks.on('segments.remove', this._onSegmentsRemove.bind(this));
|
|
16783
|
-
this._peaks.on('segments.remove_all', this._onSegmentsRemoveAll.bind(this));
|
|
16784
|
-
this._peaks.on('segments.dragend', this._onSegmentUpdated.bind(this));
|
|
16785
16925
|
this._peaks.on('segments.setMagnetizing', this.setMagnetizing.bind(this));
|
|
16786
16926
|
}
|
|
16787
16927
|
SegmentsGroup.prototype.addToGroup = function (group) {
|
|
@@ -16824,7 +16964,7 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16824
16964
|
} while (nextSegmentId);
|
|
16825
16965
|
return activeSegment;
|
|
16826
16966
|
};
|
|
16827
|
-
SegmentsGroup.prototype.
|
|
16967
|
+
SegmentsGroup.prototype.onSegmentsUpdate = function (segment) {
|
|
16828
16968
|
if (this._segments[segment.id]) {
|
|
16829
16969
|
var redraw = false;
|
|
16830
16970
|
var segmentShape = this._segmentShapes[segment.id];
|
|
@@ -16847,11 +16987,11 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16847
16987
|
}
|
|
16848
16988
|
}
|
|
16849
16989
|
};
|
|
16850
|
-
SegmentsGroup.prototype.
|
|
16990
|
+
SegmentsGroup.prototype.onSegmentUpdated = function () {
|
|
16851
16991
|
this._peaks.emit('segments.updated', this._updatedSegments);
|
|
16852
16992
|
this._updatedSegments = [];
|
|
16853
16993
|
};
|
|
16854
|
-
SegmentsGroup.prototype.
|
|
16994
|
+
SegmentsGroup.prototype.onSegmentsAdd = function (segments) {
|
|
16855
16995
|
var self = this;
|
|
16856
16996
|
var frameOffset = self._view.getFrameOffset();
|
|
16857
16997
|
var width = self._view.getWidth();
|
|
@@ -16862,7 +17002,7 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16862
17002
|
});
|
|
16863
17003
|
self.updateSegments(frameStartTime, frameEndTime);
|
|
16864
17004
|
};
|
|
16865
|
-
SegmentsGroup.prototype.
|
|
17005
|
+
SegmentsGroup.prototype.onSegmentsRemove = function (segments) {
|
|
16866
17006
|
var self = this;
|
|
16867
17007
|
segments.forEach(function (segment) {
|
|
16868
17008
|
var index = self._updatedSegments.indexOf(segment);
|
|
@@ -16874,7 +17014,7 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16874
17014
|
});
|
|
16875
17015
|
this._draw();
|
|
16876
17016
|
};
|
|
16877
|
-
SegmentsGroup.prototype.
|
|
17017
|
+
SegmentsGroup.prototype.onSegmentsRemoveAll = function () {
|
|
16878
17018
|
this._group.removeChildren();
|
|
16879
17019
|
this._firstSegmentId = null;
|
|
16880
17020
|
this._segments = {};
|
|
@@ -16955,7 +17095,7 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16955
17095
|
this._updateSegments(segment, marker);
|
|
16956
17096
|
};
|
|
16957
17097
|
SegmentsGroup.prototype.updateSegments = function (startTime, endTime) {
|
|
16958
|
-
var segments = this.
|
|
17098
|
+
var segments = this.find(startTime, endTime);
|
|
16959
17099
|
var count = segments.length;
|
|
16960
17100
|
segments.forEach(this._updateSegment.bind(this));
|
|
16961
17101
|
count += this._removeInvisibleSegments(startTime, endTime);
|
|
@@ -16963,6 +17103,23 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16963
17103
|
this._draw();
|
|
16964
17104
|
}
|
|
16965
17105
|
};
|
|
17106
|
+
SegmentsGroup.prototype.find = function (startTime, endTime) {
|
|
17107
|
+
var currentSegment = null;
|
|
17108
|
+
var visibleSegments = [];
|
|
17109
|
+
do {
|
|
17110
|
+
if (!currentSegment) {
|
|
17111
|
+
currentSegment = this._segments[this._firstSegmentId];
|
|
17112
|
+
} else {
|
|
17113
|
+
currentSegment = this._segments[currentSegment.nextSegmentId];
|
|
17114
|
+
}
|
|
17115
|
+
if (currentSegment.segment.isVisible(startTime, endTime)) {
|
|
17116
|
+
visibleSegments.push(currentSegment.segment);
|
|
17117
|
+
} else if (visibleSegments.length) {
|
|
17118
|
+
break;
|
|
17119
|
+
}
|
|
17120
|
+
} while (currentSegment.nextSegmentId);
|
|
17121
|
+
return visibleSegments;
|
|
17122
|
+
};
|
|
16966
17123
|
SegmentsGroup.prototype._draw = function () {
|
|
16967
17124
|
this._view.drawSourcesLayer();
|
|
16968
17125
|
};
|
|
@@ -17207,11 +17364,7 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
17207
17364
|
return endsLater || startsEarlier;
|
|
17208
17365
|
};
|
|
17209
17366
|
SegmentsGroup.prototype.destroy = function () {
|
|
17210
|
-
this._peaks.off('
|
|
17211
|
-
this._peaks.off('segments.add', this._onSegmentsAdd);
|
|
17212
|
-
this._peaks.off('segments.remove', this._onSegmentsRemove);
|
|
17213
|
-
this._peaks.off('segments.remove_all', this._onSegmentsRemoveAll);
|
|
17214
|
-
this._peaks.off('segments.dragged', this._onSegmentsDragged);
|
|
17367
|
+
this._peaks.off('segments.setMagnetizing', this.setMagnetizing);
|
|
17215
17368
|
};
|
|
17216
17369
|
SegmentsGroup.prototype.fitToView = function () {
|
|
17217
17370
|
for (var segmentId in this._segmentShapes) {
|
|
@@ -18459,7 +18612,7 @@ module.exports = function (Utils) {
|
|
|
18459
18612
|
wrapping: this.wrapping,
|
|
18460
18613
|
previewHeight: this.previewHeight,
|
|
18461
18614
|
binaryHeight: this.binaryHeight,
|
|
18462
|
-
tts: this.
|
|
18615
|
+
tts: this.tts
|
|
18463
18616
|
};
|
|
18464
18617
|
Utils.extend(opts, options);
|
|
18465
18618
|
validateSource(this._peaks, opts, 'update()');
|
|
@@ -18494,7 +18647,7 @@ module.exports = function (Utils) {
|
|
|
18494
18647
|
return Source;
|
|
18495
18648
|
}(_dereq_('./utils'));
|
|
18496
18649
|
},{"./utils":110}],105:[function(_dereq_,module,exports){
|
|
18497
|
-
module.exports = function (SourceGroup,
|
|
18650
|
+
module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Konva) {
|
|
18498
18651
|
'use strict';
|
|
18499
18652
|
function SourcesLayer(peaks, view, allowEditing) {
|
|
18500
18653
|
this._peaks = peaks;
|
|
@@ -18505,7 +18658,6 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18505
18658
|
this._dataRetriever = new DataRetriever(peaks);
|
|
18506
18659
|
this._lines = new Lines(peaks, view, this);
|
|
18507
18660
|
this._lines.addToLayer(this);
|
|
18508
|
-
this._segmentsGroup = new SegmentsGroup(peaks, view, true);
|
|
18509
18661
|
this._loadedData = {};
|
|
18510
18662
|
this._debouncedRescale = new Invoker().debounce(this._rescale, 150);
|
|
18511
18663
|
this._peaks.on('sources.add', this._onSourcesAdd.bind(this));
|
|
@@ -18516,6 +18668,7 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18516
18668
|
this._peaks.on('data.retrieved', this._onDataRetrieved.bind(this));
|
|
18517
18669
|
this._peaks.on('sources.refresh', this._onSourcesRefresh.bind(this));
|
|
18518
18670
|
this._peaks.on('segments.show', this._onSegmentsShow.bind(this));
|
|
18671
|
+
this._peaks.on('options.set.line_height', this._onOptionsLineHeightChange.bind(this));
|
|
18519
18672
|
}
|
|
18520
18673
|
SourcesLayer.prototype.getLoadedData = function (id) {
|
|
18521
18674
|
return this._loadedData[id];
|
|
@@ -18523,8 +18676,8 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18523
18676
|
SourcesLayer.prototype.setLoadedData = function (id, data) {
|
|
18524
18677
|
this._loadedData[id] = data;
|
|
18525
18678
|
};
|
|
18526
|
-
SourcesLayer.prototype.
|
|
18527
|
-
return this.
|
|
18679
|
+
SourcesLayer.prototype.getSegmentsGroups = function () {
|
|
18680
|
+
return this._lines.getSegmentsGroups();
|
|
18528
18681
|
};
|
|
18529
18682
|
SourcesLayer.prototype.add = function (element) {
|
|
18530
18683
|
this._layer.add(element);
|
|
@@ -18538,6 +18691,25 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18538
18691
|
SourcesLayer.prototype.isEditingEnabled = function () {
|
|
18539
18692
|
return this._allowEditing;
|
|
18540
18693
|
};
|
|
18694
|
+
SourcesLayer.prototype._onOptionsLineHeightChange = function (oldHeight) {
|
|
18695
|
+
var positions = [];
|
|
18696
|
+
for (var sourceId in this._sourcesGroup) {
|
|
18697
|
+
if (Utils.objectHasProperty(this._sourcesGroup, sourceId)) {
|
|
18698
|
+
var source = this._sourcesGroup[sourceId].getSource();
|
|
18699
|
+
if (!positions.includes(source.position)) {
|
|
18700
|
+
this._lines.changeLineHeight(oldHeight, this._peaks.options.lineHeight);
|
|
18701
|
+
positions.push(source.position);
|
|
18702
|
+
}
|
|
18703
|
+
this._removeSource(source);
|
|
18704
|
+
this._addSourceGroup(source);
|
|
18705
|
+
}
|
|
18706
|
+
}
|
|
18707
|
+
if (positions) {
|
|
18708
|
+
var frameOffset = this._view.getFrameOffset();
|
|
18709
|
+
var width = this._view.getWidth();
|
|
18710
|
+
this.updateSources(this._view.pixelsToTime(frameOffset), this._view.pixelsToTime(frameOffset + width));
|
|
18711
|
+
}
|
|
18712
|
+
};
|
|
18541
18713
|
SourcesLayer.prototype._onSourceUpdate = function (source) {
|
|
18542
18714
|
var redraw = false;
|
|
18543
18715
|
var sourceGroup = this._sourcesGroup[source.id];
|
|
@@ -18625,8 +18797,8 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18625
18797
|
SourcesLayer.prototype._onSourcesRefresh = function () {
|
|
18626
18798
|
this._layer.draw();
|
|
18627
18799
|
};
|
|
18628
|
-
SourcesLayer.prototype._onSegmentsShow = function (position) {
|
|
18629
|
-
this._lines.addSegments(
|
|
18800
|
+
SourcesLayer.prototype._onSegmentsShow = function (lineId, position) {
|
|
18801
|
+
this._lines.addSegments(lineId, position);
|
|
18630
18802
|
this._view.updateTimelineLength();
|
|
18631
18803
|
this._layer.draw();
|
|
18632
18804
|
};
|
|
@@ -18764,6 +18936,9 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18764
18936
|
SourcesLayer.prototype.stopDrag = function () {
|
|
18765
18937
|
this._layer.stopDrag();
|
|
18766
18938
|
};
|
|
18939
|
+
SourcesLayer.prototype.getSourceGroupById = function (sourceId) {
|
|
18940
|
+
return this._sourcesGroup[sourceId];
|
|
18941
|
+
};
|
|
18767
18942
|
SourcesLayer.prototype._sourcesOverlapped = function (source1, source2) {
|
|
18768
18943
|
var endsLater = source1.startTime < source2.startTime && source1.endTime > source2.startTime;
|
|
18769
18944
|
var startsEarlier = source1.startTime > source2.startTime && source1.startTime < source2.endTime;
|
|
@@ -18817,8 +18992,8 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18817
18992
|
return this._lines.linesLength();
|
|
18818
18993
|
};
|
|
18819
18994
|
return SourcesLayer;
|
|
18820
|
-
}(_dereq_('./source-group'), _dereq_('./
|
|
18821
|
-
},{"./data-retriever":85,"./invoker":88,"./lines":92,"./
|
|
18995
|
+
}(_dereq_('./source-group'), _dereq_('./lines'), _dereq_('./data-retriever'), _dereq_('./utils'), _dereq_('./invoker'), _dereq_('konva'));
|
|
18996
|
+
},{"./data-retriever":85,"./invoker":88,"./lines":92,"./source-group":103,"./utils":110,"konva":43}],106:[function(_dereq_,module,exports){
|
|
18822
18997
|
module.exports = function (Utils, Konva) {
|
|
18823
18998
|
'use strict';
|
|
18824
18999
|
var LEFT_PADDING = 4;
|
|
@@ -19002,14 +19177,14 @@ module.exports = function (Colors, Segment, Utils) {
|
|
|
19002
19177
|
if (!Utils.isObject(options)) {
|
|
19003
19178
|
throw new TypeError('peaks.segments.add(): expected a Segment object parameter');
|
|
19004
19179
|
}
|
|
19005
|
-
var segment = new Segment(this._peaks, Utils.isNullOrUndefined(options.id) ? this._getNextSegmentId() : options.id, options.startTime, options.endTime, options.labelText, options.color || this._getSegmentColor(), options.textColor || '#000000', options.handleTextColor || '#000000', options.opacity || 1, true);
|
|
19180
|
+
var segment = new Segment(this._peaks, Utils.isNullOrUndefined(options.id) ? this._getNextSegmentId() : options.id, options.startTime, options.endTime, options.labelText, options.color || this._getSegmentColor(), options.textColor || '#000000', options.handleTextColor || '#000000', options.opacity || 1, true, options.allowDeletion || false, options.line);
|
|
19006
19181
|
return segment;
|
|
19007
19182
|
};
|
|
19008
19183
|
TimelineSegments.prototype.getSegments = function () {
|
|
19009
19184
|
return this._segments;
|
|
19010
19185
|
};
|
|
19011
|
-
TimelineSegments.prototype.addSegmentsToPosition = function (position) {
|
|
19012
|
-
this._peaks.emit('segments.show', position);
|
|
19186
|
+
TimelineSegments.prototype.addSegmentsToPosition = function (lineId, position) {
|
|
19187
|
+
this._peaks.emit('segments.show', lineId, position);
|
|
19013
19188
|
};
|
|
19014
19189
|
TimelineSegments.prototype.getSegment = function (id) {
|
|
19015
19190
|
return this._segmentsById[id] || null;
|
|
@@ -19100,10 +19275,10 @@ module.exports = function (Colors, Segment, Utils) {
|
|
|
19100
19275
|
}
|
|
19101
19276
|
return this._removeSegments(fnFilter);
|
|
19102
19277
|
};
|
|
19103
|
-
TimelineSegments.prototype.removeAll = function () {
|
|
19278
|
+
TimelineSegments.prototype.removeAll = function (lineId) {
|
|
19104
19279
|
this._segments = [];
|
|
19105
19280
|
this._segmentsById = {};
|
|
19106
|
-
this._peaks.emit('segments.remove_all');
|
|
19281
|
+
this._peaks.emit('segments.remove_all', lineId);
|
|
19107
19282
|
};
|
|
19108
19283
|
return TimelineSegments;
|
|
19109
19284
|
}(_dereq_('colors.css'), _dereq_('./segment'), _dereq_('./utils'));
|
|
@@ -19347,7 +19522,7 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
19347
19522
|
self._sourcesLayer = new SourcesLayer(peaks, self, true);
|
|
19348
19523
|
self._sourcesLayer.addToStage(self._stage);
|
|
19349
19524
|
self._axis.addFrontToStage(self._stage);
|
|
19350
|
-
self._playheadLayer = new PlayheadLayer(peaks, self, self._sourcesLayer
|
|
19525
|
+
self._playheadLayer = new PlayheadLayer(peaks, self, self._sourcesLayer, self._options.showPlayheadTime);
|
|
19351
19526
|
self._playheadLayer.addToStage(self._stage);
|
|
19352
19527
|
var time = self._peaks.player.getCurrentTime();
|
|
19353
19528
|
self._syncPlayhead(time);
|
|
@@ -19492,6 +19667,15 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
19492
19667
|
this._sourcesLayer.stopDrag();
|
|
19493
19668
|
this._sourcesLayer.draw();
|
|
19494
19669
|
};
|
|
19670
|
+
TimelineZoomView.prototype.selectSourceById = function (sourceId) {
|
|
19671
|
+
var sourceGroup = this._sourcesLayer.getSourceGroupById(sourceId);
|
|
19672
|
+
if (sourceGroup) {
|
|
19673
|
+
this._modeLayer.selectElement(sourceGroup, false);
|
|
19674
|
+
}
|
|
19675
|
+
};
|
|
19676
|
+
TimelineZoomView.prototype.deselectElement = function () {
|
|
19677
|
+
this._modeLayer.deselectElement(false);
|
|
19678
|
+
};
|
|
19495
19679
|
TimelineZoomView.prototype.isListening = function () {
|
|
19496
19680
|
return this._stage.listening();
|
|
19497
19681
|
};
|