@checksub_team/peaks_timeline 1.13.5 → 1.13.7
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 +27 -8
- package/src/main.js +14 -0
- package/src/source-group.js +4 -6
- package/src/source.js +26 -4
- package/src/timeline-sources.js +2 -0
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15914,6 +15914,8 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15914
15914
|
sourceHandleWidth: 12,
|
|
15915
15915
|
sourceTextXOffset: 10,
|
|
15916
15916
|
sourceTextYOffset: 10,
|
|
15917
|
+
sourceIndicatorsXOffset: 8,
|
|
15918
|
+
sourceIndicatorsYOffset: 12,
|
|
15917
15919
|
autoScrollThreshold: 0.05,
|
|
15918
15920
|
enableLineIndicatorContextMenu: true,
|
|
15919
15921
|
minSourceSize: 0.05,
|
|
@@ -18106,8 +18108,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18106
18108
|
var SPACING_BETWEEN_PREVIEWS = 1.5;
|
|
18107
18109
|
var CORNER_RADIUS = 8;
|
|
18108
18110
|
var INDICATOR_RADIUS = 4;
|
|
18109
|
-
var INDICATORS_MARGIN_LEFT = 8;
|
|
18110
|
-
var INDICATORS_MARGIN_TOP = 12;
|
|
18111
18111
|
function SourceGroup(source, peaks, layer, view) {
|
|
18112
18112
|
this._source = source;
|
|
18113
18113
|
this._peaks = peaks;
|
|
@@ -18325,12 +18325,12 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18325
18325
|
if (this._source.shouldShowWarning()) {
|
|
18326
18326
|
var gradient = ctx.createLinearGradient(0, 0, this._width, 0);
|
|
18327
18327
|
if (this._source.mediaEndTime < this._source.duration) {
|
|
18328
|
-
var rightStopPosition = Math.max(1 -
|
|
18328
|
+
var rightStopPosition = Math.max(1 - this._source.warningWidth / this._width, 0.5);
|
|
18329
18329
|
gradient.addColorStop(rightStopPosition, this._source.backgroundColor);
|
|
18330
18330
|
gradient.addColorStop(1, this._source.warningColor);
|
|
18331
18331
|
}
|
|
18332
18332
|
if (this._source.mediaStartTime > 0) {
|
|
18333
|
-
var leftStopPosition = Math.min(
|
|
18333
|
+
var leftStopPosition = Math.min(this._source.warningWidth / this._width, 0.5);
|
|
18334
18334
|
gradient.addColorStop(0, this._source.warningColor);
|
|
18335
18335
|
gradient.addColorStop(leftStopPosition, this._source.backgroundColor);
|
|
18336
18336
|
}
|
|
@@ -18842,8 +18842,8 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18842
18842
|
zIndex += 1;
|
|
18843
18843
|
}
|
|
18844
18844
|
}
|
|
18845
|
-
this._indicatorsGroup.offsetX(currentX -
|
|
18846
|
-
this._indicatorsGroup.offsetY(-
|
|
18845
|
+
this._indicatorsGroup.offsetX(currentX - this._peaks.options.sourceIndicatorsXOffset);
|
|
18846
|
+
this._indicatorsGroup.offsetY(-this._peaks.options.sourceIndicatorsYOffset);
|
|
18847
18847
|
};
|
|
18848
18848
|
SourceGroup.prototype._createMarkers = function () {
|
|
18849
18849
|
const markersGroup = new Konva.Group({ listening: false });
|
|
@@ -19077,6 +19077,11 @@ module.exports = function (Utils) {
|
|
|
19077
19077
|
} else if (!Utils.isValidColor(options.warningColor)) {
|
|
19078
19078
|
throw new TypeError('peaks.sources.' + context + ': warningColor should be a valid CSS color');
|
|
19079
19079
|
}
|
|
19080
|
+
if (Utils.isNullOrUndefined(options.warningWidth)) {
|
|
19081
|
+
options.warningWidth = 10;
|
|
19082
|
+
} else if (!Utils.isNumber(options.warningWidth)) {
|
|
19083
|
+
throw new TypeError('peaks.sources.' + context + ': warningWidth should be a number');
|
|
19084
|
+
}
|
|
19080
19085
|
if (Utils.isNullOrUndefined(options.volumeSliderColor)) {
|
|
19081
19086
|
options.volumeSliderColor = '#000000';
|
|
19082
19087
|
} else if (!Utils.isValidColor(options.volumeSliderColor)) {
|
|
@@ -19207,7 +19212,7 @@ module.exports = function (Utils) {
|
|
|
19207
19212
|
}
|
|
19208
19213
|
}
|
|
19209
19214
|
}
|
|
19210
|
-
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor, selectedColor, warningColor, volumeSliderColor, volumeSliderWidth, volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition, textAutoScroll, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor, markerWidth, volume, volumeRange) {
|
|
19215
|
+
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor, selectedColor, warningColor, warningWidth, volumeSliderColor, volumeSliderWidth, volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition, textAutoScroll, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor, markerWidth, volume, volumeRange) {
|
|
19211
19216
|
var opts = {
|
|
19212
19217
|
title: title,
|
|
19213
19218
|
url: url,
|
|
@@ -19225,6 +19230,7 @@ module.exports = function (Utils) {
|
|
|
19225
19230
|
borderColor: borderColor,
|
|
19226
19231
|
selectedColor: selectedColor,
|
|
19227
19232
|
warningColor: warningColor,
|
|
19233
|
+
warningWidth: warningWidth,
|
|
19228
19234
|
textFont: textFont,
|
|
19229
19235
|
textFontSize: textFontSize,
|
|
19230
19236
|
textColor: textColor,
|
|
@@ -19274,6 +19280,7 @@ module.exports = function (Utils) {
|
|
|
19274
19280
|
this._borderColor = opts.borderColor;
|
|
19275
19281
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
19276
19282
|
this._warningColor = opts.warningColor;
|
|
19283
|
+
this._warningWidth = opts.warningWidth;
|
|
19277
19284
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
19278
19285
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
19279
19286
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
|
@@ -19449,6 +19456,15 @@ module.exports = function (Utils) {
|
|
|
19449
19456
|
this._warningColor = warningColor;
|
|
19450
19457
|
}
|
|
19451
19458
|
},
|
|
19459
|
+
warningWidth: {
|
|
19460
|
+
enumerable: true,
|
|
19461
|
+
get: function () {
|
|
19462
|
+
return this._warningWidth;
|
|
19463
|
+
},
|
|
19464
|
+
set: function (warningWidth) {
|
|
19465
|
+
this._warningWidth = warningWidth;
|
|
19466
|
+
}
|
|
19467
|
+
},
|
|
19452
19468
|
volumeSliderColor: {
|
|
19453
19469
|
enumerable: true,
|
|
19454
19470
|
get: function () {
|
|
@@ -19777,6 +19793,7 @@ module.exports = function (Utils) {
|
|
|
19777
19793
|
borderColor: this.borderColor,
|
|
19778
19794
|
selectedColor: this.selectedColor,
|
|
19779
19795
|
warningColor: this.warningColor,
|
|
19796
|
+
warningWidth: this.warningWidth,
|
|
19780
19797
|
volumeSliderColor: this.volumeSliderColor,
|
|
19781
19798
|
volumeSliderWidth: this.volumeSliderWidth,
|
|
19782
19799
|
volumeSliderDraggingWidth: this.volumeSliderDraggingWidth,
|
|
@@ -19823,6 +19840,7 @@ module.exports = function (Utils) {
|
|
|
19823
19840
|
this._borderColor = opts.borderColor;
|
|
19824
19841
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
19825
19842
|
this._warningColor = opts.warningColor;
|
|
19843
|
+
this._warningWidth = opts.warningWidth;
|
|
19826
19844
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
19827
19845
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
19828
19846
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
|
@@ -20667,6 +20685,7 @@ module.exports = function (Source, Utils) {
|
|
|
20667
20685
|
borderColor: sourceToCut.borderColor,
|
|
20668
20686
|
selectedColor: sourceToCut.selectedColor,
|
|
20669
20687
|
warningColor: sourceToCut.warningColor,
|
|
20688
|
+
warningWidth: sourceToCut.warningWidth,
|
|
20670
20689
|
volumeSliderColor: sourceToCut.volumeSliderColor,
|
|
20671
20690
|
volumeSliderWidth: sourceToCut.volumeSliderWidth,
|
|
20672
20691
|
volumeSliderDraggingWidth: sourceToCut.volumeSliderDraggingWidth,
|
|
@@ -20710,7 +20729,7 @@ module.exports = function (Source, Utils) {
|
|
|
20710
20729
|
if (!Utils.isObject(options)) {
|
|
20711
20730
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
20712
20731
|
}
|
|
20713
|
-
var source = new Source(this._peaks, options.id || this._getNextSourceId(), options.originId, options.elementId, options.title, 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.selectedColor, options.warningColor, 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.position, options.draggable, options.orderable, options.resizable, options.cuttable, options.deletable, options.wrapping, options.previewHeight, options.binaryHeight, options.indicators, options.markers, options.markerColor, options.markerWidth, options.volume, options.volumeRange);
|
|
20732
|
+
var source = new Source(this._peaks, options.id || this._getNextSourceId(), options.originId, options.elementId, options.title, 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.selectedColor, 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.position, options.draggable, options.orderable, options.resizable, options.cuttable, options.deletable, options.wrapping, options.previewHeight, options.binaryHeight, options.indicators, options.markers, options.markerColor, options.markerWidth, options.volume, options.volumeRange);
|
|
20714
20733
|
return source;
|
|
20715
20734
|
};
|
|
20716
20735
|
TimelineSources.prototype.getSources = function () {
|
package/src/main.js
CHANGED
|
@@ -355,6 +355,20 @@ define([
|
|
|
355
355
|
*/
|
|
356
356
|
sourceTextYOffset: 10,
|
|
357
357
|
|
|
358
|
+
/**
|
|
359
|
+
* X Offset of the source indicators, in pixels
|
|
360
|
+
* This is the offset of the source indicators
|
|
361
|
+
* from the left side of the source
|
|
362
|
+
*/
|
|
363
|
+
sourceIndicatorsXOffset: 8,
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Y Offset of the source indicators, in pixels
|
|
367
|
+
* This is the offset of the source indicators
|
|
368
|
+
* from the top of the source
|
|
369
|
+
*/
|
|
370
|
+
sourceIndicatorsYOffset: 12,
|
|
371
|
+
|
|
358
372
|
/**
|
|
359
373
|
* Threshold size on the left and right border of the view,
|
|
360
374
|
* where auto scrolling is activated, between 0 and 1.
|
package/src/source-group.js
CHANGED
|
@@ -22,8 +22,6 @@ define([
|
|
|
22
22
|
var SPACING_BETWEEN_PREVIEWS = 1.5;
|
|
23
23
|
var CORNER_RADIUS = 8;
|
|
24
24
|
var INDICATOR_RADIUS = 4; // px
|
|
25
|
-
var INDICATORS_MARGIN_LEFT = 8; // px
|
|
26
|
-
var INDICATORS_MARGIN_TOP = 12; // px
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* Creates a source group for the given source.
|
|
@@ -360,14 +358,14 @@ define([
|
|
|
360
358
|
var gradient = ctx.createLinearGradient(0, 0, this._width, 0);
|
|
361
359
|
|
|
362
360
|
if (this._source.mediaEndTime < this._source.duration) {
|
|
363
|
-
var rightStopPosition = Math.max(1 - (
|
|
361
|
+
var rightStopPosition = Math.max(1 - (this._source.warningWidth / this._width), 0.5);
|
|
364
362
|
|
|
365
363
|
gradient.addColorStop(rightStopPosition, this._source.backgroundColor);
|
|
366
364
|
gradient.addColorStop(1, this._source.warningColor);
|
|
367
365
|
}
|
|
368
366
|
|
|
369
367
|
if (this._source.mediaStartTime > 0) {
|
|
370
|
-
var leftStopPosition = Math.min(
|
|
368
|
+
var leftStopPosition = Math.min(this._source.warningWidth / this._width, 0.5);
|
|
371
369
|
|
|
372
370
|
gradient.addColorStop(0, this._source.warningColor);
|
|
373
371
|
gradient.addColorStop(leftStopPosition, this._source.backgroundColor);
|
|
@@ -1039,8 +1037,8 @@ define([
|
|
|
1039
1037
|
}
|
|
1040
1038
|
}
|
|
1041
1039
|
|
|
1042
|
-
this._indicatorsGroup.offsetX(currentX -
|
|
1043
|
-
this._indicatorsGroup.offsetY(-
|
|
1040
|
+
this._indicatorsGroup.offsetX(currentX - this._peaks.options.sourceIndicatorsXOffset);
|
|
1041
|
+
this._indicatorsGroup.offsetY(-this._peaks.options.sourceIndicatorsYOffset);
|
|
1044
1042
|
};
|
|
1045
1043
|
|
|
1046
1044
|
SourceGroup.prototype._createMarkers = function() {
|
package/src/source.js
CHANGED
|
@@ -136,6 +136,13 @@ define([
|
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
if (Utils.isNullOrUndefined(options.warningWidth)) {
|
|
140
|
+
options.warningWidth = 10;
|
|
141
|
+
}
|
|
142
|
+
else if (!Utils.isNumber(options.warningWidth)) {
|
|
143
|
+
throw new TypeError('peaks.sources.' + context + ': warningWidth should be a number');
|
|
144
|
+
}
|
|
145
|
+
|
|
139
146
|
if (Utils.isNullOrUndefined(options.volumeSliderColor)) {
|
|
140
147
|
options.volumeSliderColor = '#000000';
|
|
141
148
|
}
|
|
@@ -346,10 +353,11 @@ define([
|
|
|
346
353
|
|
|
347
354
|
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind,
|
|
348
355
|
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
349
|
-
borderColor, selectedColor, warningColor, volumeSliderColor, volumeSliderWidth,
|
|
350
|
-
textFont, textFontSize, textColor, textBackgroundColor, textPosition,
|
|
351
|
-
borderRadius, wrapped, position, draggable, orderable, resizable,
|
|
352
|
-
previewHeight, binaryHeight, indicators, markers, markerColor,
|
|
356
|
+
borderColor, selectedColor, warningColor, warningWidth, volumeSliderColor, volumeSliderWidth,
|
|
357
|
+
volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition,
|
|
358
|
+
textAutoScroll, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable,
|
|
359
|
+
cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor,
|
|
360
|
+
markerWidth, volume, volumeRange) {
|
|
353
361
|
var opts = {
|
|
354
362
|
title: title,
|
|
355
363
|
url: url,
|
|
@@ -367,6 +375,7 @@ define([
|
|
|
367
375
|
borderColor: borderColor,
|
|
368
376
|
selectedColor: selectedColor,
|
|
369
377
|
warningColor: warningColor,
|
|
378
|
+
warningWidth: warningWidth,
|
|
370
379
|
textFont: textFont,
|
|
371
380
|
textFontSize: textFontSize,
|
|
372
381
|
textColor: textColor,
|
|
@@ -418,6 +427,7 @@ define([
|
|
|
418
427
|
this._borderColor = opts.borderColor;
|
|
419
428
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
420
429
|
this._warningColor = opts.warningColor;
|
|
430
|
+
this._warningWidth = opts.warningWidth;
|
|
421
431
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
422
432
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
423
433
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
|
@@ -604,6 +614,16 @@ define([
|
|
|
604
614
|
this._warningColor = warningColor;
|
|
605
615
|
}
|
|
606
616
|
},
|
|
617
|
+
warningWidth: {
|
|
618
|
+
enumerable: true,
|
|
619
|
+
get: function() {
|
|
620
|
+
return this._warningWidth;
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
set: function(warningWidth) {
|
|
624
|
+
this._warningWidth = warningWidth;
|
|
625
|
+
}
|
|
626
|
+
},
|
|
607
627
|
volumeSliderColor: {
|
|
608
628
|
enumerable: true,
|
|
609
629
|
get: function() {
|
|
@@ -979,6 +999,7 @@ define([
|
|
|
979
999
|
borderColor: this.borderColor,
|
|
980
1000
|
selectedColor: this.selectedColor,
|
|
981
1001
|
warningColor: this.warningColor,
|
|
1002
|
+
warningWidth: this.warningWidth,
|
|
982
1003
|
volumeSliderColor: this.volumeSliderColor,
|
|
983
1004
|
volumeSliderWidth: this.volumeSliderWidth,
|
|
984
1005
|
volumeSliderDraggingWidth: this.volumeSliderDraggingWidth,
|
|
@@ -1028,6 +1049,7 @@ define([
|
|
|
1028
1049
|
this._borderColor = opts.borderColor;
|
|
1029
1050
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
1030
1051
|
this._warningColor = opts.warningColor;
|
|
1052
|
+
this._warningWidth = opts.warningWidth;
|
|
1031
1053
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
1032
1054
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
1033
1055
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
package/src/timeline-sources.js
CHANGED
|
@@ -82,6 +82,7 @@ define([
|
|
|
82
82
|
borderColor: sourceToCut.borderColor,
|
|
83
83
|
selectedColor: sourceToCut.selectedColor,
|
|
84
84
|
warningColor: sourceToCut.warningColor,
|
|
85
|
+
warningWidth: sourceToCut.warningWidth,
|
|
85
86
|
volumeSliderColor: sourceToCut.volumeSliderColor,
|
|
86
87
|
volumeSliderWidth: sourceToCut.volumeSliderWidth,
|
|
87
88
|
volumeSliderDraggingWidth: sourceToCut.volumeSliderDraggingWidth,
|
|
@@ -173,6 +174,7 @@ define([
|
|
|
173
174
|
options.borderColor,
|
|
174
175
|
options.selectedColor,
|
|
175
176
|
options.warningColor,
|
|
177
|
+
options.warningWidth,
|
|
176
178
|
options.volumeSliderColor,
|
|
177
179
|
options.volumeSliderWidth,
|
|
178
180
|
options.volumeSliderDraggingWidth,
|