@checksub_team/peaks_timeline 1.10.2 → 1.11.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 +26 -3
- package/src/source-group.js +8 -1
- package/src/source.js +21 -3
- package/src/timeline-sources.js +2 -0
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -17965,8 +17965,10 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17965
17965
|
var self = this;
|
|
17966
17966
|
var defaultWidth;
|
|
17967
17967
|
var y = this._source.textPosition === 'bottom' ? Math.max((isWrap ? this._wrappedHeight : this._unwrappedHeight) - this._source.textFontSize - this._peaks.options.sourceTextYOffset, this._peaks.options.sourceTextYOffset) : this._peaks.options.sourceTextYOffset;
|
|
17968
|
+
var defaultXOffset = this._peaks.options.sourceTextXOffset;
|
|
17969
|
+
var maxXOffset = this._width - 2 * defaultXOffset;
|
|
17968
17970
|
var title = new Konva.Text({
|
|
17969
|
-
x:
|
|
17971
|
+
x: defaultXOffset,
|
|
17970
17972
|
y: y,
|
|
17971
17973
|
text: Utils.removeLineBreaks(this._source.title),
|
|
17972
17974
|
textAlign: 'left',
|
|
@@ -17978,6 +17980,10 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17978
17980
|
ellipsis: true,
|
|
17979
17981
|
listening: false,
|
|
17980
17982
|
sceneFunc: function (context, shape) {
|
|
17983
|
+
var absX = this.absolutePosition().x;
|
|
17984
|
+
if (self._source.textAutoScroll && absX < defaultXOffset) {
|
|
17985
|
+
this.offsetX(Math.max(Math.min(0, absX - defaultXOffset), -(maxXOffset - shape.width())));
|
|
17986
|
+
}
|
|
17981
17987
|
defaultWidth = defaultWidth ? defaultWidth : shape.width();
|
|
17982
17988
|
shape.width(Math.min(self._width - 10, defaultWidth));
|
|
17983
17989
|
if (self._source.textBackgroundColor) {
|
|
@@ -18495,6 +18501,9 @@ module.exports = function (Utils) {
|
|
|
18495
18501
|
} else if (!Utils.isString(options.textPosition)) {
|
|
18496
18502
|
throw new TypeError('peaks.sources.' + context + ': textPosition must be a string');
|
|
18497
18503
|
}
|
|
18504
|
+
if (Utils.isNullOrUndefined(options.textAutoScroll)) {
|
|
18505
|
+
options.textAutoScroll = false;
|
|
18506
|
+
}
|
|
18498
18507
|
if (Utils.isNullOrUndefined(options.borderWidth)) {
|
|
18499
18508
|
options.borderWidth = 0;
|
|
18500
18509
|
}
|
|
@@ -18574,7 +18583,7 @@ module.exports = function (Utils) {
|
|
|
18574
18583
|
options.markerWidth = 2;
|
|
18575
18584
|
}
|
|
18576
18585
|
}
|
|
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) {
|
|
18586
|
+
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, textAutoScroll, borderWidth, borderRadius, wrapped, position, draggable, orderable, resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers, markerColor, markerWidth) {
|
|
18578
18587
|
var opts = {
|
|
18579
18588
|
title: title,
|
|
18580
18589
|
url: url,
|
|
@@ -18596,6 +18605,7 @@ module.exports = function (Utils) {
|
|
|
18596
18605
|
textColor: textColor,
|
|
18597
18606
|
textBackgroundColor: textBackgroundColor,
|
|
18598
18607
|
textPosition: textPosition,
|
|
18608
|
+
textAutoScroll: textAutoScroll,
|
|
18599
18609
|
borderWidth: borderWidth,
|
|
18600
18610
|
borderRadius: borderRadius,
|
|
18601
18611
|
wrapped: wrapped,
|
|
@@ -18638,6 +18648,7 @@ module.exports = function (Utils) {
|
|
|
18638
18648
|
this._textColor = opts.textColor;
|
|
18639
18649
|
this._textBackgroundColor = opts.textBackgroundColor;
|
|
18640
18650
|
this._textPosition = opts.textPosition;
|
|
18651
|
+
this._textAutoScroll = opts.textAutoScroll;
|
|
18641
18652
|
this._borderWidth = opts.borderWidth;
|
|
18642
18653
|
this._borderRadius = opts.borderRadius;
|
|
18643
18654
|
this._wrapped = opts.wrapped;
|
|
@@ -18838,6 +18849,15 @@ module.exports = function (Utils) {
|
|
|
18838
18849
|
this._textPosition = textPosition;
|
|
18839
18850
|
}
|
|
18840
18851
|
},
|
|
18852
|
+
textAutoScroll: {
|
|
18853
|
+
enumerable: true,
|
|
18854
|
+
get: function () {
|
|
18855
|
+
return this._textAutoScroll;
|
|
18856
|
+
},
|
|
18857
|
+
set: function (textAutoScroll) {
|
|
18858
|
+
this._textAutoScroll = textAutoScroll;
|
|
18859
|
+
}
|
|
18860
|
+
},
|
|
18841
18861
|
borderWidth: {
|
|
18842
18862
|
enumerable: true,
|
|
18843
18863
|
get: function () {
|
|
@@ -19083,6 +19103,7 @@ module.exports = function (Utils) {
|
|
|
19083
19103
|
textColor: this.textColor,
|
|
19084
19104
|
textBackgroundColor: this.textBackgroundColor,
|
|
19085
19105
|
textPosition: this.textPosition,
|
|
19106
|
+
textAutoScroll: this.textAutoScroll,
|
|
19086
19107
|
borderWidth: this.borderWidth,
|
|
19087
19108
|
borderRadius: this.borderRadius,
|
|
19088
19109
|
wrapped: this.wrapped,
|
|
@@ -19122,6 +19143,7 @@ module.exports = function (Utils) {
|
|
|
19122
19143
|
this._textColor = opts.textColor;
|
|
19123
19144
|
this._textBackgroundColor = opts.textBackgroundColor;
|
|
19124
19145
|
this._textPosition = opts.textPosition;
|
|
19146
|
+
this._textAutoScroll = opts.textAutoScroll;
|
|
19125
19147
|
this._borderWidth = opts.borderWidth;
|
|
19126
19148
|
this._borderRadius = opts.borderRadius;
|
|
19127
19149
|
this._wrapped = opts.wrapped;
|
|
@@ -19951,6 +19973,7 @@ module.exports = function (Source, Utils) {
|
|
|
19951
19973
|
textColor: sourceToCut.textColor,
|
|
19952
19974
|
textBackgroundColor: sourceToCut.textBackgroundColor,
|
|
19953
19975
|
textPosition: sourceToCut.textPosition,
|
|
19976
|
+
textAutoScroll: sourceToCut.textAutoScroll,
|
|
19954
19977
|
borderWidth: sourceToCut.borderWidth,
|
|
19955
19978
|
borderRadius: sourceToCut.borderRadius,
|
|
19956
19979
|
wrapped: sourceToCut.wrapped,
|
|
@@ -19983,7 +20006,7 @@ module.exports = function (Source, Utils) {
|
|
|
19983
20006
|
if (!Utils.isObject(options)) {
|
|
19984
20007
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
19985
20008
|
}
|
|
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);
|
|
20009
|
+
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.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);
|
|
19987
20010
|
return source;
|
|
19988
20011
|
};
|
|
19989
20012
|
TimelineSources.prototype.getSources = function () {
|
package/src/source-group.js
CHANGED
|
@@ -468,9 +468,11 @@ define([
|
|
|
468
468
|
- this._source.textFontSize - this._peaks.options.sourceTextYOffset,
|
|
469
469
|
this._peaks.options.sourceTextYOffset
|
|
470
470
|
) : this._peaks.options.sourceTextYOffset;
|
|
471
|
+
var defaultXOffset = this._peaks.options.sourceTextXOffset;
|
|
472
|
+
var maxXOffset = this._width - 2 * defaultXOffset;
|
|
471
473
|
|
|
472
474
|
var title = new Konva.Text({
|
|
473
|
-
x:
|
|
475
|
+
x: defaultXOffset,
|
|
474
476
|
y: y,
|
|
475
477
|
text: Utils.removeLineBreaks(this._source.title),
|
|
476
478
|
textAlign: 'left',
|
|
@@ -482,6 +484,11 @@ define([
|
|
|
482
484
|
ellipsis: true,
|
|
483
485
|
listening: false,
|
|
484
486
|
sceneFunc: function(context, shape) {
|
|
487
|
+
var absX = this.absolutePosition().x;
|
|
488
|
+
|
|
489
|
+
if (self._source.textAutoScroll && absX < defaultXOffset) {
|
|
490
|
+
this.offsetX(Math.max(Math.min(0, absX - defaultXOffset), -(maxXOffset - shape.width())));
|
|
491
|
+
}
|
|
485
492
|
defaultWidth = defaultWidth ? defaultWidth : shape.width();
|
|
486
493
|
shape.width(Math.min(self._width - 10, defaultWidth));
|
|
487
494
|
if (self._source.textBackgroundColor) {
|
package/src/source.js
CHANGED
|
@@ -156,6 +156,10 @@ define([
|
|
|
156
156
|
throw new TypeError('peaks.sources.' + context + ': textPosition must be a string');
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
if (Utils.isNullOrUndefined(options.textAutoScroll)) {
|
|
160
|
+
options.textAutoScroll = false;
|
|
161
|
+
}
|
|
162
|
+
|
|
159
163
|
if (Utils.isNullOrUndefined(options.borderWidth)) {
|
|
160
164
|
options.borderWidth = 0;
|
|
161
165
|
}
|
|
@@ -289,9 +293,9 @@ define([
|
|
|
289
293
|
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind,
|
|
290
294
|
subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, backgroundColor,
|
|
291
295
|
borderColor, selectedColor, textFont, textFontSize, textColor, textBackgroundColor,
|
|
292
|
-
textPosition, borderWidth, borderRadius, wrapped, position, draggable, orderable,
|
|
293
|
-
cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers,
|
|
294
|
-
markerWidth) {
|
|
296
|
+
textPosition, textAutoScroll, borderWidth, borderRadius, wrapped, position, draggable, orderable,
|
|
297
|
+
resizable, cuttable, deletable, wrapping, previewHeight, binaryHeight, indicators, markers,
|
|
298
|
+
markerColor, markerWidth) {
|
|
295
299
|
var opts = {
|
|
296
300
|
title: title,
|
|
297
301
|
url: url,
|
|
@@ -313,6 +317,7 @@ define([
|
|
|
313
317
|
textColor: textColor,
|
|
314
318
|
textBackgroundColor: textBackgroundColor,
|
|
315
319
|
textPosition: textPosition,
|
|
320
|
+
textAutoScroll: textAutoScroll,
|
|
316
321
|
borderWidth: borderWidth,
|
|
317
322
|
borderRadius: borderRadius,
|
|
318
323
|
wrapped: wrapped,
|
|
@@ -357,6 +362,7 @@ define([
|
|
|
357
362
|
this._textColor = opts.textColor;
|
|
358
363
|
this._textBackgroundColor = opts.textBackgroundColor;
|
|
359
364
|
this._textPosition = opts.textPosition;
|
|
365
|
+
this._textAutoScroll = opts.textAutoScroll;
|
|
360
366
|
this._borderWidth = opts.borderWidth;
|
|
361
367
|
this._borderRadius = opts.borderRadius;
|
|
362
368
|
this._wrapped = opts.wrapped;
|
|
@@ -572,6 +578,16 @@ define([
|
|
|
572
578
|
this._textPosition = textPosition;
|
|
573
579
|
}
|
|
574
580
|
},
|
|
581
|
+
textAutoScroll: {
|
|
582
|
+
enumerable: true,
|
|
583
|
+
get: function() {
|
|
584
|
+
return this._textAutoScroll;
|
|
585
|
+
},
|
|
586
|
+
|
|
587
|
+
set: function(textAutoScroll) {
|
|
588
|
+
this._textAutoScroll = textAutoScroll;
|
|
589
|
+
}
|
|
590
|
+
},
|
|
575
591
|
borderWidth: {
|
|
576
592
|
enumerable: true,
|
|
577
593
|
get: function() {
|
|
@@ -857,6 +873,7 @@ define([
|
|
|
857
873
|
textColor: this.textColor,
|
|
858
874
|
textBackgroundColor: this.textBackgroundColor,
|
|
859
875
|
textPosition: this.textPosition,
|
|
876
|
+
textAutoScroll: this.textAutoScroll,
|
|
860
877
|
borderWidth: this.borderWidth,
|
|
861
878
|
borderRadius: this.borderRadius,
|
|
862
879
|
wrapped: this.wrapped,
|
|
@@ -899,6 +916,7 @@ define([
|
|
|
899
916
|
this._textColor = opts.textColor;
|
|
900
917
|
this._textBackgroundColor = opts.textBackgroundColor;
|
|
901
918
|
this._textPosition = opts.textPosition;
|
|
919
|
+
this._textAutoScroll = opts.textAutoScroll;
|
|
902
920
|
this._borderWidth = opts.borderWidth;
|
|
903
921
|
this._borderRadius = opts.borderRadius;
|
|
904
922
|
this._wrapped = opts.wrapped;
|
package/src/timeline-sources.js
CHANGED
|
@@ -86,6 +86,7 @@ define([
|
|
|
86
86
|
textColor: sourceToCut.textColor,
|
|
87
87
|
textBackgroundColor: sourceToCut.textBackgroundColor,
|
|
88
88
|
textPosition: sourceToCut.textPosition,
|
|
89
|
+
textAutoScroll: sourceToCut.textAutoScroll,
|
|
89
90
|
borderWidth: sourceToCut.borderWidth,
|
|
90
91
|
borderRadius: sourceToCut.borderRadius,
|
|
91
92
|
wrapped: sourceToCut.wrapped,
|
|
@@ -171,6 +172,7 @@ define([
|
|
|
171
172
|
options.textColor,
|
|
172
173
|
options.textBackgroundColor,
|
|
173
174
|
options.textPosition,
|
|
175
|
+
options.textAutoScroll,
|
|
174
176
|
options.borderWidth,
|
|
175
177
|
options.borderRadius,
|
|
176
178
|
options.wrapped,
|