@checksub_team/peaks_timeline 1.4.52 → 1.4.53
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 +25 -12
- package/src/source-group.js +2 -3
- package/src/source.js +26 -6
- package/src/timeline-sources.js +2 -0
- package/src/waveform-shape.js +1 -5
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -17675,7 +17675,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17675
17675
|
});
|
|
17676
17676
|
var self = this;
|
|
17677
17677
|
var background = new Konva.Shape({
|
|
17678
|
-
fill: this._source.
|
|
17678
|
+
fill: this._source.backgroundColor,
|
|
17679
17679
|
stroke: this._source.borderColor,
|
|
17680
17680
|
strokeWidth: this._source.borderWidth,
|
|
17681
17681
|
sceneFunc: function (ctx, shape) {
|
|
@@ -17727,7 +17727,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17727
17727
|
});
|
|
17728
17728
|
var self = this;
|
|
17729
17729
|
var background = new Konva.Shape({
|
|
17730
|
-
fill: this._source.
|
|
17730
|
+
fill: this._source.backgroundColor,
|
|
17731
17731
|
stroke: this._source.borderColor,
|
|
17732
17732
|
strokeWidth: this._source.borderWidth,
|
|
17733
17733
|
sceneFunc: function (ctx, shape) {
|
|
@@ -17957,7 +17957,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17957
17957
|
var waveform = new WaveformShape({
|
|
17958
17958
|
layer: this._layer,
|
|
17959
17959
|
view: this._view,
|
|
17960
|
-
color: this._peaks.options.zoomWaveformColor,
|
|
17961
17960
|
source: this._source,
|
|
17962
17961
|
height: preview.group.height(),
|
|
17963
17962
|
url: preview.url
|
|
@@ -18204,7 +18203,10 @@ module.exports = function (Utils) {
|
|
|
18204
18203
|
throw new TypeError('peaks.sources.' + context + ': binaryUrl must be a string');
|
|
18205
18204
|
}
|
|
18206
18205
|
if (!Utils.isValidColor(options.color)) {
|
|
18207
|
-
|
|
18206
|
+
options.color = peaks.options.zoomWaveformColor;
|
|
18207
|
+
}
|
|
18208
|
+
if (!Utils.isValidColor(options.backgroundColor)) {
|
|
18209
|
+
throw new TypeError('peaks.sources.' + context + ': backgroundColor should be a valid CSS color');
|
|
18208
18210
|
}
|
|
18209
18211
|
if (!Utils.isValidColor(options.borderColor)) {
|
|
18210
18212
|
options.borderColor = options.color;
|
|
@@ -18271,7 +18273,7 @@ module.exports = function (Utils) {
|
|
|
18271
18273
|
options.wrapped = false;
|
|
18272
18274
|
}
|
|
18273
18275
|
}
|
|
18274
|
-
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
|
|
18276
|
+
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
|
|
18275
18277
|
var opts = {
|
|
18276
18278
|
title: title,
|
|
18277
18279
|
url: url,
|
|
@@ -18285,6 +18287,7 @@ module.exports = function (Utils) {
|
|
|
18285
18287
|
mediaStartTime: mediaStartTime,
|
|
18286
18288
|
mediaEndTime: mediaEndTime,
|
|
18287
18289
|
color: color,
|
|
18290
|
+
backgroundColor: backgroundColor,
|
|
18288
18291
|
borderColor: borderColor,
|
|
18289
18292
|
selectedColor: selectedColor,
|
|
18290
18293
|
textColor: textColor,
|
|
@@ -18314,8 +18317,9 @@ module.exports = function (Utils) {
|
|
|
18314
18317
|
this._mediaStartTime = opts.mediaStartTime;
|
|
18315
18318
|
this._mediaEndTime = opts.mediaEndTime;
|
|
18316
18319
|
this._color = opts.color;
|
|
18320
|
+
this._backgroundColor = opts.backgroundColor;
|
|
18317
18321
|
this._borderColor = opts.borderColor;
|
|
18318
|
-
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.
|
|
18322
|
+
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
18319
18323
|
this._textColor = opts.textColor;
|
|
18320
18324
|
this._borderWidth = opts.borderWidth;
|
|
18321
18325
|
this._wrapped = opts.wrapped;
|
|
@@ -18436,6 +18440,15 @@ module.exports = function (Utils) {
|
|
|
18436
18440
|
this._color = color;
|
|
18437
18441
|
}
|
|
18438
18442
|
},
|
|
18443
|
+
backgroundColor: {
|
|
18444
|
+
enumerable: true,
|
|
18445
|
+
get: function () {
|
|
18446
|
+
return this._backgroundColor;
|
|
18447
|
+
},
|
|
18448
|
+
set: function (backgroundColor) {
|
|
18449
|
+
this._backgroundColor = backgroundColor;
|
|
18450
|
+
}
|
|
18451
|
+
},
|
|
18439
18452
|
borderColor: {
|
|
18440
18453
|
enumerable: true,
|
|
18441
18454
|
get: function () {
|
|
@@ -18640,6 +18653,7 @@ module.exports = function (Utils) {
|
|
|
18640
18653
|
mediaStartTime: this.mediaStartTime,
|
|
18641
18654
|
mediaEndTime: this.mediaEndTime,
|
|
18642
18655
|
color: this.color,
|
|
18656
|
+
backgroundColor: this.backgroundColor,
|
|
18643
18657
|
borderColor: this.borderColor,
|
|
18644
18658
|
selectedColor: this.selectedColor,
|
|
18645
18659
|
textColor: this.textColor,
|
|
@@ -18666,8 +18680,9 @@ module.exports = function (Utils) {
|
|
|
18666
18680
|
this._mediaStartTime = opts.mediaStartTime;
|
|
18667
18681
|
this._mediaEndTime = opts.mediaEndTime;
|
|
18668
18682
|
this._color = opts.color;
|
|
18683
|
+
this._backgroundColor = opts.backgroundColor;
|
|
18669
18684
|
this._borderColor = opts.borderColor;
|
|
18670
|
-
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.
|
|
18685
|
+
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
18671
18686
|
this._textColor = opts.textColor;
|
|
18672
18687
|
this._borderWidth = opts.borderWidth;
|
|
18673
18688
|
this._wrapped = opts.wrapped;
|
|
@@ -19363,6 +19378,7 @@ module.exports = function (Source, Utils) {
|
|
|
19363
19378
|
mediaStartTime: sourceToCut.mediaEndTime,
|
|
19364
19379
|
mediaEndTime: originalMediaEndTime,
|
|
19365
19380
|
color: sourceToCut.color,
|
|
19381
|
+
backgroundColor: sourceToCut.backgroundColor,
|
|
19366
19382
|
borderColor: sourceToCut.borderColor,
|
|
19367
19383
|
selectedColor: sourceToCut.selectedColor,
|
|
19368
19384
|
textColor: sourceToCut.textColor,
|
|
@@ -19388,7 +19404,7 @@ module.exports = function (Source, Utils) {
|
|
|
19388
19404
|
if (!Utils.isObject(options)) {
|
|
19389
19405
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
19390
19406
|
}
|
|
19391
|
-
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.borderColor, options.selectedColor, options.textColor, options.borderWidth, options.wrapped, options.position, options.draggable, options.resizable, options.wrapping, options.previewHeight, options.binaryHeight);
|
|
19407
|
+
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.textColor, options.borderWidth, options.wrapped, options.position, options.draggable, options.resizable, options.wrapping, options.previewHeight, options.binaryHeight);
|
|
19392
19408
|
return source;
|
|
19393
19409
|
};
|
|
19394
19410
|
TimelineSources.prototype.getSources = function () {
|
|
@@ -20424,7 +20440,7 @@ module.exports = function (Utils, Konva) {
|
|
|
20424
20440
|
return height - Utils.clamp(height - scaledAmplitude, 0, height);
|
|
20425
20441
|
}
|
|
20426
20442
|
function WaveformShape(options) {
|
|
20427
|
-
Konva.Shape.call(this, { fill: options.color });
|
|
20443
|
+
Konva.Shape.call(this, { fill: options.source.color });
|
|
20428
20444
|
this._layer = options.layer;
|
|
20429
20445
|
this._view = options.view;
|
|
20430
20446
|
this._source = options.source;
|
|
@@ -20434,9 +20450,6 @@ module.exports = function (Utils, Konva) {
|
|
|
20434
20450
|
this.hitFunc(this._waveformShapeHitFunc);
|
|
20435
20451
|
}
|
|
20436
20452
|
WaveformShape.prototype = Object.create(Konva.Shape.prototype);
|
|
20437
|
-
WaveformShape.prototype.setWaveformColor = function (color) {
|
|
20438
|
-
this.fill(color);
|
|
20439
|
-
};
|
|
20440
20453
|
WaveformShape.prototype._sceneFunc = function (context) {
|
|
20441
20454
|
var width = this._view.getWidth();
|
|
20442
20455
|
var waveformData = this._layer.getLoadedData(this._url).data;
|
package/src/source-group.js
CHANGED
|
@@ -399,7 +399,7 @@ define([
|
|
|
399
399
|
var self = this;
|
|
400
400
|
|
|
401
401
|
var background = new Konva.Shape({
|
|
402
|
-
fill: this._source.
|
|
402
|
+
fill: this._source.backgroundColor,
|
|
403
403
|
stroke: this._source.borderColor,
|
|
404
404
|
strokeWidth: this._source.borderWidth,
|
|
405
405
|
sceneFunc: function(ctx, shape) {
|
|
@@ -461,7 +461,7 @@ define([
|
|
|
461
461
|
var self = this;
|
|
462
462
|
|
|
463
463
|
var background = new Konva.Shape({
|
|
464
|
-
fill: this._source.
|
|
464
|
+
fill: this._source.backgroundColor,
|
|
465
465
|
stroke: this._source.borderColor,
|
|
466
466
|
strokeWidth: this._source.borderWidth,
|
|
467
467
|
sceneFunc: function(ctx, shape) {
|
|
@@ -757,7 +757,6 @@ define([
|
|
|
757
757
|
var waveform = new WaveformShape({
|
|
758
758
|
layer: this._layer,
|
|
759
759
|
view: this._view,
|
|
760
|
-
color: this._peaks.options.zoomWaveformColor,
|
|
761
760
|
source: this._source,
|
|
762
761
|
height: preview.group.height(),
|
|
763
762
|
url: preview.url
|
package/src/source.js
CHANGED
|
@@ -105,7 +105,13 @@ define([
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
if (!Utils.isValidColor(options.color)) {
|
|
108
|
-
|
|
108
|
+
options.color = peaks.options.zoomWaveformColor;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!Utils.isValidColor(options.backgroundColor)) {
|
|
112
|
+
throw new TypeError(
|
|
113
|
+
'peaks.sources.' + context + ': backgroundColor should be a valid CSS color'
|
|
114
|
+
);
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
if (!Utils.isValidColor(options.borderColor)) {
|
|
@@ -220,9 +226,9 @@ define([
|
|
|
220
226
|
*/
|
|
221
227
|
|
|
222
228
|
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind,
|
|
223
|
-
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color,
|
|
224
|
-
selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable,
|
|
225
|
-
previewHeight, binaryHeight) {
|
|
229
|
+
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
230
|
+
borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable,
|
|
231
|
+
wrapping, previewHeight, binaryHeight) {
|
|
226
232
|
var opts = {
|
|
227
233
|
title: title,
|
|
228
234
|
url: url,
|
|
@@ -236,6 +242,7 @@ define([
|
|
|
236
242
|
mediaStartTime: mediaStartTime,
|
|
237
243
|
mediaEndTime: mediaEndTime,
|
|
238
244
|
color: color,
|
|
245
|
+
backgroundColor: backgroundColor,
|
|
239
246
|
borderColor: borderColor,
|
|
240
247
|
selectedColor: selectedColor,
|
|
241
248
|
textColor: textColor,
|
|
@@ -267,8 +274,9 @@ define([
|
|
|
267
274
|
this._mediaStartTime = opts.mediaStartTime;
|
|
268
275
|
this._mediaEndTime = opts.mediaEndTime;
|
|
269
276
|
this._color = opts.color;
|
|
277
|
+
this._backgroundColor = opts.backgroundColor;
|
|
270
278
|
this._borderColor = opts.borderColor;
|
|
271
|
-
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.
|
|
279
|
+
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
272
280
|
this._textColor = opts.textColor;
|
|
273
281
|
this._borderWidth = opts.borderWidth;
|
|
274
282
|
this._wrapped = opts.wrapped;
|
|
@@ -396,6 +404,16 @@ define([
|
|
|
396
404
|
this._color = color;
|
|
397
405
|
}
|
|
398
406
|
},
|
|
407
|
+
backgroundColor: {
|
|
408
|
+
enumerable: true,
|
|
409
|
+
get: function() {
|
|
410
|
+
return this._backgroundColor;
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
set: function(backgroundColor) {
|
|
414
|
+
this._backgroundColor = backgroundColor;
|
|
415
|
+
}
|
|
416
|
+
},
|
|
399
417
|
borderColor: {
|
|
400
418
|
enumerable: true,
|
|
401
419
|
get: function() {
|
|
@@ -641,6 +659,7 @@ define([
|
|
|
641
659
|
mediaStartTime: this.mediaStartTime,
|
|
642
660
|
mediaEndTime: this.mediaEndTime,
|
|
643
661
|
color: this.color,
|
|
662
|
+
backgroundColor: this.backgroundColor,
|
|
644
663
|
borderColor: this.borderColor,
|
|
645
664
|
selectedColor: this.selectedColor,
|
|
646
665
|
textColor: this.textColor,
|
|
@@ -670,8 +689,9 @@ define([
|
|
|
670
689
|
this._mediaStartTime = opts.mediaStartTime;
|
|
671
690
|
this._mediaEndTime = opts.mediaEndTime;
|
|
672
691
|
this._color = opts.color;
|
|
692
|
+
this._backgroundColor = opts.backgroundColor;
|
|
673
693
|
this._borderColor = opts.borderColor;
|
|
674
|
-
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.
|
|
694
|
+
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
675
695
|
this._textColor = opts.textColor;
|
|
676
696
|
this._borderWidth = opts.borderWidth;
|
|
677
697
|
this._wrapped = opts.wrapped;
|
package/src/timeline-sources.js
CHANGED
|
@@ -78,6 +78,7 @@ define([
|
|
|
78
78
|
mediaStartTime: sourceToCut.mediaEndTime,
|
|
79
79
|
mediaEndTime: originalMediaEndTime,
|
|
80
80
|
color: sourceToCut.color,
|
|
81
|
+
backgroundColor: sourceToCut.backgroundColor,
|
|
81
82
|
borderColor: sourceToCut.borderColor,
|
|
82
83
|
selectedColor: sourceToCut.selectedColor,
|
|
83
84
|
textColor: sourceToCut.textColor,
|
|
@@ -151,6 +152,7 @@ define([
|
|
|
151
152
|
options.mediaStartTime,
|
|
152
153
|
options.mediaEndTime,
|
|
153
154
|
options.color,
|
|
155
|
+
options.backgroundColor,
|
|
154
156
|
options.borderColor,
|
|
155
157
|
options.selectedColor,
|
|
156
158
|
options.textColor,
|
package/src/waveform-shape.js
CHANGED
|
@@ -51,7 +51,7 @@ define(['./utils', 'konva'], function(Utils, Konva) {
|
|
|
51
51
|
|
|
52
52
|
function WaveformShape(options) {
|
|
53
53
|
Konva.Shape.call(this, {
|
|
54
|
-
fill: options.color
|
|
54
|
+
fill: options.source.color
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
this._layer = options.layer;
|
|
@@ -67,10 +67,6 @@ define(['./utils', 'konva'], function(Utils, Konva) {
|
|
|
67
67
|
|
|
68
68
|
WaveformShape.prototype = Object.create(Konva.Shape.prototype);
|
|
69
69
|
|
|
70
|
-
WaveformShape.prototype.setWaveformColor = function(color) {
|
|
71
|
-
this.fill(color);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
70
|
WaveformShape.prototype._sceneFunc = function(context) {
|
|
75
71
|
var width = this._view.getWidth();
|
|
76
72
|
var waveformData = this._layer.getLoadedData(this._url).data;
|