@checksub_team/peaks_timeline 1.9.6 → 1.10.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 +68 -5
- package/src/source-group.js +24 -0
- package/src/source.js +47 -3
- package/src/timeline-sources.js +8 -2
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -17677,6 +17677,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17677
17677
|
this._wrappedHeight = this._peaks.options.wrappedLineHeight;
|
|
17678
17678
|
this._borderWidth = this._source.borderWidth;
|
|
17679
17679
|
this._previewList = [];
|
|
17680
|
+
this._markersGroup = this._createMarkers();
|
|
17680
17681
|
this._group = new Konva.Group({
|
|
17681
17682
|
x: this._x,
|
|
17682
17683
|
sourceId: this._source.id,
|
|
@@ -17897,6 +17898,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17897
17898
|
}
|
|
17898
17899
|
}));
|
|
17899
17900
|
unwrap.add(background);
|
|
17901
|
+
unwrap.add(this._markersGroup);
|
|
17900
17902
|
unwrap.add(this._createTitle(false));
|
|
17901
17903
|
return unwrap;
|
|
17902
17904
|
};
|
|
@@ -17943,6 +17945,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17943
17945
|
}
|
|
17944
17946
|
}));
|
|
17945
17947
|
wrap.add(background);
|
|
17948
|
+
wrap.add(this._markersGroup);
|
|
17946
17949
|
wrap.add(this._createTitle(true));
|
|
17947
17950
|
return wrap;
|
|
17948
17951
|
};
|
|
@@ -18370,6 +18373,24 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18370
18373
|
this._indicatorsGroup.offsetX(currentX - INDICATORS_MARGIN_LEFT);
|
|
18371
18374
|
this._indicatorsGroup.offsetY(-INDICATORS_MARGIN_TOP);
|
|
18372
18375
|
};
|
|
18376
|
+
SourceGroup.prototype._createMarkers = function () {
|
|
18377
|
+
const markersGroup = new Konva.Group({ listening: false });
|
|
18378
|
+
this._source.markers.forEach(function (marker) {
|
|
18379
|
+
const markerX = this._view.timeToPixels(marker);
|
|
18380
|
+
var markerLine = new Konva.Line({
|
|
18381
|
+
points: [
|
|
18382
|
+
markerX,
|
|
18383
|
+
0,
|
|
18384
|
+
markerX,
|
|
18385
|
+
this._unwrappedHeight
|
|
18386
|
+
],
|
|
18387
|
+
stroke: this._source.markerColor,
|
|
18388
|
+
strokeWidth: this._source.markerWidth
|
|
18389
|
+
});
|
|
18390
|
+
markersGroup.add(markerLine);
|
|
18391
|
+
}.bind(this));
|
|
18392
|
+
return markersGroup;
|
|
18393
|
+
};
|
|
18373
18394
|
return SourceGroup;
|
|
18374
18395
|
}(_dereq_('./waveform-builder'), _dereq_('./waveform-shape'), _dereq_('./utils'), _dereq_('konva'));
|
|
18375
18396
|
},{"./utils":112,"./waveform-builder":113,"./waveform-shape":114,"konva":43}],105:[function(_dereq_,module,exports){
|
|
@@ -18543,8 +18564,17 @@ module.exports = function (Utils) {
|
|
|
18543
18564
|
if (Utils.isNullOrUndefined(options.indicators)) {
|
|
18544
18565
|
options.indicators = [];
|
|
18545
18566
|
}
|
|
18567
|
+
if (Utils.isNullOrUndefined(options.markers)) {
|
|
18568
|
+
options.markers = [];
|
|
18569
|
+
}
|
|
18570
|
+
if (Utils.isNullOrUndefined(options.markerColor) || !Utils.isValidColor(options.markerColor)) {
|
|
18571
|
+
options.markerColor = options.color;
|
|
18572
|
+
}
|
|
18573
|
+
if (Utils.isNullOrUndefined(options.markerWidth)) {
|
|
18574
|
+
options.markerWidth = 2;
|
|
18575
|
+
}
|
|
18546
18576
|
}
|
|
18547
|
-
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor, selectedColor, textFont, textFontSize, textColor, textBackgroundColor, textPosition, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators) {
|
|
18577
|
+
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor, borderColor, selectedColor, textFont, textFontSize, textColor, textBackgroundColor, textPosition, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor, markerWidth) {
|
|
18548
18578
|
var opts = {
|
|
18549
18579
|
title: title,
|
|
18550
18580
|
url: url,
|
|
@@ -18578,7 +18608,10 @@ module.exports = function (Utils) {
|
|
|
18578
18608
|
wrapping: wrapping,
|
|
18579
18609
|
previewHeight: previewHeight,
|
|
18580
18610
|
binaryHeight: binaryHeight,
|
|
18581
|
-
indicators: indicators
|
|
18611
|
+
indicators: indicators,
|
|
18612
|
+
markers: markers,
|
|
18613
|
+
markerColor: markerColor,
|
|
18614
|
+
markerWidth: markerWidth
|
|
18582
18615
|
};
|
|
18583
18616
|
validateSource(peaks, opts, 'add()');
|
|
18584
18617
|
this._peaks = peaks;
|
|
@@ -18618,6 +18651,9 @@ module.exports = function (Utils) {
|
|
|
18618
18651
|
this._previewHeight = opts.previewHeight;
|
|
18619
18652
|
this._binaryHeight = opts.binaryHeight;
|
|
18620
18653
|
this._indicators = opts.indicators;
|
|
18654
|
+
this._markers = opts.markers;
|
|
18655
|
+
this._markerColor = opts.markerColor;
|
|
18656
|
+
this._markerWidth = opts.markerWidth;
|
|
18621
18657
|
this._minSize = peaks.options.minSourceSize;
|
|
18622
18658
|
this._selected = false;
|
|
18623
18659
|
}
|
|
@@ -18907,6 +18943,24 @@ module.exports = function (Utils) {
|
|
|
18907
18943
|
return this._indicators;
|
|
18908
18944
|
}
|
|
18909
18945
|
},
|
|
18946
|
+
markers: {
|
|
18947
|
+
enumerable: true,
|
|
18948
|
+
get: function () {
|
|
18949
|
+
return this._markers;
|
|
18950
|
+
}
|
|
18951
|
+
},
|
|
18952
|
+
markerColor: {
|
|
18953
|
+
enumerable: true,
|
|
18954
|
+
get: function () {
|
|
18955
|
+
return this._markerColor;
|
|
18956
|
+
}
|
|
18957
|
+
},
|
|
18958
|
+
markerWidth: {
|
|
18959
|
+
enumerable: true,
|
|
18960
|
+
get: function () {
|
|
18961
|
+
return this._markerWidth;
|
|
18962
|
+
}
|
|
18963
|
+
},
|
|
18910
18964
|
minSize: {
|
|
18911
18965
|
enumerable: true,
|
|
18912
18966
|
get: function () {
|
|
@@ -19041,7 +19095,10 @@ module.exports = function (Utils) {
|
|
|
19041
19095
|
wrapping: this.wrapping,
|
|
19042
19096
|
previewHeight: this.previewHeight,
|
|
19043
19097
|
binaryHeight: this.binaryHeight,
|
|
19044
|
-
indicators: this.indicators
|
|
19098
|
+
indicators: this.indicators,
|
|
19099
|
+
markers: this.markers,
|
|
19100
|
+
markerColor: this.markerColor,
|
|
19101
|
+
markerWidth: this.markerWidth
|
|
19045
19102
|
};
|
|
19046
19103
|
Utils.extend(opts, options);
|
|
19047
19104
|
validateSource(this._peaks, opts, 'update()');
|
|
@@ -19078,6 +19135,9 @@ module.exports = function (Utils) {
|
|
|
19078
19135
|
this._previewHeight = opts.previewHeight;
|
|
19079
19136
|
this._binaryHeight = opts.binaryHeight;
|
|
19080
19137
|
this._indicators = opts.indicators;
|
|
19138
|
+
this._markers = opts.markers;
|
|
19139
|
+
this._markerColor = opts.markerColor;
|
|
19140
|
+
this._markerWidth = opts.markerWidth;
|
|
19081
19141
|
this._peaks.emit('source.update', this);
|
|
19082
19142
|
};
|
|
19083
19143
|
Source.prototype.isVisible = function (startTime, endTime) {
|
|
@@ -19902,7 +19962,10 @@ module.exports = function (Source, Utils) {
|
|
|
19902
19962
|
deletable: sourceToCut.deletable,
|
|
19903
19963
|
wrapping: sourceToCut.wrapping,
|
|
19904
19964
|
previewHeight: sourceToCut.previewHeight,
|
|
19905
|
-
binaryHeight: sourceToCut.binaryHeight
|
|
19965
|
+
binaryHeight: sourceToCut.binaryHeight,
|
|
19966
|
+
markers: sourceToCut.markers,
|
|
19967
|
+
markerColor: sourceToCut.markerColor,
|
|
19968
|
+
markerWidth: sourceToCut.markerWidth
|
|
19906
19969
|
}])[0];
|
|
19907
19970
|
this._peaks.emit('sources.updated', [
|
|
19908
19971
|
sourceToCut,
|
|
@@ -19920,7 +19983,7 @@ module.exports = function (Source, Utils) {
|
|
|
19920
19983
|
if (!Utils.isObject(options)) {
|
|
19921
19984
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
19922
19985
|
}
|
|
19923
|
-
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.textFont, options.textFontSize, options.textColor, options.textBackgroundColor, options.textPosition, 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);
|
|
19986
|
+
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.textFont, options.textFontSize, options.textColor, options.textBackgroundColor, options.textPosition, 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);
|
|
19924
19987
|
return source;
|
|
19925
19988
|
};
|
|
19926
19989
|
TimelineSources.prototype.getSources = function () {
|
package/src/source-group.js
CHANGED
|
@@ -56,6 +56,8 @@ define([
|
|
|
56
56
|
|
|
57
57
|
this._previewList = [];
|
|
58
58
|
|
|
59
|
+
this._markersGroup = this._createMarkers();
|
|
60
|
+
|
|
59
61
|
this._group = new Konva.Group({
|
|
60
62
|
x: this._x,
|
|
61
63
|
sourceId: this._source.id,
|
|
@@ -377,6 +379,7 @@ define([
|
|
|
377
379
|
}));
|
|
378
380
|
|
|
379
381
|
unwrap.add(background);
|
|
382
|
+
unwrap.add(this._markersGroup);
|
|
380
383
|
unwrap.add(this._createTitle(false));
|
|
381
384
|
|
|
382
385
|
return unwrap;
|
|
@@ -435,6 +438,7 @@ define([
|
|
|
435
438
|
}));
|
|
436
439
|
|
|
437
440
|
wrap.add(background);
|
|
441
|
+
wrap.add(this._markersGroup);
|
|
438
442
|
wrap.add(this._createTitle(true));
|
|
439
443
|
|
|
440
444
|
return wrap;
|
|
@@ -1000,5 +1004,25 @@ define([
|
|
|
1000
1004
|
this._indicatorsGroup.offsetY(-INDICATORS_MARGIN_TOP);
|
|
1001
1005
|
};
|
|
1002
1006
|
|
|
1007
|
+
SourceGroup.prototype._createMarkers = function() {
|
|
1008
|
+
const markersGroup = new Konva.Group({
|
|
1009
|
+
listening: false
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
this._source.markers.forEach(function(marker) {
|
|
1013
|
+
const markerX = this._view.timeToPixels(marker);
|
|
1014
|
+
|
|
1015
|
+
var markerLine = new Konva.Line({
|
|
1016
|
+
points: [markerX, 0, markerX, this._unwrappedHeight],
|
|
1017
|
+
stroke: this._source.markerColor,
|
|
1018
|
+
strokeWidth: this._source.markerWidth
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
markersGroup.add(markerLine);
|
|
1022
|
+
}.bind(this));
|
|
1023
|
+
|
|
1024
|
+
return markersGroup;
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1003
1027
|
return SourceGroup;
|
|
1004
1028
|
});
|
package/src/source.js
CHANGED
|
@@ -250,6 +250,19 @@ define([
|
|
|
250
250
|
if (Utils.isNullOrUndefined(options.indicators)) {
|
|
251
251
|
options.indicators = [];
|
|
252
252
|
}
|
|
253
|
+
|
|
254
|
+
if (Utils.isNullOrUndefined(options.markers)) {
|
|
255
|
+
options.markers = [];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (Utils.isNullOrUndefined(options.markerColor)
|
|
259
|
+
|| !Utils.isValidColor(options.markerColor)) {
|
|
260
|
+
options.markerColor = options.color;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (Utils.isNullOrUndefined(options.markerWidth)) {
|
|
264
|
+
options.markerWidth = 2;
|
|
265
|
+
}
|
|
253
266
|
}
|
|
254
267
|
|
|
255
268
|
/**
|
|
@@ -277,7 +290,8 @@ define([
|
|
|
277
290
|
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
278
291
|
borderColor, selectedColor, textFont, textFontSize, textColor, textBackgroundColor,
|
|
279
292
|
textPosition, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable,
|
|
280
|
-
cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators
|
|
293
|
+
cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor,
|
|
294
|
+
markerWidth) {
|
|
281
295
|
var opts = {
|
|
282
296
|
title: title,
|
|
283
297
|
url: url,
|
|
@@ -311,7 +325,10 @@ define([
|
|
|
311
325
|
wrapping: wrapping,
|
|
312
326
|
previewHeight: previewHeight,
|
|
313
327
|
binaryHeight: binaryHeight,
|
|
314
|
-
indicators: indicators
|
|
328
|
+
indicators: indicators,
|
|
329
|
+
markers: markers,
|
|
330
|
+
markerColor: markerColor,
|
|
331
|
+
markerWidth: markerWidth
|
|
315
332
|
};
|
|
316
333
|
|
|
317
334
|
validateSource(peaks, opts, 'add()');
|
|
@@ -353,6 +370,9 @@ define([
|
|
|
353
370
|
this._previewHeight = opts.previewHeight;
|
|
354
371
|
this._binaryHeight = opts.binaryHeight;
|
|
355
372
|
this._indicators = opts.indicators;
|
|
373
|
+
this._markers = opts.markers;
|
|
374
|
+
this._markerColor = opts.markerColor;
|
|
375
|
+
this._markerWidth = opts.markerWidth;
|
|
356
376
|
this._minSize = peaks.options.minSourceSize;
|
|
357
377
|
this._selected = false;
|
|
358
378
|
}
|
|
@@ -664,6 +684,24 @@ define([
|
|
|
664
684
|
return this._indicators;
|
|
665
685
|
}
|
|
666
686
|
},
|
|
687
|
+
markers: {
|
|
688
|
+
enumerable: true,
|
|
689
|
+
get: function() {
|
|
690
|
+
return this._markers;
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
markerColor: {
|
|
694
|
+
enumerable: true,
|
|
695
|
+
get: function() {
|
|
696
|
+
return this._markerColor;
|
|
697
|
+
}
|
|
698
|
+
},
|
|
699
|
+
markerWidth: {
|
|
700
|
+
enumerable: true,
|
|
701
|
+
get: function() {
|
|
702
|
+
return this._markerWidth;
|
|
703
|
+
}
|
|
704
|
+
},
|
|
667
705
|
minSize: {
|
|
668
706
|
enumerable: true,
|
|
669
707
|
get: function() {
|
|
@@ -831,7 +869,10 @@ define([
|
|
|
831
869
|
wrapping: this.wrapping,
|
|
832
870
|
previewHeight: this.previewHeight,
|
|
833
871
|
binaryHeight: this.binaryHeight,
|
|
834
|
-
indicators: this.indicators
|
|
872
|
+
indicators: this.indicators,
|
|
873
|
+
markers: this.markers,
|
|
874
|
+
markerColor: this.markerColor,
|
|
875
|
+
markerWidth: this.markerWidth
|
|
835
876
|
};
|
|
836
877
|
|
|
837
878
|
Utils.extend(opts, options);
|
|
@@ -871,6 +912,9 @@ define([
|
|
|
871
912
|
this._previewHeight = opts.previewHeight;
|
|
872
913
|
this._binaryHeight = opts.binaryHeight;
|
|
873
914
|
this._indicators = opts.indicators;
|
|
915
|
+
this._markers = opts.markers;
|
|
916
|
+
this._markerColor = opts.markerColor;
|
|
917
|
+
this._markerWidth = opts.markerWidth;
|
|
874
918
|
|
|
875
919
|
this._peaks.emit('source.update', this);
|
|
876
920
|
};
|
package/src/timeline-sources.js
CHANGED
|
@@ -97,7 +97,10 @@ define([
|
|
|
97
97
|
deletable: sourceToCut.deletable,
|
|
98
98
|
wrapping: sourceToCut.wrapping,
|
|
99
99
|
previewHeight: sourceToCut.previewHeight,
|
|
100
|
-
binaryHeight: sourceToCut.binaryHeight
|
|
100
|
+
binaryHeight: sourceToCut.binaryHeight,
|
|
101
|
+
markers: sourceToCut.markers,
|
|
102
|
+
markerColor: sourceToCut.markerColor,
|
|
103
|
+
markerWidth: sourceToCut.markerWidth
|
|
101
104
|
}])[0];
|
|
102
105
|
|
|
103
106
|
this._peaks.emit('sources.updated', [sourceToCut, newSource]);
|
|
@@ -180,7 +183,10 @@ define([
|
|
|
180
183
|
options.wrapping,
|
|
181
184
|
options.previewHeight,
|
|
182
185
|
options.binaryHeight,
|
|
183
|
-
options.indicators
|
|
186
|
+
options.indicators,
|
|
187
|
+
options.markers,
|
|
188
|
+
options.markerColor,
|
|
189
|
+
options.markerWidth
|
|
184
190
|
);
|
|
185
191
|
|
|
186
192
|
return source;
|