@checksub_team/peaks_timeline 1.14.0-alpha.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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;
|
|
@@ -18333,12 +18333,12 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18333
18333
|
if (this._source.shouldShowWarning()) {
|
|
18334
18334
|
var gradient = ctx.createLinearGradient(0, 0, this._width, 0);
|
|
18335
18335
|
if (this._source.mediaEndTime < this._source.duration) {
|
|
18336
|
-
var rightStopPosition = Math.max(1 -
|
|
18336
|
+
var rightStopPosition = Math.max(1 - this._source.warningWidth / this._width, 0.5);
|
|
18337
18337
|
gradient.addColorStop(rightStopPosition, this._source.backgroundColor);
|
|
18338
18338
|
gradient.addColorStop(1, this._source.warningColor);
|
|
18339
18339
|
}
|
|
18340
18340
|
if (this._source.mediaStartTime > 0) {
|
|
18341
|
-
var leftStopPosition = Math.min(
|
|
18341
|
+
var leftStopPosition = Math.min(this._source.warningWidth / this._width, 0.5);
|
|
18342
18342
|
gradient.addColorStop(0, this._source.warningColor);
|
|
18343
18343
|
gradient.addColorStop(leftStopPosition, this._source.backgroundColor);
|
|
18344
18344
|
}
|
|
@@ -18866,8 +18866,8 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18866
18866
|
zIndex += 1;
|
|
18867
18867
|
}
|
|
18868
18868
|
}
|
|
18869
|
-
this._indicatorsGroup.offsetX(currentX -
|
|
18870
|
-
this._indicatorsGroup.offsetY(-
|
|
18869
|
+
this._indicatorsGroup.offsetX(currentX - this._peaks.options.sourceIndicatorsXOffset);
|
|
18870
|
+
this._indicatorsGroup.offsetY(-this._peaks.options.sourceIndicatorsYOffset);
|
|
18871
18871
|
};
|
|
18872
18872
|
SourceGroup.prototype._createMarkers = function () {
|
|
18873
18873
|
const markersGroup = new Konva.Group({ listening: false });
|
|
@@ -19106,6 +19106,11 @@ module.exports = function (Utils) {
|
|
|
19106
19106
|
} else if (!Utils.isValidColor(options.warningColor)) {
|
|
19107
19107
|
throw new TypeError('peaks.sources.' + context + ': warningColor should be a valid CSS color');
|
|
19108
19108
|
}
|
|
19109
|
+
if (Utils.isNullOrUndefined(options.warningWidth)) {
|
|
19110
|
+
options.warningWidth = 10;
|
|
19111
|
+
} else if (!Utils.isNumber(options.warningWidth)) {
|
|
19112
|
+
throw new TypeError('peaks.sources.' + context + ': warningWidth should be a number');
|
|
19113
|
+
}
|
|
19109
19114
|
if (Utils.isNullOrUndefined(options.volumeSliderColor)) {
|
|
19110
19115
|
options.volumeSliderColor = '#000000';
|
|
19111
19116
|
} else if (!Utils.isValidColor(options.volumeSliderColor)) {
|
|
@@ -19236,7 +19241,7 @@ module.exports = function (Utils) {
|
|
|
19236
19241
|
}
|
|
19237
19242
|
}
|
|
19238
19243
|
}
|
|
19239
|
-
function Source(peaks, id, originId, elementId, title, titleAlignments, 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) {
|
|
19244
|
+
function Source(peaks, id, originId, elementId, title, titleAlignments, 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) {
|
|
19240
19245
|
var opts = {
|
|
19241
19246
|
title: title,
|
|
19242
19247
|
titleAlignments: titleAlignments,
|
|
@@ -19255,6 +19260,7 @@ module.exports = function (Utils) {
|
|
|
19255
19260
|
borderColor: borderColor,
|
|
19256
19261
|
selectedColor: selectedColor,
|
|
19257
19262
|
warningColor: warningColor,
|
|
19263
|
+
warningWidth: warningWidth,
|
|
19258
19264
|
textFont: textFont,
|
|
19259
19265
|
textFontSize: textFontSize,
|
|
19260
19266
|
textColor: textColor,
|
|
@@ -19305,6 +19311,7 @@ module.exports = function (Utils) {
|
|
|
19305
19311
|
this._borderColor = opts.borderColor;
|
|
19306
19312
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
19307
19313
|
this._warningColor = opts.warningColor;
|
|
19314
|
+
this._warningWidth = opts.warningWidth;
|
|
19308
19315
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
19309
19316
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
19310
19317
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
|
@@ -19486,6 +19493,15 @@ module.exports = function (Utils) {
|
|
|
19486
19493
|
this._warningColor = warningColor;
|
|
19487
19494
|
}
|
|
19488
19495
|
},
|
|
19496
|
+
warningWidth: {
|
|
19497
|
+
enumerable: true,
|
|
19498
|
+
get: function () {
|
|
19499
|
+
return this._warningWidth;
|
|
19500
|
+
},
|
|
19501
|
+
set: function (warningWidth) {
|
|
19502
|
+
this._warningWidth = warningWidth;
|
|
19503
|
+
}
|
|
19504
|
+
},
|
|
19489
19505
|
volumeSliderColor: {
|
|
19490
19506
|
enumerable: true,
|
|
19491
19507
|
get: function () {
|
|
@@ -19815,6 +19831,7 @@ module.exports = function (Utils) {
|
|
|
19815
19831
|
borderColor: this.borderColor,
|
|
19816
19832
|
selectedColor: this.selectedColor,
|
|
19817
19833
|
warningColor: this.warningColor,
|
|
19834
|
+
warningWidth: this.warningWidth,
|
|
19818
19835
|
volumeSliderColor: this.volumeSliderColor,
|
|
19819
19836
|
volumeSliderWidth: this.volumeSliderWidth,
|
|
19820
19837
|
volumeSliderDraggingWidth: this.volumeSliderDraggingWidth,
|
|
@@ -19862,6 +19879,7 @@ module.exports = function (Utils) {
|
|
|
19862
19879
|
this._borderColor = opts.borderColor;
|
|
19863
19880
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
19864
19881
|
this._warningColor = opts.warningColor;
|
|
19882
|
+
this._warningWidth = opts.warningWidth;
|
|
19865
19883
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
19866
19884
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
19867
19885
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
|
@@ -20718,6 +20736,7 @@ module.exports = function (Source, Utils) {
|
|
|
20718
20736
|
borderColor: sourceToCut.borderColor,
|
|
20719
20737
|
selectedColor: sourceToCut.selectedColor,
|
|
20720
20738
|
warningColor: sourceToCut.warningColor,
|
|
20739
|
+
warningWidth: sourceToCut.warningWidth,
|
|
20721
20740
|
volumeSliderColor: sourceToCut.volumeSliderColor,
|
|
20722
20741
|
volumeSliderWidth: sourceToCut.volumeSliderWidth,
|
|
20723
20742
|
volumeSliderDraggingWidth: sourceToCut.volumeSliderDraggingWidth,
|
|
@@ -20761,7 +20780,7 @@ module.exports = function (Source, Utils) {
|
|
|
20761
20780
|
if (!Utils.isObject(options)) {
|
|
20762
20781
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
20763
20782
|
}
|
|
20764
|
-
var source = new Source(this._peaks, options.id || this._getNextSourceId(), 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.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);
|
|
20783
|
+
var source = new Source(this._peaks, options.id || this._getNextSourceId(), 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.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);
|
|
20765
20784
|
return source;
|
|
20766
20785
|
};
|
|
20767
20786
|
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.
|
|
@@ -371,14 +369,14 @@ define([
|
|
|
371
369
|
var gradient = ctx.createLinearGradient(0, 0, this._width, 0);
|
|
372
370
|
|
|
373
371
|
if (this._source.mediaEndTime < this._source.duration) {
|
|
374
|
-
var rightStopPosition = Math.max(1 - (
|
|
372
|
+
var rightStopPosition = Math.max(1 - (this._source.warningWidth / this._width), 0.5);
|
|
375
373
|
|
|
376
374
|
gradient.addColorStop(rightStopPosition, this._source.backgroundColor);
|
|
377
375
|
gradient.addColorStop(1, this._source.warningColor);
|
|
378
376
|
}
|
|
379
377
|
|
|
380
378
|
if (this._source.mediaStartTime > 0) {
|
|
381
|
-
var leftStopPosition = Math.min(
|
|
379
|
+
var leftStopPosition = Math.min(this._source.warningWidth / this._width, 0.5);
|
|
382
380
|
|
|
383
381
|
gradient.addColorStop(0, this._source.warningColor);
|
|
384
382
|
gradient.addColorStop(leftStopPosition, this._source.backgroundColor);
|
|
@@ -1070,8 +1068,8 @@ define([
|
|
|
1070
1068
|
}
|
|
1071
1069
|
}
|
|
1072
1070
|
|
|
1073
|
-
this._indicatorsGroup.offsetX(currentX -
|
|
1074
|
-
this._indicatorsGroup.offsetY(-
|
|
1071
|
+
this._indicatorsGroup.offsetX(currentX - this._peaks.options.sourceIndicatorsXOffset);
|
|
1072
|
+
this._indicatorsGroup.offsetY(-this._peaks.options.sourceIndicatorsYOffset);
|
|
1075
1073
|
};
|
|
1076
1074
|
|
|
1077
1075
|
SourceGroup.prototype._createMarkers = function() {
|
package/src/source.js
CHANGED
|
@@ -143,6 +143,13 @@ define([
|
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
if (Utils.isNullOrUndefined(options.warningWidth)) {
|
|
147
|
+
options.warningWidth = 10;
|
|
148
|
+
}
|
|
149
|
+
else if (!Utils.isNumber(options.warningWidth)) {
|
|
150
|
+
throw new TypeError('peaks.sources.' + context + ': warningWidth should be a number');
|
|
151
|
+
}
|
|
152
|
+
|
|
146
153
|
if (Utils.isNullOrUndefined(options.volumeSliderColor)) {
|
|
147
154
|
options.volumeSliderColor = '#000000';
|
|
148
155
|
}
|
|
@@ -389,10 +396,11 @@ define([
|
|
|
389
396
|
|
|
390
397
|
function Source(peaks, id, originId, elementId, title, titleAlignments, url, previewUrl, binaryUrl, kind,
|
|
391
398
|
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
392
|
-
borderColor, selectedColor, warningColor, volumeSliderColor, volumeSliderWidth,
|
|
393
|
-
textFont, textFontSize, textColor, textBackgroundColor, textPosition,
|
|
394
|
-
borderRadius, wrapped, position, draggable, orderable, resizable,
|
|
395
|
-
previewHeight, binaryHeight, indicators, markers, markerColor,
|
|
399
|
+
borderColor, selectedColor, warningColor, warningWidth, volumeSliderColor, volumeSliderWidth,
|
|
400
|
+
volumeSliderDraggingWidth, textFont, textFontSize, textColor, textBackgroundColor, textPosition,
|
|
401
|
+
textAutoScroll, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable,
|
|
402
|
+
cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor,
|
|
403
|
+
markerWidth, volume, volumeRange) {
|
|
396
404
|
var opts = {
|
|
397
405
|
title: title,
|
|
398
406
|
titleAlignments: titleAlignments,
|
|
@@ -411,6 +419,7 @@ define([
|
|
|
411
419
|
borderColor: borderColor,
|
|
412
420
|
selectedColor: selectedColor,
|
|
413
421
|
warningColor: warningColor,
|
|
422
|
+
warningWidth: warningWidth,
|
|
414
423
|
textFont: textFont,
|
|
415
424
|
textFontSize: textFontSize,
|
|
416
425
|
textColor: textColor,
|
|
@@ -463,6 +472,7 @@ define([
|
|
|
463
472
|
this._borderColor = opts.borderColor;
|
|
464
473
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
465
474
|
this._warningColor = opts.warningColor;
|
|
475
|
+
this._warningWidth = opts.warningWidth;
|
|
466
476
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
467
477
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
468
478
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
|
@@ -655,6 +665,16 @@ define([
|
|
|
655
665
|
this._warningColor = warningColor;
|
|
656
666
|
}
|
|
657
667
|
},
|
|
668
|
+
warningWidth: {
|
|
669
|
+
enumerable: true,
|
|
670
|
+
get: function() {
|
|
671
|
+
return this._warningWidth;
|
|
672
|
+
},
|
|
673
|
+
|
|
674
|
+
set: function(warningWidth) {
|
|
675
|
+
this._warningWidth = warningWidth;
|
|
676
|
+
}
|
|
677
|
+
},
|
|
658
678
|
volumeSliderColor: {
|
|
659
679
|
enumerable: true,
|
|
660
680
|
get: function() {
|
|
@@ -1031,6 +1051,7 @@ define([
|
|
|
1031
1051
|
borderColor: this.borderColor,
|
|
1032
1052
|
selectedColor: this.selectedColor,
|
|
1033
1053
|
warningColor: this.warningColor,
|
|
1054
|
+
warningWidth: this.warningWidth,
|
|
1034
1055
|
volumeSliderColor: this.volumeSliderColor,
|
|
1035
1056
|
volumeSliderWidth: this.volumeSliderWidth,
|
|
1036
1057
|
volumeSliderDraggingWidth: this.volumeSliderDraggingWidth,
|
|
@@ -1081,6 +1102,7 @@ define([
|
|
|
1081
1102
|
this._borderColor = opts.borderColor;
|
|
1082
1103
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
1083
1104
|
this._warningColor = opts.warningColor;
|
|
1105
|
+
this._warningWidth = opts.warningWidth;
|
|
1084
1106
|
this._volumeSliderColor = opts.volumeSliderColor;
|
|
1085
1107
|
this._volumeSliderWidth = opts.volumeSliderWidth;
|
|
1086
1108
|
this._volumeSliderDraggingWidth = opts.volumeSliderDraggingWidth;
|
package/src/timeline-sources.js
CHANGED
|
@@ -83,6 +83,7 @@ define([
|
|
|
83
83
|
borderColor: sourceToCut.borderColor,
|
|
84
84
|
selectedColor: sourceToCut.selectedColor,
|
|
85
85
|
warningColor: sourceToCut.warningColor,
|
|
86
|
+
warningWidth: sourceToCut.warningWidth,
|
|
86
87
|
volumeSliderColor: sourceToCut.volumeSliderColor,
|
|
87
88
|
volumeSliderWidth: sourceToCut.volumeSliderWidth,
|
|
88
89
|
volumeSliderDraggingWidth: sourceToCut.volumeSliderDraggingWidth,
|
|
@@ -175,6 +176,7 @@ define([
|
|
|
175
176
|
options.borderColor,
|
|
176
177
|
options.selectedColor,
|
|
177
178
|
options.warningColor,
|
|
179
|
+
options.warningWidth,
|
|
178
180
|
options.volumeSliderColor,
|
|
179
181
|
options.volumeSliderWidth,
|
|
180
182
|
options.volumeSliderDraggingWidth,
|