@checksub_team/peaks_timeline 1.5.3 → 1.5.5
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 +51 -5
- package/src/segment-marker.js +0 -2
- package/src/source-group.js +27 -8
- package/src/source.js +37 -2
- package/src/timeline-sources.js +4 -0
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -16238,7 +16238,7 @@ module.exports = function (Konva) {
|
|
|
16238
16238
|
if (this._startMarker) {
|
|
16239
16239
|
var newStartX;
|
|
16240
16240
|
if (this._segment.duration) {
|
|
16241
|
-
newStartX = Math.max(pos.x + this._view.getFrameOffset(), this._view.timeToPixels(this._segment.endTime - this._segment.duration)
|
|
16241
|
+
newStartX = Math.max(pos.x + this._view.getFrameOffset(), this._view.timeToPixels(this._segment.endTime - this._segment.duration));
|
|
16242
16242
|
} else {
|
|
16243
16243
|
newStartX = pos.x + this._view.getFrameOffset();
|
|
16244
16244
|
}
|
|
@@ -16246,7 +16246,7 @@ module.exports = function (Konva) {
|
|
|
16246
16246
|
} else {
|
|
16247
16247
|
var newEndX;
|
|
16248
16248
|
if (this._segment.duration) {
|
|
16249
|
-
newEndX = Math.min(pos.x + this._view.getFrameOffset() + this._marker.getHandleWidth(), this._view.timeToPixels(this._segment.startTime + this._segment.duration)
|
|
16249
|
+
newEndX = Math.min(pos.x + this._view.getFrameOffset() + this._marker.getHandleWidth(), this._view.timeToPixels(this._segment.startTime + this._segment.duration));
|
|
16250
16250
|
} else {
|
|
16251
16251
|
newEndX = pos.x + this._view.getFrameOffset() + this._marker.getHandleWidth();
|
|
16252
16252
|
}
|
|
@@ -17535,6 +17535,9 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17535
17535
|
this.unwrap();
|
|
17536
17536
|
this._height = this._unwrappedHeight;
|
|
17537
17537
|
}
|
|
17538
|
+
if (this._title) {
|
|
17539
|
+
this._title.y(this._getTitleY());
|
|
17540
|
+
}
|
|
17538
17541
|
this.setHandlesWrapping(wrap);
|
|
17539
17542
|
};
|
|
17540
17543
|
SourceGroup.prototype.setHandlesWrapping = function (wrap) {
|
|
@@ -17638,7 +17641,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17638
17641
|
}
|
|
17639
17642
|
};
|
|
17640
17643
|
SourceGroup.prototype.drawSourceShape = function (ctx, shape) {
|
|
17641
|
-
var radius = Math.max(1, Math.min(this._width / 2, Math.min(CORNER_RADIUS, this._height / 2)));
|
|
17644
|
+
var radius = this._source.borderRadius !== undefined && this._source.borderRadius !== null ? this._source.borderRadius : Math.max(1, Math.min(this._width / 2, Math.min(CORNER_RADIUS, this._height / 2)));
|
|
17642
17645
|
var x = Math.max(0, this._view.getFrameOffset() - this._x - radius);
|
|
17643
17646
|
var width = Math.min(this._width - x, this._view.getOriginalWidth() + radius - Math.max(0, this._x - this._view.getFrameOffset()));
|
|
17644
17647
|
var xWidth = x + width;
|
|
@@ -17760,6 +17763,16 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17760
17763
|
}
|
|
17761
17764
|
this._group.add(this._title);
|
|
17762
17765
|
};
|
|
17766
|
+
SourceGroup.prototype._getTitleY = function () {
|
|
17767
|
+
if (!this._title) {
|
|
17768
|
+
return 0;
|
|
17769
|
+
}
|
|
17770
|
+
if (this._source.textPosition === 'bottom') {
|
|
17771
|
+
return Math.max(this._height - this._title.getClientRect().height - 5, 5);
|
|
17772
|
+
} else {
|
|
17773
|
+
return 5;
|
|
17774
|
+
}
|
|
17775
|
+
};
|
|
17763
17776
|
SourceGroup.prototype._createTitle = function () {
|
|
17764
17777
|
var title = new Konva.Text({
|
|
17765
17778
|
x: 5,
|
|
@@ -18217,6 +18230,11 @@ module.exports = function (Utils) {
|
|
|
18217
18230
|
} else if (!Utils.isValidColor(options.textColor)) {
|
|
18218
18231
|
throw new TypeError('peaks.sources.' + context + ': textColor should be a valid CSS color');
|
|
18219
18232
|
}
|
|
18233
|
+
if (Utils.isNullOrUndefined(options.textPosition)) {
|
|
18234
|
+
options.textPosition = 'bottom';
|
|
18235
|
+
} else if (!Utils.isString(options.textPosition)) {
|
|
18236
|
+
throw new TypeError('peaks.sources.' + context + ': textPosition must be a string');
|
|
18237
|
+
}
|
|
18220
18238
|
if (Utils.isNullOrUndefined(options.borderWidth)) {
|
|
18221
18239
|
options.borderWidth = 0;
|
|
18222
18240
|
}
|
|
@@ -18269,7 +18287,7 @@ module.exports = function (Utils) {
|
|
|
18269
18287
|
options.wrapped = false;
|
|
18270
18288
|
}
|
|
18271
18289
|
}
|
|
18272
|
-
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) {
|
|
18290
|
+
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor, selectedColor, textColor, textPosition, borderWidth, borderRadius, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
|
|
18273
18291
|
var opts = {
|
|
18274
18292
|
title: title,
|
|
18275
18293
|
url: url,
|
|
@@ -18287,7 +18305,9 @@ module.exports = function (Utils) {
|
|
|
18287
18305
|
borderColor: borderColor,
|
|
18288
18306
|
selectedColor: selectedColor,
|
|
18289
18307
|
textColor: textColor,
|
|
18308
|
+
textPosition: textPosition,
|
|
18290
18309
|
borderWidth: borderWidth,
|
|
18310
|
+
borderRadius: borderRadius,
|
|
18291
18311
|
wrapped: wrapped,
|
|
18292
18312
|
position: position,
|
|
18293
18313
|
draggable: draggable,
|
|
@@ -18317,7 +18337,9 @@ module.exports = function (Utils) {
|
|
|
18317
18337
|
this._borderColor = opts.borderColor;
|
|
18318
18338
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
18319
18339
|
this._textColor = opts.textColor;
|
|
18340
|
+
this._textPosition = opts.textPosition;
|
|
18320
18341
|
this._borderWidth = opts.borderWidth;
|
|
18342
|
+
this._borderRadius = opts.borderRadius;
|
|
18321
18343
|
this._wrapped = opts.wrapped;
|
|
18322
18344
|
this._position = opts.position;
|
|
18323
18345
|
this._draggable = opts.draggable;
|
|
@@ -18472,6 +18494,15 @@ module.exports = function (Utils) {
|
|
|
18472
18494
|
this._textColor = textColor;
|
|
18473
18495
|
}
|
|
18474
18496
|
},
|
|
18497
|
+
textPosition: {
|
|
18498
|
+
enumerable: true,
|
|
18499
|
+
get: function () {
|
|
18500
|
+
return this._textPosition;
|
|
18501
|
+
},
|
|
18502
|
+
set: function (textPosition) {
|
|
18503
|
+
this._textPosition = textPosition;
|
|
18504
|
+
}
|
|
18505
|
+
},
|
|
18475
18506
|
borderWidth: {
|
|
18476
18507
|
enumerable: true,
|
|
18477
18508
|
get: function () {
|
|
@@ -18481,6 +18512,15 @@ module.exports = function (Utils) {
|
|
|
18481
18512
|
this._borderWidth = borderWidth;
|
|
18482
18513
|
}
|
|
18483
18514
|
},
|
|
18515
|
+
borderRadius: {
|
|
18516
|
+
enumerable: true,
|
|
18517
|
+
get: function () {
|
|
18518
|
+
return this._borderRadius;
|
|
18519
|
+
},
|
|
18520
|
+
set: function (borderRadius) {
|
|
18521
|
+
this._borderRadius = borderRadius;
|
|
18522
|
+
}
|
|
18523
|
+
},
|
|
18484
18524
|
wrapped: {
|
|
18485
18525
|
enumerable: true,
|
|
18486
18526
|
get: function () {
|
|
@@ -18653,7 +18693,9 @@ module.exports = function (Utils) {
|
|
|
18653
18693
|
borderColor: this.borderColor,
|
|
18654
18694
|
selectedColor: this.selectedColor,
|
|
18655
18695
|
textColor: this.textColor,
|
|
18696
|
+
textPosition: this.textPosition,
|
|
18656
18697
|
borderWidth: this.borderWidth,
|
|
18698
|
+
borderRadius: this.borderRadius,
|
|
18657
18699
|
wrapped: this.wrapped,
|
|
18658
18700
|
position: this.position,
|
|
18659
18701
|
draggable: this.draggable,
|
|
@@ -18680,7 +18722,9 @@ module.exports = function (Utils) {
|
|
|
18680
18722
|
this._borderColor = opts.borderColor;
|
|
18681
18723
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
18682
18724
|
this._textColor = opts.textColor;
|
|
18725
|
+
this._textPosition = opts.textPosition;
|
|
18683
18726
|
this._borderWidth = opts.borderWidth;
|
|
18727
|
+
this._borderRadius = opts.borderRadius;
|
|
18684
18728
|
this._wrapped = opts.wrapped;
|
|
18685
18729
|
this._position = opts.position;
|
|
18686
18730
|
this._draggable = opts.draggable;
|
|
@@ -19390,7 +19434,9 @@ module.exports = function (Source, Utils) {
|
|
|
19390
19434
|
borderColor: sourceToCut.borderColor,
|
|
19391
19435
|
selectedColor: sourceToCut.selectedColor,
|
|
19392
19436
|
textColor: sourceToCut.textColor,
|
|
19437
|
+
textPosition: sourceToCut.textPosition,
|
|
19393
19438
|
borderWidth: sourceToCut.borderWidth,
|
|
19439
|
+
borderRadius: sourceToCut.borderRadius,
|
|
19394
19440
|
wrapped: sourceToCut.wrapped,
|
|
19395
19441
|
position: sourceToCut.position,
|
|
19396
19442
|
draggable: sourceToCut.draggable,
|
|
@@ -19412,7 +19458,7 @@ module.exports = function (Source, Utils) {
|
|
|
19412
19458
|
if (!Utils.isObject(options)) {
|
|
19413
19459
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
19414
19460
|
}
|
|
19415
|
-
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);
|
|
19461
|
+
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.textPosition, options.borderWidth, options.borderRadius, options.wrapped, options.position, options.draggable, options.resizable, options.wrapping, options.previewHeight, options.binaryHeight);
|
|
19416
19462
|
return source;
|
|
19417
19463
|
};
|
|
19418
19464
|
TimelineSources.prototype.getSources = function () {
|
package/src/segment-marker.js
CHANGED
|
@@ -92,7 +92,6 @@ define([
|
|
|
92
92
|
newStartX = Math.max(
|
|
93
93
|
pos.x + this._view.getFrameOffset(),
|
|
94
94
|
this._view.timeToPixels(this._segment.endTime - this._segment.duration)
|
|
95
|
-
+ this._view.getFrameOffset()
|
|
96
95
|
);
|
|
97
96
|
}
|
|
98
97
|
else {
|
|
@@ -112,7 +111,6 @@ define([
|
|
|
112
111
|
newEndX = Math.min(
|
|
113
112
|
pos.x + this._view.getFrameOffset() + this._marker.getHandleWidth(),
|
|
114
113
|
this._view.timeToPixels(this._segment.startTime + this._segment.duration)
|
|
115
|
-
+ this._view.getFrameOffset()
|
|
116
114
|
);
|
|
117
115
|
}
|
|
118
116
|
else {
|
package/src/source-group.js
CHANGED
|
@@ -220,6 +220,10 @@ define([
|
|
|
220
220
|
this._height = this._unwrappedHeight;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
if (this._title) {
|
|
224
|
+
this._title.y(this._getTitleY());
|
|
225
|
+
}
|
|
226
|
+
|
|
223
227
|
this.setHandlesWrapping(wrap);
|
|
224
228
|
};
|
|
225
229
|
|
|
@@ -343,16 +347,18 @@ define([
|
|
|
343
347
|
};
|
|
344
348
|
|
|
345
349
|
SourceGroup.prototype.drawSourceShape = function(ctx, shape) {
|
|
346
|
-
var radius =
|
|
347
|
-
|
|
348
|
-
Math.
|
|
349
|
-
|
|
350
|
+
var radius = this._source.borderRadius !== undefined && this._source.borderRadius !== null ?
|
|
351
|
+
this._source.borderRadius :
|
|
352
|
+
Math.max(
|
|
353
|
+
1,
|
|
350
354
|
Math.min(
|
|
351
|
-
|
|
352
|
-
|
|
355
|
+
this._width / 2,
|
|
356
|
+
Math.min(
|
|
357
|
+
CORNER_RADIUS,
|
|
358
|
+
this._height / 2
|
|
359
|
+
)
|
|
353
360
|
)
|
|
354
|
-
)
|
|
355
|
-
);
|
|
361
|
+
);
|
|
356
362
|
var x = Math.max(
|
|
357
363
|
0,
|
|
358
364
|
this._view.getFrameOffset() - this._x - radius
|
|
@@ -506,6 +512,19 @@ define([
|
|
|
506
512
|
this._group.add(this._title);
|
|
507
513
|
};
|
|
508
514
|
|
|
515
|
+
SourceGroup.prototype._getTitleY = function() {
|
|
516
|
+
if (!this._title) {
|
|
517
|
+
return 0;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (this._source.textPosition === 'bottom') {
|
|
521
|
+
return Math.max(this._height - this._title.getClientRect().height - 5, 5);
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
return 5;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
|
|
509
528
|
SourceGroup.prototype._createTitle = function() {
|
|
510
529
|
var title = new Konva.Text({
|
|
511
530
|
x: 5,
|
package/src/source.js
CHANGED
|
@@ -134,6 +134,13 @@ define([
|
|
|
134
134
|
throw new TypeError('peaks.sources.' + context + ': textColor should be a valid CSS color');
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
if (Utils.isNullOrUndefined(options.textPosition)) {
|
|
138
|
+
options.textPosition = 'bottom';
|
|
139
|
+
}
|
|
140
|
+
else if (!Utils.isString(options.textPosition)) {
|
|
141
|
+
throw new TypeError('peaks.sources.' + context + ': textPosition must be a string');
|
|
142
|
+
}
|
|
143
|
+
|
|
137
144
|
if (Utils.isNullOrUndefined(options.borderWidth)) {
|
|
138
145
|
options.borderWidth = 0;
|
|
139
146
|
}
|
|
@@ -227,8 +234,8 @@ define([
|
|
|
227
234
|
|
|
228
235
|
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind,
|
|
229
236
|
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
230
|
-
borderColor, selectedColor, textColor,
|
|
231
|
-
wrapping, previewHeight, binaryHeight) {
|
|
237
|
+
borderColor, selectedColor, textColor, textPosition, borderWidth, borderRadius, wrapped,
|
|
238
|
+
position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
|
|
232
239
|
var opts = {
|
|
233
240
|
title: title,
|
|
234
241
|
url: url,
|
|
@@ -246,7 +253,9 @@ define([
|
|
|
246
253
|
borderColor: borderColor,
|
|
247
254
|
selectedColor: selectedColor,
|
|
248
255
|
textColor: textColor,
|
|
256
|
+
textPosition: textPosition,
|
|
249
257
|
borderWidth: borderWidth,
|
|
258
|
+
borderRadius: borderRadius,
|
|
250
259
|
wrapped: wrapped,
|
|
251
260
|
position: position,
|
|
252
261
|
draggable: draggable,
|
|
@@ -278,7 +287,9 @@ define([
|
|
|
278
287
|
this._borderColor = opts.borderColor;
|
|
279
288
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
280
289
|
this._textColor = opts.textColor;
|
|
290
|
+
this._textPosition = opts.textPosition;
|
|
281
291
|
this._borderWidth = opts.borderWidth;
|
|
292
|
+
this._borderRadius = opts.borderRadius;
|
|
282
293
|
this._wrapped = opts.wrapped;
|
|
283
294
|
this._position = opts.position;
|
|
284
295
|
this._draggable = opts.draggable;
|
|
@@ -444,6 +455,16 @@ define([
|
|
|
444
455
|
this._textColor = textColor;
|
|
445
456
|
}
|
|
446
457
|
},
|
|
458
|
+
textPosition: {
|
|
459
|
+
enumerable: true,
|
|
460
|
+
get: function() {
|
|
461
|
+
return this._textPosition;
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
set: function(textPosition) {
|
|
465
|
+
this._textPosition = textPosition;
|
|
466
|
+
}
|
|
467
|
+
},
|
|
447
468
|
borderWidth: {
|
|
448
469
|
enumerable: true,
|
|
449
470
|
get: function() {
|
|
@@ -454,6 +475,16 @@ define([
|
|
|
454
475
|
this._borderWidth = borderWidth;
|
|
455
476
|
}
|
|
456
477
|
},
|
|
478
|
+
borderRadius: {
|
|
479
|
+
enumerable: true,
|
|
480
|
+
get: function() {
|
|
481
|
+
return this._borderRadius;
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
set: function(borderRadius) {
|
|
485
|
+
this._borderRadius = borderRadius;
|
|
486
|
+
}
|
|
487
|
+
},
|
|
457
488
|
wrapped: {
|
|
458
489
|
enumerable: true,
|
|
459
490
|
get: function() {
|
|
@@ -663,7 +694,9 @@ define([
|
|
|
663
694
|
borderColor: this.borderColor,
|
|
664
695
|
selectedColor: this.selectedColor,
|
|
665
696
|
textColor: this.textColor,
|
|
697
|
+
textPosition: this.textPosition,
|
|
666
698
|
borderWidth: this.borderWidth,
|
|
699
|
+
borderRadius: this.borderRadius,
|
|
667
700
|
wrapped: this.wrapped,
|
|
668
701
|
position: this.position,
|
|
669
702
|
draggable: this.draggable,
|
|
@@ -693,7 +726,9 @@ define([
|
|
|
693
726
|
this._borderColor = opts.borderColor;
|
|
694
727
|
this._selectedColor = opts.selectedColor || Utils.shadeColor(opts.backgroundColor, 30);
|
|
695
728
|
this._textColor = opts.textColor;
|
|
729
|
+
this._textPosition = opts.textPosition;
|
|
696
730
|
this._borderWidth = opts.borderWidth;
|
|
731
|
+
this._borderRadius = opts.borderRadius;
|
|
697
732
|
this._wrapped = opts.wrapped;
|
|
698
733
|
this._position = opts.position;
|
|
699
734
|
this._draggable = opts.draggable;
|
package/src/timeline-sources.js
CHANGED
|
@@ -82,7 +82,9 @@ define([
|
|
|
82
82
|
borderColor: sourceToCut.borderColor,
|
|
83
83
|
selectedColor: sourceToCut.selectedColor,
|
|
84
84
|
textColor: sourceToCut.textColor,
|
|
85
|
+
textPosition: sourceToCut.textPosition,
|
|
85
86
|
borderWidth: sourceToCut.borderWidth,
|
|
87
|
+
borderRadius: sourceToCut.borderRadius,
|
|
86
88
|
wrapped: sourceToCut.wrapped,
|
|
87
89
|
position: sourceToCut.position,
|
|
88
90
|
draggable: sourceToCut.draggable,
|
|
@@ -156,7 +158,9 @@ define([
|
|
|
156
158
|
options.borderColor,
|
|
157
159
|
options.selectedColor,
|
|
158
160
|
options.textColor,
|
|
161
|
+
options.textPosition,
|
|
159
162
|
options.borderWidth,
|
|
163
|
+
options.borderRadius,
|
|
160
164
|
options.wrapped,
|
|
161
165
|
options.position,
|
|
162
166
|
options.draggable,
|