@checksub_team/peaks_timeline 2.0.0-alpha.0 → 2.0.0-alpha.3
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 +104 -71
- package/src/components/line-groups.js +9 -8
- package/src/components/source-group.js +26 -6
- package/src/components/sources-layer.js +2 -2
- package/src/main.js +7 -14
- package/src/models/line.js +5 -22
- package/src/models/source.js +66 -17
- package/src/segment-handler.js +10 -2
- package/src/source-handler.js +15 -4
- package/src/view.js +0 -6
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15397,12 +15397,11 @@ module.exports = function (SegmentsGroup, LineGroup, LineIndicator, Utils) {
|
|
|
15397
15397
|
}
|
|
15398
15398
|
lineGroup.addSource(source, sourceGroup, sourcesAround);
|
|
15399
15399
|
};
|
|
15400
|
-
LineGroups.prototype.addSegments = function (
|
|
15401
|
-
this.
|
|
15402
|
-
const lineGroup = this._lineGroupsByPosition[lineOptions.position];
|
|
15400
|
+
LineGroups.prototype.addSegments = function (segmentsGroupId, lineId) {
|
|
15401
|
+
const lineGroup = this._lineGroupsById[lineId];
|
|
15403
15402
|
lineGroup.allowInteractions(this._areSegmentInteractionsAllowed);
|
|
15404
|
-
lineGroup.addSegments(this._segmentsGroups[
|
|
15405
|
-
this._segmentsGroupToLine[
|
|
15403
|
+
lineGroup.addSegments(this._segmentsGroups[segmentsGroupId]);
|
|
15404
|
+
this._segmentsGroupToLine[segmentsGroupId] = lineGroup;
|
|
15406
15405
|
this._setInteractions(lineGroup.getId());
|
|
15407
15406
|
this.refreshLineYs();
|
|
15408
15407
|
};
|
|
@@ -15690,8 +15689,9 @@ module.exports = function (SegmentsGroup, LineGroup, LineIndicator, Utils) {
|
|
|
15690
15689
|
}
|
|
15691
15690
|
};
|
|
15692
15691
|
LineGroups.prototype.allowInteractions = function (forSources, forSegments) {
|
|
15693
|
-
this._areSourceInteractionsAllowed =
|
|
15694
|
-
this._areSegmentInteractionsAllowed =
|
|
15692
|
+
this._areSourceInteractionsAllowed = !Utils.isNullOrUndefined(forSources) ? forSources : this._areSourceInteractionsAllowed;
|
|
15693
|
+
this._areSegmentInteractionsAllowed = !Utils.isNullOrUndefined(forSegments) ? forSegments : this._areSegmentInteractionsAllowed;
|
|
15694
|
+
console.log('peaks.lines.allowInteractions(): ' + 'forSources: ' + this._areSourceInteractionsAllowed + ', forSegments: ' + this._areSegmentInteractionsAllowed);
|
|
15695
15695
|
for (var id in this._lineGroupsById) {
|
|
15696
15696
|
if (Utils.objectHasProperty(this._lineGroupsById, id)) {
|
|
15697
15697
|
this._setInteractions(id);
|
|
@@ -17633,6 +17633,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
17633
17633
|
this._borderWidth = this._source.borderWidth || 0;
|
|
17634
17634
|
this._currentTimeToPixelsScaleUsed = this._view.getTimeToPixelsScale();
|
|
17635
17635
|
this._selected = this._source.selected;
|
|
17636
|
+
this._hovered = false;
|
|
17636
17637
|
this._isDragged = false;
|
|
17637
17638
|
this._previewList = [];
|
|
17638
17639
|
this._markersGroup = this._createMarkers();
|
|
@@ -17651,12 +17652,14 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
17651
17652
|
this._group.on('dragend', this._onDragEnd.bind(this));
|
|
17652
17653
|
this._cursor = null;
|
|
17653
17654
|
this._group.on('mouseenter', function () {
|
|
17655
|
+
self._setHovered(true);
|
|
17654
17656
|
self._view.setHoveredElement(self);
|
|
17655
17657
|
if (!self._source.loading) {
|
|
17656
17658
|
self._showButtons();
|
|
17657
17659
|
}
|
|
17658
17660
|
});
|
|
17659
17661
|
this._group.on('mouseleave', function () {
|
|
17662
|
+
self._setHovered(false);
|
|
17660
17663
|
self._view.setHoveredElement(null);
|
|
17661
17664
|
self._hideButtons();
|
|
17662
17665
|
});
|
|
@@ -17694,6 +17697,10 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
17694
17697
|
this.createIndicators();
|
|
17695
17698
|
this.setLoadingState(this._source.loading);
|
|
17696
17699
|
}
|
|
17700
|
+
SourceGroup.prototype._setHovered = function (newValue) {
|
|
17701
|
+
this._hovered = newValue;
|
|
17702
|
+
this._group.draw();
|
|
17703
|
+
};
|
|
17697
17704
|
SourceGroup.prototype._onDragStart = function (element) {
|
|
17698
17705
|
this._isDragged = true;
|
|
17699
17706
|
this._layer.onSourcesGroupDragStart(element);
|
|
@@ -17895,22 +17902,30 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
17895
17902
|
ctx.quadraticCurveTo(x + offset, offset, x + radius, offset);
|
|
17896
17903
|
ctx.closePath();
|
|
17897
17904
|
if (fill) {
|
|
17905
|
+
var backgroundColor;
|
|
17906
|
+
if (this._selected) {
|
|
17907
|
+
backgroundColor = this._source.selectedBackgroundColor;
|
|
17908
|
+
} else if (this._hovered) {
|
|
17909
|
+
backgroundColor = this._source.hoverBackgroundColor;
|
|
17910
|
+
} else {
|
|
17911
|
+
backgroundColor = this._source.backgroundColor;
|
|
17912
|
+
}
|
|
17898
17913
|
if (this._source.shouldShowWarning()) {
|
|
17899
17914
|
var gradient = ctx.createLinearGradient(0, 0, this._width, 0);
|
|
17900
17915
|
if (this._source.mediaEndTime < this._source.duration) {
|
|
17901
17916
|
var rightStopPosition = Math.max(1 - this._source.warningWidth / this._width, 0.5);
|
|
17902
|
-
gradient.addColorStop(rightStopPosition,
|
|
17917
|
+
gradient.addColorStop(rightStopPosition, backgroundColor);
|
|
17903
17918
|
gradient.addColorStop(1, this._source.warningColor);
|
|
17904
17919
|
}
|
|
17905
17920
|
if (this._source.mediaStartTime > 0) {
|
|
17906
17921
|
var leftStopPosition = Math.min(this._source.warningWidth / this._width, 0.5);
|
|
17907
17922
|
gradient.addColorStop(0, this._source.warningColor);
|
|
17908
|
-
gradient.addColorStop(leftStopPosition,
|
|
17923
|
+
gradient.addColorStop(leftStopPosition, backgroundColor);
|
|
17909
17924
|
}
|
|
17910
17925
|
ctx.fillStyle = gradient;
|
|
17911
17926
|
ctx.fill();
|
|
17912
17927
|
} else {
|
|
17913
|
-
ctx.fillStyle =
|
|
17928
|
+
ctx.fillStyle = backgroundColor;
|
|
17914
17929
|
ctx.fill();
|
|
17915
17930
|
}
|
|
17916
17931
|
}
|
|
@@ -18249,7 +18264,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
18249
18264
|
this._selected = this._source.selected;
|
|
18250
18265
|
if (this._border) {
|
|
18251
18266
|
if (this._selected) {
|
|
18252
|
-
this._border.fill(this._source.
|
|
18267
|
+
this._border.fill(this._source.selectedBorderColor);
|
|
18253
18268
|
this._borderWidth = this._peaks.options.sourceSelectedBorderWidth;
|
|
18254
18269
|
} else {
|
|
18255
18270
|
this._border.fill(this._source.borderColor);
|
|
@@ -18262,7 +18277,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
18262
18277
|
})[0];
|
|
18263
18278
|
if (unwrap_background) {
|
|
18264
18279
|
if (this._selected) {
|
|
18265
|
-
unwrap_background.stroke(this._source.
|
|
18280
|
+
unwrap_background.stroke(this._source.selectedBorderColor);
|
|
18266
18281
|
unwrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
18267
18282
|
} else {
|
|
18268
18283
|
unwrap_background.strokeWidth(0);
|
|
@@ -18275,7 +18290,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
|
|
|
18275
18290
|
})[0];
|
|
18276
18291
|
if (wrap_background) {
|
|
18277
18292
|
if (this._selected) {
|
|
18278
|
-
wrap_background.stroke(this._source.
|
|
18293
|
+
wrap_background.stroke(this._source.selectedBorderColor);
|
|
18279
18294
|
wrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
18280
18295
|
} else {
|
|
18281
18296
|
wrap_background.strokeWidth(0);
|
|
@@ -18968,8 +18983,8 @@ module.exports = function (SourceGroup, LineGroups, DataRetriever, Invoker, Util
|
|
|
18968
18983
|
}
|
|
18969
18984
|
}
|
|
18970
18985
|
};
|
|
18971
|
-
SourcesLayer.prototype._onSegmentsShow = function (
|
|
18972
|
-
this._lineGroups.addSegments(
|
|
18986
|
+
SourcesLayer.prototype._onSegmentsShow = function (segmentsGroupId, lineId) {
|
|
18987
|
+
this._lineGroups.addSegments(segmentsGroupId, lineId);
|
|
18973
18988
|
this._view.updateTimelineLength();
|
|
18974
18989
|
this._layer.draw();
|
|
18975
18990
|
};
|
|
@@ -19733,6 +19748,7 @@ module.exports = function (Colors, EventEmitter, SegmentHandler, SourceHandler,
|
|
|
19733
19748
|
nudgeIncrement: 1,
|
|
19734
19749
|
zoomWaveformColor: 'rgba(180, 180, 180, 1)',
|
|
19735
19750
|
randomizeSegmentColor: true,
|
|
19751
|
+
blockUpdatingOnMouseClickWithCtrlKey: false,
|
|
19736
19752
|
blockUpdatingOnMouseClickWithMetaKey: false,
|
|
19737
19753
|
height: 200,
|
|
19738
19754
|
segmentColor: Colors.orange,
|
|
@@ -19922,8 +19938,8 @@ module.exports = function (Colors, EventEmitter, SegmentHandler, SourceHandler,
|
|
|
19922
19938
|
Peaks.prototype.moveLine = function (lineId, position) {
|
|
19923
19939
|
this.lineHandler.moveById(lineId, position);
|
|
19924
19940
|
};
|
|
19925
|
-
Peaks.prototype.showSegments = function (
|
|
19926
|
-
this.segmentHandler.
|
|
19941
|
+
Peaks.prototype.showSegments = function (segmentsGroupId, lineId) {
|
|
19942
|
+
this.segmentHandler.addSegmentsToLine(segmentsGroupId, lineId);
|
|
19927
19943
|
};
|
|
19928
19944
|
Peaks.prototype.destroySegment = function (segmentId) {
|
|
19929
19945
|
this.segmentHandler.removeById(segmentId);
|
|
@@ -19934,14 +19950,6 @@ module.exports = function (Colors, EventEmitter, SegmentHandler, SourceHandler,
|
|
|
19934
19950
|
Peaks.prototype.setCutMode = function () {
|
|
19935
19951
|
this.emit('handler.view.cutmode');
|
|
19936
19952
|
};
|
|
19937
|
-
Peaks.prototype.setIndicatorType = function (linePosition, type) {
|
|
19938
|
-
var lineId = this.view.getLineByPosition(linePosition).getId();
|
|
19939
|
-
this.emit('lineIndicator.setType', lineId, type);
|
|
19940
|
-
};
|
|
19941
|
-
Peaks.prototype.setIndicatorText = function (linePosition, text) {
|
|
19942
|
-
var lineId = this.view.getLineByPosition(linePosition).getId();
|
|
19943
|
-
this.emit('lineIndicator.setText', lineId, text);
|
|
19944
|
-
};
|
|
19945
19953
|
Peaks.prototype.getVisibleSegments = function () {
|
|
19946
19954
|
return this.view.getSegmentsGroup().getVisibleSegments();
|
|
19947
19955
|
};
|
|
@@ -20049,9 +20057,6 @@ module.exports = function (Utils) {
|
|
|
20049
20057
|
return this._position;
|
|
20050
20058
|
},
|
|
20051
20059
|
set: function (pos) {
|
|
20052
|
-
if (!Utils.isInteger(pos) || pos < 0) {
|
|
20053
|
-
throw new TypeError('peaks.lines.setPosition(): position must be a non-negative integer');
|
|
20054
|
-
}
|
|
20055
20060
|
this._position = pos;
|
|
20056
20061
|
}
|
|
20057
20062
|
},
|
|
@@ -20075,24 +20080,10 @@ module.exports = function (Utils) {
|
|
|
20075
20080
|
indicatorText: this.indicatorText
|
|
20076
20081
|
};
|
|
20077
20082
|
Utils.extend(opts, options);
|
|
20078
|
-
validateLine(
|
|
20079
|
-
this.
|
|
20080
|
-
this.
|
|
20081
|
-
this.
|
|
20082
|
-
this._labelText = opts.labelText;
|
|
20083
|
-
this._color = opts.color;
|
|
20084
|
-
this._textColor = opts.textColor;
|
|
20085
|
-
this._handleTextColor = opts.handleTextColor;
|
|
20086
|
-
this._hoverColor = opts.hoverColor;
|
|
20087
|
-
this._warningColor = opts.warningColor;
|
|
20088
|
-
this._opacity = opts.opacity;
|
|
20089
|
-
this._borderColor = opts.borderColor;
|
|
20090
|
-
this._borderWidth = opts.borderWidth;
|
|
20091
|
-
this._borderRadius = opts.borderRadius;
|
|
20092
|
-
this._editable = opts.editable;
|
|
20093
|
-
this._allowDeletion = opts.allowDeletion;
|
|
20094
|
-
this._line = opts.line;
|
|
20095
|
-
this._indicators = opts.indicators;
|
|
20083
|
+
validateLine(opts, 'update()');
|
|
20084
|
+
this._position = opts.position;
|
|
20085
|
+
this._indicatorType = opts.indicatorType;
|
|
20086
|
+
this._indicatorText = opts.indicatorText;
|
|
20096
20087
|
this._peaks.emit('model.line.update', this);
|
|
20097
20088
|
};
|
|
20098
20089
|
Line.prototype.toSerializable = function () {
|
|
@@ -20507,13 +20498,25 @@ module.exports = function (Utils) {
|
|
|
20507
20498
|
if (!Utils.isValidColor(options.backgroundColor)) {
|
|
20508
20499
|
throw new TypeError('peaks.sources.' + context + ': backgroundColor should be a valid CSS color');
|
|
20509
20500
|
}
|
|
20510
|
-
if (
|
|
20501
|
+
if (Utils.isNullOrUndefined(options.selectedBackgroundColor)) {
|
|
20502
|
+
options.selectedBackgroundColor = options.backgroundColor;
|
|
20503
|
+
} else if (!Utils.isValidColor(options.selectedBackgroundColor)) {
|
|
20504
|
+
throw new TypeError('peaks.sources.' + context + ': selectedBackgroundColor should be a valid CSS color');
|
|
20505
|
+
}
|
|
20506
|
+
if (Utils.isNullOrUndefined(options.hoverBackgroundColor)) {
|
|
20507
|
+
options.hoverBackgroundColor = Utils.shadeColor(options.backgroundColor, 30);
|
|
20508
|
+
} else if (!Utils.isValidColor(options.hoverBackgroundColor)) {
|
|
20509
|
+
throw new TypeError('peaks.sources.' + context + ': hoverBackgroundColor should be a valid CSS color');
|
|
20510
|
+
}
|
|
20511
|
+
if (Utils.isNullOrUndefined(options.borderColor)) {
|
|
20511
20512
|
options.borderColor = options.color;
|
|
20513
|
+
} else if (!Utils.isValidColor(options.borderColor)) {
|
|
20514
|
+
throw new TypeError('peaks.sources.' + context + ': borderColor should be a valid CSS color');
|
|
20512
20515
|
}
|
|
20513
|
-
if (Utils.isNullOrUndefined(options.
|
|
20514
|
-
options.
|
|
20515
|
-
} else if (!Utils.isValidColor(options.
|
|
20516
|
-
throw new TypeError('peaks.sources.' + context + ':
|
|
20516
|
+
if (Utils.isNullOrUndefined(options.selectedBorderColor)) {
|
|
20517
|
+
options.selectedBorderColor = Utils.shadeColor(options.borderColor, 30);
|
|
20518
|
+
} else if (!Utils.isValidColor(options.selectedBorderColor)) {
|
|
20519
|
+
throw new TypeError('peaks.sources.' + context + ': selectedBorderColor should be a valid CSS color');
|
|
20517
20520
|
}
|
|
20518
20521
|
if (Utils.isNullOrUndefined(options.warningColor)) {
|
|
20519
20522
|
options.warningColor = null;
|
|
@@ -20662,7 +20665,7 @@ module.exports = function (Utils) {
|
|
|
20662
20665
|
throw new TypeError('peaks.sources.' + context + ': loading must be a boolean');
|
|
20663
20666
|
}
|
|
20664
20667
|
}
|
|
20665
|
-
function Source(peaks, id, lineId, originId, elementId, title, titleAlignments, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor,
|
|
20668
|
+
function Source(peaks, id, lineId, originId, elementId, title, titleAlignments, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, hoverBackgroundColor, selectedBackgroundColor, borderColor, selectedBorderColor, warningColor, warningWidth, volumeSliderColor, volumeSliderWidth, volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition, textAutoScroll, borderWidth, borderRadius, wrapped, draggable, orderable, resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, buttons, markerColor, markerWidth, volume, volumeRange, loading, ...customParams) {
|
|
20666
20669
|
var opts = {
|
|
20667
20670
|
title: title,
|
|
20668
20671
|
titleAlignments: titleAlignments,
|
|
@@ -20678,8 +20681,10 @@ module.exports = function (Utils) {
|
|
|
20678
20681
|
mediaEndTime: mediaEndTime,
|
|
20679
20682
|
color: color,
|
|
20680
20683
|
backgroundColor: backgroundColor,
|
|
20684
|
+
hoverBackgroundColor: hoverBackgroundColor,
|
|
20685
|
+
selectedBackgroundColor: selectedBackgroundColor,
|
|
20681
20686
|
borderColor: borderColor,
|
|
20682
|
-
|
|
20687
|
+
selectedBorderColor: selectedBorderColor,
|
|
20683
20688
|
warningColor: warningColor,
|
|
20684
20689
|
warningWidth: warningWidth,
|
|
20685
20690
|
textFont: textFont,
|
|
@@ -20731,8 +20736,10 @@ module.exports = function (Utils) {
|
|
|
20731
20736
|
this._mediaEndTime = opts.mediaEndTime;
|
|
20732
20737
|
this._color = opts.color;
|
|
20733
20738
|
this._backgroundColor = opts.backgroundColor;
|
|
20739
|
+
this._hoverBackgroundColor = opts.hoverBackgroundColor;
|
|
20740
|
+
this._selectedBackgroundColor = opts.selectedBackgroundColor;
|
|
20734
20741
|
this._borderColor = opts.borderColor;
|
|
20735
|
-
this.
|
|
20742
|
+
this._selectedBorderColor = opts.selectedBorderColor;
|
|
20736
20743
|
this._warningColor = opts.warningColor;
|
|
20737
20744
|
this._warningWidth = opts.warningWidth;
|
|
20738
20745
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
@@ -20906,6 +20913,24 @@ module.exports = function (Utils) {
|
|
|
20906
20913
|
this._backgroundColor = backgroundColor;
|
|
20907
20914
|
}
|
|
20908
20915
|
},
|
|
20916
|
+
hoverBackgroundColor: {
|
|
20917
|
+
enumerable: true,
|
|
20918
|
+
get: function () {
|
|
20919
|
+
return this._hoverBackgroundColor;
|
|
20920
|
+
},
|
|
20921
|
+
set: function (hoverBackgroundColor) {
|
|
20922
|
+
this._hoverBackgroundColor = hoverBackgroundColor;
|
|
20923
|
+
}
|
|
20924
|
+
},
|
|
20925
|
+
selectedBackgroundColor: {
|
|
20926
|
+
enumerable: true,
|
|
20927
|
+
get: function () {
|
|
20928
|
+
return this._selectedBackgroundColor;
|
|
20929
|
+
},
|
|
20930
|
+
set: function (selectedBackgroundColor) {
|
|
20931
|
+
this._selectedBackgroundColor = selectedBackgroundColor;
|
|
20932
|
+
}
|
|
20933
|
+
},
|
|
20909
20934
|
borderColor: {
|
|
20910
20935
|
enumerable: true,
|
|
20911
20936
|
get: function () {
|
|
@@ -20915,13 +20940,13 @@ module.exports = function (Utils) {
|
|
|
20915
20940
|
this._borderColor = borderColor;
|
|
20916
20941
|
}
|
|
20917
20942
|
},
|
|
20918
|
-
|
|
20943
|
+
selectedBorderColor: {
|
|
20919
20944
|
enumerable: true,
|
|
20920
20945
|
get: function () {
|
|
20921
|
-
return this.
|
|
20946
|
+
return this._selectedBorderColor;
|
|
20922
20947
|
},
|
|
20923
|
-
set: function (
|
|
20924
|
-
this.
|
|
20948
|
+
set: function (selectedBorderColor) {
|
|
20949
|
+
this._selectedBorderColor = selectedBorderColor;
|
|
20925
20950
|
}
|
|
20926
20951
|
},
|
|
20927
20952
|
warningColor: {
|
|
@@ -21271,8 +21296,10 @@ module.exports = function (Utils) {
|
|
|
21271
21296
|
mediaEndTime: this.mediaEndTime,
|
|
21272
21297
|
color: this.color,
|
|
21273
21298
|
backgroundColor: this.backgroundColor,
|
|
21299
|
+
hoverBackgroundColor: this.hoverBackgroundColor,
|
|
21300
|
+
selectedBackgroundColor: this.selectedBackgroundColor,
|
|
21274
21301
|
borderColor: this.borderColor,
|
|
21275
|
-
|
|
21302
|
+
selectedBorderColor: this.selectedBorderColor,
|
|
21276
21303
|
warningColor: this.warningColor,
|
|
21277
21304
|
warningWidth: this.warningWidth,
|
|
21278
21305
|
volumeSliderColor: this.volumeSliderColor,
|
|
@@ -21321,7 +21348,7 @@ module.exports = function (Utils) {
|
|
|
21321
21348
|
this._color = opts.color;
|
|
21322
21349
|
this._backgroundColor = opts.backgroundColor;
|
|
21323
21350
|
this._borderColor = opts.borderColor;
|
|
21324
|
-
this.
|
|
21351
|
+
this._selectedBorderColor = opts.selectedBorderColor;
|
|
21325
21352
|
this._warningColor = opts.warningColor;
|
|
21326
21353
|
this._warningWidth = opts.warningWidth;
|
|
21327
21354
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
@@ -21490,8 +21517,11 @@ module.exports = function (Colors, Segment, Utils) {
|
|
|
21490
21517
|
return segment.toSerializable();
|
|
21491
21518
|
});
|
|
21492
21519
|
};
|
|
21493
|
-
SegmentHandler.prototype.
|
|
21494
|
-
this._peaks.
|
|
21520
|
+
SegmentHandler.prototype.addSegmentsToLine = function (segmentsGroupId, lineId) {
|
|
21521
|
+
if (!Utils.isString(lineId) || Utils.isNullOrUndefined(this._peaks.lineHandler.getLine(lineId))) {
|
|
21522
|
+
throw new Error('peaks.segmentHandler.addSegmentsToLine(): line with id ' + lineId + ' does not exist');
|
|
21523
|
+
}
|
|
21524
|
+
this._peaks.emit('handler.segments.show', segmentsGroupId, lineId);
|
|
21495
21525
|
};
|
|
21496
21526
|
SegmentHandler.prototype.getSegment = function (id) {
|
|
21497
21527
|
return this._segmentsById[id] || null;
|
|
@@ -21631,8 +21661,10 @@ module.exports = function (Source, Utils) {
|
|
|
21631
21661
|
mediaEndTime: originalMediaEndTime,
|
|
21632
21662
|
color: sourceToCut.color,
|
|
21633
21663
|
backgroundColor: sourceToCut.backgroundColor,
|
|
21664
|
+
hoverBackgroundColor: sourceToCut.hoverBackgroundColor,
|
|
21665
|
+
selectedBackgroundColor: sourceToCut.selectedBackgroundColor,
|
|
21634
21666
|
borderColor: sourceToCut.borderColor,
|
|
21635
|
-
|
|
21667
|
+
selectedBorderColor: sourceToCut.selectedBorderColor,
|
|
21636
21668
|
warningColor: sourceToCut.warningColor,
|
|
21637
21669
|
warningWidth: sourceToCut.warningWidth,
|
|
21638
21670
|
volumeSliderColor: sourceToCut.volumeSliderColor,
|
|
@@ -21680,8 +21712,10 @@ module.exports = function (Source, Utils) {
|
|
|
21680
21712
|
SourceHandler.prototype._addSource = function (source) {
|
|
21681
21713
|
this._sources.push(source);
|
|
21682
21714
|
this._sourcesById[source.id] = source;
|
|
21683
|
-
|
|
21684
|
-
|
|
21715
|
+
if (Utils.isNullOrUndefined(this._sourcesByLineId[source.lineId])) {
|
|
21716
|
+
this._sourcesByLineId[source.lineId] = {};
|
|
21717
|
+
}
|
|
21718
|
+
this._sourcesByLineId[source.lineId][source.id] = source;
|
|
21685
21719
|
};
|
|
21686
21720
|
SourceHandler.prototype._createSource = function (options) {
|
|
21687
21721
|
if (!Utils.isObject(options)) {
|
|
@@ -21693,12 +21727,15 @@ module.exports = function (Source, Utils) {
|
|
|
21693
21727
|
customParams.push(key, value);
|
|
21694
21728
|
}
|
|
21695
21729
|
});
|
|
21696
|
-
var source = new Source(this._peaks, options.id || this._getNextSourceId(), options.lineId, options.originId, options.elementId, options.title, options.titleAlignments, options.url, options.previewUrl, options.binaryUrl, options.kind, options.subkind, options.duration, options.startTime, options.endTime, options.mediaStartTime, options.mediaEndTime, options.color, options.backgroundColor, options.borderColor, options.
|
|
21730
|
+
var source = new Source(this._peaks, options.id || this._getNextSourceId(), options.lineId, options.originId, options.elementId, options.title, options.titleAlignments, options.url, options.previewUrl, options.binaryUrl, options.kind, options.subkind, options.duration, options.startTime, options.endTime, options.mediaStartTime, options.mediaEndTime, options.color, options.backgroundColor, options.hoverBackgroundColor, options.selectedBackgroundColor, options.borderColor, options.selectedBorderColor, options.warningColor, options.warningWidth, options.volumeSliderColor, options.volumeSliderWidth, options.volumeSliderDraggingWidth, options.textFont, options.textFontSize, options.textColor, options.textBackgroundColor, options.textPosition, options.textAutoScroll, options.borderWidth, options.borderRadius, options.wrapped, options.draggable, options.orderable, options.resizable, options.cuttable, options.deletable, options.wrapping, options.previewHeight, options.binaryHeight, options.indicators, options.markers, options.buttons, options.markerColor, options.markerWidth, options.volume, options.volumeRange, options.loading, ...customParams);
|
|
21697
21731
|
return source;
|
|
21698
21732
|
};
|
|
21699
21733
|
SourceHandler.prototype.getSources = function () {
|
|
21700
21734
|
return this._sources;
|
|
21701
21735
|
};
|
|
21736
|
+
SourceHandler.prototype.getSourcesByLineId = function (lineId) {
|
|
21737
|
+
return Utils.isNullOrUndefined(lineId) ? this._sourcesByLineId : this._sourcesByLineId[lineId];
|
|
21738
|
+
};
|
|
21702
21739
|
SourceHandler.prototype.getSourcesSerialized = function () {
|
|
21703
21740
|
return this._sources.map(function (source) {
|
|
21704
21741
|
return source.toSerializable();
|
|
@@ -21755,6 +21792,7 @@ module.exports = function (Source, Utils) {
|
|
|
21755
21792
|
var index = indexes[i] - destroyed.length;
|
|
21756
21793
|
var itemDestroyed = this._sources.splice(index, 1)[0];
|
|
21757
21794
|
delete this._sourcesById[itemDestroyed.id];
|
|
21795
|
+
delete this._sourcesByLineId[itemDestroyed.lineId][itemDestroyed.id];
|
|
21758
21796
|
destroyed.push(itemDestroyed);
|
|
21759
21797
|
}
|
|
21760
21798
|
return destroyed;
|
|
@@ -22023,7 +22061,6 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
22023
22061
|
self._timelineLength = 0;
|
|
22024
22062
|
self._timeToPixelsScale = self._options.initialZoomLevel;
|
|
22025
22063
|
self._timeToPixelsMinScale = self._options.minScale;
|
|
22026
|
-
self._resizeTimeoutId = null;
|
|
22027
22064
|
self._isFocused = false;
|
|
22028
22065
|
self._isClickable = true;
|
|
22029
22066
|
self._width = container.clientWidth;
|
|
@@ -22540,10 +22577,6 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
22540
22577
|
return this._sourcesLayer.getFullHeight();
|
|
22541
22578
|
};
|
|
22542
22579
|
View.prototype.destroy = function () {
|
|
22543
|
-
if (this._resizeTimeoutId) {
|
|
22544
|
-
clearTimeout(this._resizeTimeoutId);
|
|
22545
|
-
this._resizeTimeoutId = null;
|
|
22546
|
-
}
|
|
22547
22580
|
this._peaks.off('player_time_update', this._onTimeUpdate);
|
|
22548
22581
|
this._peaks.off('user_seek', this._onSeek);
|
|
22549
22582
|
this._peaks.off('player_play', this._onPlay);
|
|
@@ -159,15 +159,13 @@ define([
|
|
|
159
159
|
lineGroup.addSource(source, sourceGroup, sourcesAround);
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
-
LineGroups.prototype.addSegments = function(
|
|
163
|
-
this.
|
|
164
|
-
|
|
165
|
-
const lineGroup = this._lineGroupsByPosition[lineOptions.position];
|
|
162
|
+
LineGroups.prototype.addSegments = function(segmentsGroupId, lineId) {
|
|
163
|
+
const lineGroup = this._lineGroupsById[lineId];
|
|
166
164
|
|
|
167
165
|
lineGroup.allowInteractions(this._areSegmentInteractionsAllowed);
|
|
168
|
-
lineGroup.addSegments(this._segmentsGroups[
|
|
166
|
+
lineGroup.addSegments(this._segmentsGroups[segmentsGroupId]);
|
|
169
167
|
|
|
170
|
-
this._segmentsGroupToLine[
|
|
168
|
+
this._segmentsGroupToLine[segmentsGroupId] = lineGroup;
|
|
171
169
|
|
|
172
170
|
this._setInteractions(lineGroup.getId());
|
|
173
171
|
|
|
@@ -569,10 +567,13 @@ define([
|
|
|
569
567
|
};
|
|
570
568
|
|
|
571
569
|
LineGroups.prototype.allowInteractions = function(forSources, forSegments) {
|
|
572
|
-
this._areSourceInteractionsAllowed =
|
|
570
|
+
this._areSourceInteractionsAllowed = !Utils.isNullOrUndefined(forSources) ?
|
|
573
571
|
forSources : this._areSourceInteractionsAllowed;
|
|
574
|
-
this._areSegmentInteractionsAllowed =
|
|
572
|
+
this._areSegmentInteractionsAllowed = !Utils.isNullOrUndefined(forSegments) ?
|
|
575
573
|
forSegments : this._areSegmentInteractionsAllowed;
|
|
574
|
+
console.log('peaks.lines.allowInteractions(): ' +
|
|
575
|
+
'forSources: ' + this._areSourceInteractionsAllowed + ', forSegments: ' + this._areSegmentInteractionsAllowed
|
|
576
|
+
);
|
|
576
577
|
for (var id in this._lineGroupsById) {
|
|
577
578
|
if (Utils.objectHasProperty(this._lineGroupsById, id)) {
|
|
578
579
|
this._setInteractions(id);
|
|
@@ -56,6 +56,7 @@ define([
|
|
|
56
56
|
this._borderWidth = this._source.borderWidth || 0;
|
|
57
57
|
this._currentTimeToPixelsScaleUsed = this._view.getTimeToPixelsScale();
|
|
58
58
|
this._selected = this._source.selected;
|
|
59
|
+
this._hovered = false;
|
|
59
60
|
this._isDragged = false;
|
|
60
61
|
|
|
61
62
|
this._previewList = [];
|
|
@@ -79,6 +80,7 @@ define([
|
|
|
79
80
|
|
|
80
81
|
this._cursor = null;
|
|
81
82
|
this._group.on('mouseenter', function() {
|
|
83
|
+
self._setHovered(true);
|
|
82
84
|
self._view.setHoveredElement(self);
|
|
83
85
|
if (!self._source.loading) {
|
|
84
86
|
self._showButtons();
|
|
@@ -86,6 +88,7 @@ define([
|
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
this._group.on('mouseleave', function() {
|
|
91
|
+
self._setHovered(false);
|
|
89
92
|
self._view.setHoveredElement(null);
|
|
90
93
|
self._hideButtons();
|
|
91
94
|
});
|
|
@@ -133,6 +136,11 @@ define([
|
|
|
133
136
|
this.setLoadingState(this._source.loading);
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
SourceGroup.prototype._setHovered = function(newValue) {
|
|
140
|
+
this._hovered = newValue;
|
|
141
|
+
this._group.draw();
|
|
142
|
+
};
|
|
143
|
+
|
|
136
144
|
SourceGroup.prototype._onDragStart = function(element) {
|
|
137
145
|
this._isDragged = true;
|
|
138
146
|
this._layer.onSourcesGroupDragStart(element);
|
|
@@ -419,13 +427,25 @@ define([
|
|
|
419
427
|
ctx.closePath();
|
|
420
428
|
|
|
421
429
|
if (fill) {
|
|
430
|
+
var backgroundColor;
|
|
431
|
+
|
|
432
|
+
if (this._selected) {
|
|
433
|
+
backgroundColor = this._source.selectedBackgroundColor;
|
|
434
|
+
}
|
|
435
|
+
else if (this._hovered) {
|
|
436
|
+
backgroundColor = this._source.hoverBackgroundColor;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
backgroundColor = this._source.backgroundColor;
|
|
440
|
+
}
|
|
441
|
+
|
|
422
442
|
if (this._source.shouldShowWarning()) {
|
|
423
443
|
var gradient = ctx.createLinearGradient(0, 0, this._width, 0);
|
|
424
444
|
|
|
425
445
|
if (this._source.mediaEndTime < this._source.duration) {
|
|
426
446
|
var rightStopPosition = Math.max(1 - (this._source.warningWidth / this._width), 0.5);
|
|
427
447
|
|
|
428
|
-
gradient.addColorStop(rightStopPosition,
|
|
448
|
+
gradient.addColorStop(rightStopPosition, backgroundColor);
|
|
429
449
|
gradient.addColorStop(1, this._source.warningColor);
|
|
430
450
|
}
|
|
431
451
|
|
|
@@ -433,14 +453,14 @@ define([
|
|
|
433
453
|
var leftStopPosition = Math.min(this._source.warningWidth / this._width, 0.5);
|
|
434
454
|
|
|
435
455
|
gradient.addColorStop(0, this._source.warningColor);
|
|
436
|
-
gradient.addColorStop(leftStopPosition,
|
|
456
|
+
gradient.addColorStop(leftStopPosition, backgroundColor);
|
|
437
457
|
}
|
|
438
458
|
|
|
439
459
|
ctx.fillStyle = gradient;
|
|
440
460
|
ctx.fill();
|
|
441
461
|
}
|
|
442
462
|
else {
|
|
443
|
-
ctx.fillStyle =
|
|
463
|
+
ctx.fillStyle = backgroundColor;
|
|
444
464
|
ctx.fill();
|
|
445
465
|
}
|
|
446
466
|
}
|
|
@@ -874,7 +894,7 @@ define([
|
|
|
874
894
|
this._selected = this._source.selected;
|
|
875
895
|
if (this._border) {
|
|
876
896
|
if (this._selected) {
|
|
877
|
-
this._border.fill(this._source.
|
|
897
|
+
this._border.fill(this._source.selectedBorderColor);
|
|
878
898
|
this._borderWidth = this._peaks.options.sourceSelectedBorderWidth;
|
|
879
899
|
}
|
|
880
900
|
else {
|
|
@@ -891,7 +911,7 @@ define([
|
|
|
891
911
|
|
|
892
912
|
if (unwrap_background) {
|
|
893
913
|
if (this._selected) {
|
|
894
|
-
unwrap_background.stroke(this._source.
|
|
914
|
+
unwrap_background.stroke(this._source.selectedBorderColor);
|
|
895
915
|
unwrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
896
916
|
}
|
|
897
917
|
else {
|
|
@@ -908,7 +928,7 @@ define([
|
|
|
908
928
|
|
|
909
929
|
if (wrap_background) {
|
|
910
930
|
if (this._selected) {
|
|
911
|
-
wrap_background.stroke(this._source.
|
|
931
|
+
wrap_background.stroke(this._source.selectedBorderColor);
|
|
912
932
|
wrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
913
933
|
}
|
|
914
934
|
else {
|
|
@@ -220,8 +220,8 @@ define([
|
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
|
|
223
|
-
SourcesLayer.prototype._onSegmentsShow = function(
|
|
224
|
-
this._lineGroups.addSegments(
|
|
223
|
+
SourcesLayer.prototype._onSegmentsShow = function(segmentsGroupId, lineId) {
|
|
224
|
+
this._lineGroups.addSegments(segmentsGroupId, lineId);
|
|
225
225
|
this._view.updateTimelineLength();
|
|
226
226
|
this._layer.draw();
|
|
227
227
|
};
|
package/src/main.js
CHANGED
|
@@ -135,6 +135,11 @@ define([
|
|
|
135
135
|
*/
|
|
136
136
|
randomizeSegmentColor: true,
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Block mouse clicks if a control key is pressed
|
|
140
|
+
*/
|
|
141
|
+
blockUpdatingOnMouseClickWithCtrlKey: false,
|
|
142
|
+
|
|
138
143
|
/**
|
|
139
144
|
* Block mouse clicks if a meta key is pressed
|
|
140
145
|
*/
|
|
@@ -722,8 +727,8 @@ define([
|
|
|
722
727
|
this.lineHandler.moveById(lineId, position);
|
|
723
728
|
};
|
|
724
729
|
|
|
725
|
-
Peaks.prototype.showSegments = function(
|
|
726
|
-
this.segmentHandler.
|
|
730
|
+
Peaks.prototype.showSegments = function(segmentsGroupId, lineId) {
|
|
731
|
+
this.segmentHandler.addSegmentsToLine(segmentsGroupId, lineId);
|
|
727
732
|
};
|
|
728
733
|
|
|
729
734
|
/**
|
|
@@ -744,18 +749,6 @@ define([
|
|
|
744
749
|
this.emit('handler.view.cutmode');
|
|
745
750
|
};
|
|
746
751
|
|
|
747
|
-
Peaks.prototype.setIndicatorType = function(linePosition, type) {
|
|
748
|
-
var lineId = this.view.getLineByPosition(linePosition).getId();
|
|
749
|
-
|
|
750
|
-
this.emit('lineIndicator.setType', lineId, type);
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
Peaks.prototype.setIndicatorText = function(linePosition, text) {
|
|
754
|
-
var lineId = this.view.getLineByPosition(linePosition).getId();
|
|
755
|
-
|
|
756
|
-
this.emit('lineIndicator.setText', lineId, text);
|
|
757
|
-
};
|
|
758
|
-
|
|
759
752
|
Peaks.prototype.getVisibleSegments = function() {
|
|
760
753
|
return this.view
|
|
761
754
|
.getSegmentsGroup()
|
package/src/models/line.js
CHANGED
|
@@ -74,9 +74,6 @@ define([
|
|
|
74
74
|
},
|
|
75
75
|
|
|
76
76
|
set: function(pos) {
|
|
77
|
-
if (!Utils.isInteger(pos) || pos < 0) {
|
|
78
|
-
throw new TypeError('peaks.lines.setPosition(): position must be a non-negative integer');
|
|
79
|
-
}
|
|
80
77
|
this._position = pos;
|
|
81
78
|
}
|
|
82
79
|
},
|
|
@@ -103,25 +100,11 @@ define([
|
|
|
103
100
|
|
|
104
101
|
Utils.extend(opts, options);
|
|
105
102
|
|
|
106
|
-
validateLine(
|
|
107
|
-
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
this._labelText = opts.labelText;
|
|
112
|
-
this._color = opts.color;
|
|
113
|
-
this._textColor = opts.textColor;
|
|
114
|
-
this._handleTextColor = opts.handleTextColor;
|
|
115
|
-
this._hoverColor = opts.hoverColor;
|
|
116
|
-
this._warningColor = opts.warningColor;
|
|
117
|
-
this._opacity = opts.opacity;
|
|
118
|
-
this._borderColor = opts.borderColor;
|
|
119
|
-
this._borderWidth = opts.borderWidth;
|
|
120
|
-
this._borderRadius = opts.borderRadius;
|
|
121
|
-
this._editable = opts.editable;
|
|
122
|
-
this._allowDeletion = opts.allowDeletion;
|
|
123
|
-
this._line = opts.line;
|
|
124
|
-
this._indicators = opts.indicators;
|
|
103
|
+
validateLine(opts, 'update()');
|
|
104
|
+
|
|
105
|
+
this._position = opts.position;
|
|
106
|
+
this._indicatorType = opts.indicatorType;
|
|
107
|
+
this._indicatorText = opts.indicatorText;
|
|
125
108
|
|
|
126
109
|
this._peaks.emit('model.line.update', this);
|
|
127
110
|
};
|
package/src/models/source.js
CHANGED
|
@@ -121,16 +121,39 @@ define([
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
if (
|
|
124
|
+
if (Utils.isNullOrUndefined(options.selectedBackgroundColor)) {
|
|
125
|
+
options.selectedBackgroundColor = options.backgroundColor;
|
|
126
|
+
}
|
|
127
|
+
else if (!Utils.isValidColor(options.selectedBackgroundColor)) {
|
|
128
|
+
throw new TypeError(
|
|
129
|
+
'peaks.sources.' + context + ': selectedBackgroundColor should be a valid CSS color'
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (Utils.isNullOrUndefined(options.hoverBackgroundColor)) {
|
|
134
|
+
options.hoverBackgroundColor = Utils.shadeColor(options.backgroundColor, 30);
|
|
135
|
+
}
|
|
136
|
+
else if (!Utils.isValidColor(options.hoverBackgroundColor)) {
|
|
137
|
+
throw new TypeError(
|
|
138
|
+
'peaks.sources.' + context + ': hoverBackgroundColor should be a valid CSS color'
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (Utils.isNullOrUndefined(options.borderColor)) {
|
|
125
143
|
options.borderColor = options.color;
|
|
126
144
|
}
|
|
145
|
+
else if (!Utils.isValidColor(options.borderColor)) {
|
|
146
|
+
throw new TypeError(
|
|
147
|
+
'peaks.sources.' + context + ': borderColor should be a valid CSS color'
|
|
148
|
+
);
|
|
149
|
+
}
|
|
127
150
|
|
|
128
|
-
if (Utils.isNullOrUndefined(options.
|
|
129
|
-
options.
|
|
151
|
+
if (Utils.isNullOrUndefined(options.selectedBorderColor)) {
|
|
152
|
+
options.selectedBorderColor = Utils.shadeColor(options.borderColor, 30);
|
|
130
153
|
}
|
|
131
|
-
else if (!Utils.isValidColor(options.
|
|
154
|
+
else if (!Utils.isValidColor(options.selectedBorderColor)) {
|
|
132
155
|
throw new TypeError(
|
|
133
|
-
'peaks.sources.' + context + ':
|
|
156
|
+
'peaks.sources.' + context + ': selectedBorderColor should be a valid CSS color'
|
|
134
157
|
);
|
|
135
158
|
}
|
|
136
159
|
|
|
@@ -374,7 +397,7 @@ define([
|
|
|
374
397
|
* @param {String} color Primary color of the source representation.
|
|
375
398
|
* @param {String} backgroundColor Background color of the source.
|
|
376
399
|
* @param {String} borderColor Border color of the source.
|
|
377
|
-
* @param {String}
|
|
400
|
+
* @param {String} selectedBorderColor Color when the source is selected.
|
|
378
401
|
* @param {String} warningColor Color used for warning states.
|
|
379
402
|
* @param {String} volumeSliderColor Color of the volume slider.
|
|
380
403
|
* @param {Number} volumeSliderWidth Width of the volume slider.
|
|
@@ -407,9 +430,9 @@ define([
|
|
|
407
430
|
*/
|
|
408
431
|
|
|
409
432
|
function Source(peaks, id, lineId, originId, elementId, title, titleAlignments, url, previewUrl, binaryUrl, kind,
|
|
410
|
-
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
411
|
-
borderColor,
|
|
412
|
-
volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition,
|
|
433
|
+
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, hoverBackgroundColor,
|
|
434
|
+
selectedBackgroundColor, borderColor, selectedBorderColor, warningColor, warningWidth, volumeSliderColor,
|
|
435
|
+
volumeSliderWidth, volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition,
|
|
413
436
|
textAutoScroll, borderWidth, borderRadius, wrapped, draggable, orderable, resizable,
|
|
414
437
|
cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, buttons, markerColor,
|
|
415
438
|
markerWidth, volume, volumeRange, loading, ...customParams) {
|
|
@@ -428,8 +451,10 @@ define([
|
|
|
428
451
|
mediaEndTime: mediaEndTime,
|
|
429
452
|
color: color,
|
|
430
453
|
backgroundColor: backgroundColor,
|
|
454
|
+
hoverBackgroundColor: hoverBackgroundColor,
|
|
455
|
+
selectedBackgroundColor: selectedBackgroundColor,
|
|
431
456
|
borderColor: borderColor,
|
|
432
|
-
|
|
457
|
+
selectedBorderColor: selectedBorderColor,
|
|
433
458
|
warningColor: warningColor,
|
|
434
459
|
warningWidth: warningWidth,
|
|
435
460
|
textFont: textFont,
|
|
@@ -483,8 +508,10 @@ define([
|
|
|
483
508
|
this._mediaEndTime = opts.mediaEndTime;
|
|
484
509
|
this._color = opts.color;
|
|
485
510
|
this._backgroundColor = opts.backgroundColor;
|
|
511
|
+
this._hoverBackgroundColor = opts.hoverBackgroundColor;
|
|
512
|
+
this._selectedBackgroundColor = opts.selectedBackgroundColor;
|
|
486
513
|
this._borderColor = opts.borderColor;
|
|
487
|
-
this.
|
|
514
|
+
this._selectedBorderColor = opts.selectedBorderColor;
|
|
488
515
|
this._warningColor = opts.warningColor;
|
|
489
516
|
this._warningWidth = opts.warningWidth;
|
|
490
517
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
@@ -669,6 +696,26 @@ define([
|
|
|
669
696
|
this._backgroundColor = backgroundColor;
|
|
670
697
|
}
|
|
671
698
|
},
|
|
699
|
+
hoverBackgroundColor: {
|
|
700
|
+
enumerable: true,
|
|
701
|
+
get: function() {
|
|
702
|
+
return this._hoverBackgroundColor;
|
|
703
|
+
},
|
|
704
|
+
|
|
705
|
+
set: function(hoverBackgroundColor) {
|
|
706
|
+
this._hoverBackgroundColor = hoverBackgroundColor;
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
selectedBackgroundColor: {
|
|
710
|
+
enumerable: true,
|
|
711
|
+
get: function() {
|
|
712
|
+
return this._selectedBackgroundColor;
|
|
713
|
+
},
|
|
714
|
+
|
|
715
|
+
set: function(selectedBackgroundColor) {
|
|
716
|
+
this._selectedBackgroundColor = selectedBackgroundColor;
|
|
717
|
+
}
|
|
718
|
+
},
|
|
672
719
|
borderColor: {
|
|
673
720
|
enumerable: true,
|
|
674
721
|
get: function() {
|
|
@@ -679,14 +726,14 @@ define([
|
|
|
679
726
|
this._borderColor = borderColor;
|
|
680
727
|
}
|
|
681
728
|
},
|
|
682
|
-
|
|
729
|
+
selectedBorderColor: {
|
|
683
730
|
enumerable: true,
|
|
684
731
|
get: function() {
|
|
685
|
-
return this.
|
|
732
|
+
return this._selectedBorderColor;
|
|
686
733
|
},
|
|
687
734
|
|
|
688
|
-
set: function(
|
|
689
|
-
this.
|
|
735
|
+
set: function(selectedBorderColor) {
|
|
736
|
+
this._selectedBorderColor = selectedBorderColor;
|
|
690
737
|
}
|
|
691
738
|
},
|
|
692
739
|
warningColor: {
|
|
@@ -1084,8 +1131,10 @@ define([
|
|
|
1084
1131
|
mediaEndTime: this.mediaEndTime,
|
|
1085
1132
|
color: this.color,
|
|
1086
1133
|
backgroundColor: this.backgroundColor,
|
|
1134
|
+
hoverBackgroundColor: this.hoverBackgroundColor,
|
|
1135
|
+
selectedBackgroundColor: this.selectedBackgroundColor,
|
|
1087
1136
|
borderColor: this.borderColor,
|
|
1088
|
-
|
|
1137
|
+
selectedBorderColor: this.selectedBorderColor,
|
|
1089
1138
|
warningColor: this.warningColor,
|
|
1090
1139
|
warningWidth: this.warningWidth,
|
|
1091
1140
|
volumeSliderColor: this.volumeSliderColor,
|
|
@@ -1137,7 +1186,7 @@ define([
|
|
|
1137
1186
|
this._color = opts.color;
|
|
1138
1187
|
this._backgroundColor = opts.backgroundColor;
|
|
1139
1188
|
this._borderColor = opts.borderColor;
|
|
1140
|
-
this.
|
|
1189
|
+
this._selectedBorderColor = opts.selectedBorderColor;
|
|
1141
1190
|
this._warningColor = opts.warningColor;
|
|
1142
1191
|
this._warningWidth = opts.warningWidth;
|
|
1143
1192
|
this._volumeSliderColor = opts.volumeSliderColor;
|
package/src/segment-handler.js
CHANGED
|
@@ -176,8 +176,16 @@ define([
|
|
|
176
176
|
* Add segments to the given line so they can be displayed.
|
|
177
177
|
*/
|
|
178
178
|
|
|
179
|
-
SegmentHandler.prototype.
|
|
180
|
-
|
|
179
|
+
SegmentHandler.prototype.addSegmentsToLine = function(segmentsGroupId, lineId) {
|
|
180
|
+
if (
|
|
181
|
+
!Utils.isString(lineId) ||
|
|
182
|
+
Utils.isNullOrUndefined(this._peaks.lineHandler.getLine(lineId))
|
|
183
|
+
) {
|
|
184
|
+
throw new Error('peaks.segmentHandler.addSegmentsToLine(): line with id ' + lineId +
|
|
185
|
+
' does not exist');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
this._peaks.emit('handler.segments.show', segmentsGroupId, lineId);
|
|
181
189
|
};
|
|
182
190
|
|
|
183
191
|
/**
|
package/src/source-handler.js
CHANGED
|
@@ -78,8 +78,10 @@ define([
|
|
|
78
78
|
mediaEndTime: originalMediaEndTime,
|
|
79
79
|
color: sourceToCut.color,
|
|
80
80
|
backgroundColor: sourceToCut.backgroundColor,
|
|
81
|
+
hoverBackgroundColor: sourceToCut.hoverBackgroundColor,
|
|
82
|
+
selectedBackgroundColor: sourceToCut.selectedBackgroundColor,
|
|
81
83
|
borderColor: sourceToCut.borderColor,
|
|
82
|
-
|
|
84
|
+
selectedBorderColor: sourceToCut.selectedBorderColor,
|
|
83
85
|
warningColor: sourceToCut.warningColor,
|
|
84
86
|
warningWidth: sourceToCut.warningWidth,
|
|
85
87
|
volumeSliderColor: sourceToCut.volumeSliderColor,
|
|
@@ -143,8 +145,10 @@ define([
|
|
|
143
145
|
SourceHandler.prototype._addSource = function(source) {
|
|
144
146
|
this._sources.push(source);
|
|
145
147
|
this._sourcesById[source.id] = source;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
if (Utils.isNullOrUndefined(this._sourcesByLineId[source.lineId])) {
|
|
149
|
+
this._sourcesByLineId[source.lineId] = {};
|
|
150
|
+
}
|
|
151
|
+
this._sourcesByLineId[source.lineId][source.id] = source;
|
|
148
152
|
};
|
|
149
153
|
|
|
150
154
|
/**
|
|
@@ -190,8 +194,10 @@ define([
|
|
|
190
194
|
options.mediaEndTime,
|
|
191
195
|
options.color,
|
|
192
196
|
options.backgroundColor,
|
|
197
|
+
options.hoverBackgroundColor,
|
|
198
|
+
options.selectedBackgroundColor,
|
|
193
199
|
options.borderColor,
|
|
194
|
-
options.
|
|
200
|
+
options.selectedBorderColor,
|
|
195
201
|
options.warningColor,
|
|
196
202
|
options.warningWidth,
|
|
197
203
|
options.volumeSliderColor,
|
|
@@ -238,6 +244,10 @@ define([
|
|
|
238
244
|
return this._sources;
|
|
239
245
|
};
|
|
240
246
|
|
|
247
|
+
SourceHandler.prototype.getSourcesByLineId = function(lineId) {
|
|
248
|
+
return Utils.isNullOrUndefined(lineId) ? this._sourcesByLineId : this._sourcesByLineId[lineId];
|
|
249
|
+
};
|
|
250
|
+
|
|
241
251
|
/**
|
|
242
252
|
* Returns all sources, serialized to a plain object.
|
|
243
253
|
*
|
|
@@ -380,6 +390,7 @@ define([
|
|
|
380
390
|
var itemDestroyed = this._sources.splice(index, 1)[0];
|
|
381
391
|
|
|
382
392
|
delete this._sourcesById[itemDestroyed.id];
|
|
393
|
+
delete this._sourcesByLineId[itemDestroyed.lineId][itemDestroyed.id];
|
|
383
394
|
|
|
384
395
|
destroyed.push(itemDestroyed);
|
|
385
396
|
}
|
package/src/view.js
CHANGED
|
@@ -79,7 +79,6 @@ define([
|
|
|
79
79
|
self._timeToPixelsScale = self._options.initialZoomLevel;
|
|
80
80
|
self._timeToPixelsMinScale = self._options.minScale;
|
|
81
81
|
|
|
82
|
-
self._resizeTimeoutId = null;
|
|
83
82
|
self._isFocused = false;
|
|
84
83
|
self._isClickable = true;
|
|
85
84
|
|
|
@@ -887,11 +886,6 @@ define([
|
|
|
887
886
|
};
|
|
888
887
|
|
|
889
888
|
View.prototype.destroy = function() {
|
|
890
|
-
if (this._resizeTimeoutId) {
|
|
891
|
-
clearTimeout(this._resizeTimeoutId);
|
|
892
|
-
this._resizeTimeoutId = null;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
889
|
// Unregister event handlers
|
|
896
890
|
this._peaks.off('player_time_update', this._onTimeUpdate);
|
|
897
891
|
this._peaks.off('user_seek', this._onSeek);
|