@checksub_team/peaks_timeline 1.4.21 → 1.4.25
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 +29 -35
- package/src/main.js +7 -7
- package/src/player.js +3 -3
- package/src/segment-shape.js +0 -8
- package/src/segment.js +0 -4
- package/src/segments-group.js +0 -23
- package/src/source.js +20 -3
- package/src/sources-layer.js +3 -1
- package/src/timeline-sources.js +4 -2
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15419,7 +15419,8 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15419
15419
|
autoScrollThreshold: 0.05,
|
|
15420
15420
|
enableLineIndicatorContextMenu: true,
|
|
15421
15421
|
minSourceSize: 0.05,
|
|
15422
|
-
minSegmentSize: 0.2
|
|
15422
|
+
minSegmentSize: 0.2,
|
|
15423
|
+
canMoveSourcesBetweenLines: true
|
|
15423
15424
|
};
|
|
15424
15425
|
this.logger = console.error.bind(console);
|
|
15425
15426
|
return this;
|
|
@@ -15561,9 +15562,6 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15561
15562
|
Peaks.prototype.allowInteractions = function (forSources, forSegments) {
|
|
15562
15563
|
return this.view.allowInteractions(forSources, forSegments);
|
|
15563
15564
|
};
|
|
15564
|
-
Peaks.prototype.checkOverlapping = function (segment, message) {
|
|
15565
|
-
return this.view.getSegmentsGroup().checkOverlapping(segment, message);
|
|
15566
|
-
};
|
|
15567
15565
|
Peaks.prototype._addWindowResizeHandler = function () {
|
|
15568
15566
|
this._onResize = this._onResize.bind(this);
|
|
15569
15567
|
window.addEventListener('resize', this._onResize);
|
|
@@ -15992,17 +15990,17 @@ module.exports = function (Utils) {
|
|
|
15992
15990
|
};
|
|
15993
15991
|
Player.prototype.play = function () {
|
|
15994
15992
|
if (!this._playInterval) {
|
|
15995
|
-
var prevTime =
|
|
15993
|
+
var prevTime = performance.now();
|
|
15996
15994
|
var time;
|
|
15997
15995
|
var self = this;
|
|
15998
15996
|
this._isPlaying = true;
|
|
15999
15997
|
this._peaks.overrideInteractions(true, false);
|
|
16000
15998
|
this._playInterval = setInterval(function () {
|
|
16001
|
-
time =
|
|
15999
|
+
time = performance.now();
|
|
16002
16000
|
self._currentTime += (time - prevTime) / 1000 * self._speed;
|
|
16003
16001
|
prevTime = time;
|
|
16004
16002
|
self._peaks.emit('timeline.update', self._currentTime);
|
|
16005
|
-
},
|
|
16003
|
+
}, 20);
|
|
16006
16004
|
this._peaks.emit('timeline.play', this._currentTime);
|
|
16007
16005
|
}
|
|
16008
16006
|
};
|
|
@@ -16563,7 +16561,6 @@ module.exports = function (Konva, SegmentMarker) {
|
|
|
16563
16561
|
};
|
|
16564
16562
|
SegmentShape.prototype._onSegmentDragStart = function () {
|
|
16565
16563
|
this._view.setCursor('grab');
|
|
16566
|
-
this._group.checkOverlapping(this._segment, 'overlapping before dragging');
|
|
16567
16564
|
this._mouseDownX = this._view.getPointerPosition().x;
|
|
16568
16565
|
this._initialStartTime = this._segment.startTime;
|
|
16569
16566
|
this._initialStartPixel = this._view.timeToPixels(this._initialStartTime);
|
|
@@ -16573,7 +16570,6 @@ module.exports = function (Konva, SegmentMarker) {
|
|
|
16573
16570
|
};
|
|
16574
16571
|
SegmentShape.prototype._onSegmentDragEnd = function () {
|
|
16575
16572
|
this._view.setCursor('pointer');
|
|
16576
|
-
this._group.checkOverlapping(this._segment, 'overlapping after dragging');
|
|
16577
16573
|
this._peaks.emit('segments.dragend', this._segment);
|
|
16578
16574
|
};
|
|
16579
16575
|
SegmentShape.prototype._onSegmentHandleDrag = function () {
|
|
@@ -16581,12 +16577,10 @@ module.exports = function (Konva, SegmentMarker) {
|
|
|
16581
16577
|
};
|
|
16582
16578
|
SegmentShape.prototype._onSegmentHandleDragStart = function (segmentMarker) {
|
|
16583
16579
|
var startMarker = segmentMarker.isStartMarker();
|
|
16584
|
-
this._group.checkOverlapping(this._segment, 'overlapping before dragging');
|
|
16585
16580
|
this._peaks.emit('segments.dragstart', this._segment, startMarker);
|
|
16586
16581
|
};
|
|
16587
16582
|
SegmentShape.prototype._onSegmentHandleDragEnd = function (segmentMarker) {
|
|
16588
16583
|
var startMarker = segmentMarker.isStartMarker();
|
|
16589
|
-
this._group.checkOverlapping(this._segment, 'overlapping after dragging');
|
|
16590
16584
|
this._peaks.emit('segments.dragend', this._segment, startMarker);
|
|
16591
16585
|
};
|
|
16592
16586
|
SegmentShape.prototype.fitToView = function () {
|
|
@@ -16754,7 +16748,6 @@ module.exports = function (Utils) {
|
|
|
16754
16748
|
};
|
|
16755
16749
|
Utils.extend(opts, options);
|
|
16756
16750
|
validateSegment(this._peaks, opts, 'update()');
|
|
16757
|
-
this._peaks.checkOverlapping(this, 'overlapping before manual update');
|
|
16758
16751
|
this._startTime = opts.startTime;
|
|
16759
16752
|
this._endTime = opts.endTime;
|
|
16760
16753
|
this._labelText = opts.labelText;
|
|
@@ -16763,7 +16756,6 @@ module.exports = function (Utils) {
|
|
|
16763
16756
|
this._handleTextColor = opts.handleTextColor;
|
|
16764
16757
|
this._opacity = opts.opacity;
|
|
16765
16758
|
this._editable = opts.editable;
|
|
16766
|
-
this._peaks.checkOverlapping(this, 'overlapping after manual update');
|
|
16767
16759
|
this._peaks.emit('segment.updated', this);
|
|
16768
16760
|
};
|
|
16769
16761
|
Segment.prototype.isVisible = function (startTime, endTime) {
|
|
@@ -16784,7 +16776,6 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16784
16776
|
this._segmentShapes = {};
|
|
16785
16777
|
this._group = new Konva.Group();
|
|
16786
16778
|
this._updatedSegments = [];
|
|
16787
|
-
this._overlappingSegments = [];
|
|
16788
16779
|
this._isMagnetized = false;
|
|
16789
16780
|
this._peaks.on('segment.updated', this._onSegmentsUpdate.bind(this));
|
|
16790
16781
|
this._peaks.on('segments.add', this._onSegmentsAdd.bind(this));
|
|
@@ -16834,7 +16825,6 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16834
16825
|
return activeSegment;
|
|
16835
16826
|
};
|
|
16836
16827
|
SegmentsGroup.prototype._onSegmentsUpdate = function (segment) {
|
|
16837
|
-
this._overlappingSegments = [];
|
|
16838
16828
|
if (this._segments[segment.id]) {
|
|
16839
16829
|
var redraw = false;
|
|
16840
16830
|
var segmentShape = this._segmentShapes[segment.id];
|
|
@@ -16860,7 +16850,6 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
16860
16850
|
SegmentsGroup.prototype._onSegmentUpdated = function () {
|
|
16861
16851
|
this._peaks.emit('segments.updated', this._updatedSegments);
|
|
16862
16852
|
this._updatedSegments = [];
|
|
16863
|
-
this._overlappingSegments = [];
|
|
16864
16853
|
};
|
|
16865
16854
|
SegmentsGroup.prototype._onSegmentsAdd = function (segments) {
|
|
16866
16855
|
var self = this;
|
|
@@ -17058,19 +17047,6 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
17058
17047
|
this._draw();
|
|
17059
17048
|
}
|
|
17060
17049
|
};
|
|
17061
|
-
SegmentsGroup.prototype.checkOverlapping = function (segment, message) {
|
|
17062
|
-
if (this._segments[segment.id].prevSegmentId && this._segments[this._segments[segment.id].prevSegmentId].segment.endTime > segment.startTime || this._segments[segment.id].nextSegmentId && this._segments[this._segments[segment.id].nextSegmentId].segment.startTime < segment.endTime) {
|
|
17063
|
-
if (!this._overlappingSegments.includes(segment.id)) {
|
|
17064
|
-
this._peaks.emit('segments.overlap', {
|
|
17065
|
-
message: message,
|
|
17066
|
-
segment: segment,
|
|
17067
|
-
prevSegment: this._segments[segment.id].prevSegmentId ? this._segments[this._segments[segment.id].prevSegmentId].segment : null,
|
|
17068
|
-
nextSegment: this._segments[segment.id].nextSegmentId ? this._segments[this._segments[segment.id].nextSegmentId].segment : null
|
|
17069
|
-
});
|
|
17070
|
-
this._overlappingSegments.push(segment.id);
|
|
17071
|
-
}
|
|
17072
|
-
}
|
|
17073
|
-
};
|
|
17074
17050
|
SegmentsGroup.prototype.manageCollision = function (segment, newStartX, newEndX) {
|
|
17075
17051
|
var newStartTime = null;
|
|
17076
17052
|
var newEndTime = null;
|
|
@@ -18101,8 +18077,11 @@ module.exports = function (Utils) {
|
|
|
18101
18077
|
} else if (options.wrapping === 'complete') {
|
|
18102
18078
|
options.wrapped = false;
|
|
18103
18079
|
}
|
|
18080
|
+
if (!Utils.isNullOrUndefined(options.tts) && !Utils.isBoolean(options.tts)) {
|
|
18081
|
+
throw new TypeError('peaks.sources.' + context + ': tts must be a boolean or undefined');
|
|
18082
|
+
}
|
|
18104
18083
|
}
|
|
18105
|
-
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
|
|
18084
|
+
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight, tts) {
|
|
18106
18085
|
var opts = {
|
|
18107
18086
|
title: title,
|
|
18108
18087
|
url: url,
|
|
@@ -18125,7 +18104,8 @@ module.exports = function (Utils) {
|
|
|
18125
18104
|
resizable: resizable,
|
|
18126
18105
|
wrapping: wrapping,
|
|
18127
18106
|
previewHeight: previewHeight,
|
|
18128
|
-
binaryHeight: binaryHeight
|
|
18107
|
+
binaryHeight: binaryHeight,
|
|
18108
|
+
tts: tts
|
|
18129
18109
|
};
|
|
18130
18110
|
validateSource(peaks, opts, 'add()');
|
|
18131
18111
|
this._peaks = peaks;
|
|
@@ -18155,6 +18135,7 @@ module.exports = function (Utils) {
|
|
|
18155
18135
|
this._previewHeight = opts.previewHeight;
|
|
18156
18136
|
this._binaryHeight = opts.binaryHeight;
|
|
18157
18137
|
this._minSize = peaks.options.minSourceSize;
|
|
18138
|
+
this._tts = opts.tts;
|
|
18158
18139
|
}
|
|
18159
18140
|
Object.defineProperties(Source.prototype, {
|
|
18160
18141
|
id: {
|
|
@@ -18360,6 +18341,14 @@ module.exports = function (Utils) {
|
|
|
18360
18341
|
get: function () {
|
|
18361
18342
|
return this._minSize;
|
|
18362
18343
|
}
|
|
18344
|
+
},
|
|
18345
|
+
tts: {
|
|
18346
|
+
get: function () {
|
|
18347
|
+
return this._tts;
|
|
18348
|
+
},
|
|
18349
|
+
set: function (tts) {
|
|
18350
|
+
this._tts = tts;
|
|
18351
|
+
}
|
|
18363
18352
|
}
|
|
18364
18353
|
});
|
|
18365
18354
|
Source.prototype.updateTimes = function (newStartTime, newEndTime) {
|
|
@@ -18469,7 +18458,8 @@ module.exports = function (Utils) {
|
|
|
18469
18458
|
resizable: this.resizable,
|
|
18470
18459
|
wrapping: this.wrapping,
|
|
18471
18460
|
previewHeight: this.previewHeight,
|
|
18472
|
-
binaryHeight: this.binaryHeight
|
|
18461
|
+
binaryHeight: this.binaryHeight,
|
|
18462
|
+
tts: this._tts
|
|
18473
18463
|
};
|
|
18474
18464
|
Utils.extend(opts, options);
|
|
18475
18465
|
validateSource(this._peaks, opts, 'update()');
|
|
@@ -18495,6 +18485,7 @@ module.exports = function (Utils) {
|
|
|
18495
18485
|
this._wrapping = opts.wrapping;
|
|
18496
18486
|
this._previewHeight = opts.previewHeight;
|
|
18497
18487
|
this._binaryHeight = opts.binaryHeight;
|
|
18488
|
+
this._tts = opts.tts;
|
|
18498
18489
|
this._peaks.emit('source.update', this);
|
|
18499
18490
|
};
|
|
18500
18491
|
Source.prototype.isVisible = function (startTime, endTime) {
|
|
@@ -18673,7 +18664,9 @@ module.exports = function (SourceGroup, SegmentsGroup, Lines, DataRetriever, Uti
|
|
|
18673
18664
|
endX: newEndX,
|
|
18674
18665
|
updateWidth: false
|
|
18675
18666
|
};
|
|
18676
|
-
this.
|
|
18667
|
+
if (this._peaks.options.canMoveSourcesBetweenLines) {
|
|
18668
|
+
this.manageVerticalPosition(source, newY);
|
|
18669
|
+
}
|
|
18677
18670
|
newXs = this.manageSourceOrder(source, newStartX, newEndX);
|
|
18678
18671
|
newXs = this.manageCollision(source, newXs.startX, newXs.endX);
|
|
18679
18672
|
source.updateTimes(newXs.startX !== null ? this._view.pixelsToTime(newXs.startX) : null, newXs.endX !== null ? this._view.pixelsToTime(newXs.endX) : null);
|
|
@@ -19157,7 +19150,8 @@ module.exports = function (Source, Utils) {
|
|
|
19157
19150
|
resizable: sourceToCut.resizable,
|
|
19158
19151
|
wrapping: sourceToCut.wrapping,
|
|
19159
19152
|
previewHeight: sourceToCut.previewHeight,
|
|
19160
|
-
binaryHeight: sourceToCut.binaryHeight
|
|
19153
|
+
binaryHeight: sourceToCut.binaryHeight,
|
|
19154
|
+
tts: sourceToCut.tts
|
|
19161
19155
|
}]);
|
|
19162
19156
|
this._peaks.emit('sources.updated');
|
|
19163
19157
|
};
|
|
@@ -19172,7 +19166,7 @@ module.exports = function (Source, Utils) {
|
|
|
19172
19166
|
if (!Utils.isObject(options)) {
|
|
19173
19167
|
throw new TypeError('peaks.sources.add(): expected a Source object parameter');
|
|
19174
19168
|
}
|
|
19175
|
-
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.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);
|
|
19169
|
+
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.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, options.tts);
|
|
19176
19170
|
return source;
|
|
19177
19171
|
};
|
|
19178
19172
|
TimelineSources.prototype.getSources = function () {
|
package/src/main.js
CHANGED
|
@@ -310,7 +310,13 @@ define([
|
|
|
310
310
|
/**
|
|
311
311
|
* The minimal size of a segment, in seconds
|
|
312
312
|
*/
|
|
313
|
-
minSegmentSize: 0.2
|
|
313
|
+
minSegmentSize: 0.2,
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Indicates whether or not sources can be dragged
|
|
317
|
+
* from one line to another
|
|
318
|
+
*/
|
|
319
|
+
canMoveSourcesBetweenLines: true
|
|
314
320
|
};
|
|
315
321
|
|
|
316
322
|
/**
|
|
@@ -622,12 +628,6 @@ define([
|
|
|
622
628
|
.allowInteractions(forSources, forSegments);
|
|
623
629
|
};
|
|
624
630
|
|
|
625
|
-
Peaks.prototype.checkOverlapping = function(segment, message) {
|
|
626
|
-
return this.view
|
|
627
|
-
.getSegmentsGroup()
|
|
628
|
-
.checkOverlapping(segment, message);
|
|
629
|
-
};
|
|
630
|
-
|
|
631
631
|
Peaks.prototype._addWindowResizeHandler = function() {
|
|
632
632
|
this._onResize = this._onResize.bind(this);
|
|
633
633
|
window.addEventListener('resize', this._onResize);
|
package/src/player.js
CHANGED
|
@@ -66,7 +66,7 @@ define([
|
|
|
66
66
|
|
|
67
67
|
Player.prototype.play = function() {
|
|
68
68
|
if (!this._playInterval) {
|
|
69
|
-
var prevTime =
|
|
69
|
+
var prevTime = performance.now();
|
|
70
70
|
var time;
|
|
71
71
|
var self = this;
|
|
72
72
|
|
|
@@ -75,11 +75,11 @@ define([
|
|
|
75
75
|
this._peaks.overrideInteractions(true, false);
|
|
76
76
|
|
|
77
77
|
this._playInterval = setInterval(function() {
|
|
78
|
-
time =
|
|
78
|
+
time = performance.now();
|
|
79
79
|
self._currentTime += ((time - prevTime) / 1000) * self._speed;
|
|
80
80
|
prevTime = time;
|
|
81
81
|
self._peaks.emit('timeline.update', self._currentTime);
|
|
82
|
-
},
|
|
82
|
+
}, 20);
|
|
83
83
|
|
|
84
84
|
this._peaks.emit('timeline.play', this._currentTime);
|
|
85
85
|
}
|
package/src/segment-shape.js
CHANGED
|
@@ -272,8 +272,6 @@ define([
|
|
|
272
272
|
SegmentShape.prototype._onSegmentDragStart = function() {
|
|
273
273
|
this._view.setCursor('grab');
|
|
274
274
|
|
|
275
|
-
this._group.checkOverlapping(this._segment, 'overlapping before dragging');
|
|
276
|
-
|
|
277
275
|
this._mouseDownX = this._view.getPointerPosition().x;
|
|
278
276
|
this._initialStartTime = this._segment.startTime;
|
|
279
277
|
this._initialStartPixel = this._view.timeToPixels(this._initialStartTime);
|
|
@@ -286,8 +284,6 @@ define([
|
|
|
286
284
|
SegmentShape.prototype._onSegmentDragEnd = function() {
|
|
287
285
|
this._view.setCursor('pointer');
|
|
288
286
|
|
|
289
|
-
this._group.checkOverlapping(this._segment, 'overlapping after dragging');
|
|
290
|
-
|
|
291
287
|
this._peaks.emit('segments.dragend', this._segment);
|
|
292
288
|
};
|
|
293
289
|
|
|
@@ -306,8 +302,6 @@ define([
|
|
|
306
302
|
SegmentShape.prototype._onSegmentHandleDragStart = function(segmentMarker) {
|
|
307
303
|
var startMarker = segmentMarker.isStartMarker();
|
|
308
304
|
|
|
309
|
-
this._group.checkOverlapping(this._segment, 'overlapping before dragging');
|
|
310
|
-
|
|
311
305
|
this._peaks.emit('segments.dragstart', this._segment, startMarker);
|
|
312
306
|
};
|
|
313
307
|
|
|
@@ -318,8 +312,6 @@ define([
|
|
|
318
312
|
SegmentShape.prototype._onSegmentHandleDragEnd = function(segmentMarker) {
|
|
319
313
|
var startMarker = segmentMarker.isStartMarker();
|
|
320
314
|
|
|
321
|
-
this._group.checkOverlapping(this._segment, 'overlapping after dragging');
|
|
322
|
-
|
|
323
315
|
this._peaks.emit('segments.dragend', this._segment, startMarker);
|
|
324
316
|
};
|
|
325
317
|
|
package/src/segment.js
CHANGED
|
@@ -191,8 +191,6 @@ define([
|
|
|
191
191
|
|
|
192
192
|
validateSegment(this._peaks, opts, 'update()');
|
|
193
193
|
|
|
194
|
-
this._peaks.checkOverlapping(this, 'overlapping before manual update');
|
|
195
|
-
|
|
196
194
|
this._startTime = opts.startTime;
|
|
197
195
|
this._endTime = opts.endTime;
|
|
198
196
|
this._labelText = opts.labelText;
|
|
@@ -202,8 +200,6 @@ define([
|
|
|
202
200
|
this._opacity = opts.opacity;
|
|
203
201
|
this._editable = opts.editable;
|
|
204
202
|
|
|
205
|
-
this._peaks.checkOverlapping(this, 'overlapping after manual update');
|
|
206
|
-
|
|
207
203
|
this._peaks.emit('segment.updated', this);
|
|
208
204
|
};
|
|
209
205
|
|
package/src/segments-group.js
CHANGED
|
@@ -41,7 +41,6 @@ define([
|
|
|
41
41
|
this._group = new Konva.Group();
|
|
42
42
|
|
|
43
43
|
this._updatedSegments = [];
|
|
44
|
-
this._overlappingSegments = [];
|
|
45
44
|
|
|
46
45
|
this._isMagnetized = false;
|
|
47
46
|
|
|
@@ -114,8 +113,6 @@ define([
|
|
|
114
113
|
};
|
|
115
114
|
|
|
116
115
|
SegmentsGroup.prototype._onSegmentsUpdate = function(segment) {
|
|
117
|
-
this._overlappingSegments = [];
|
|
118
|
-
|
|
119
116
|
if (this._segments[segment.id]) {
|
|
120
117
|
var redraw = false;
|
|
121
118
|
var segmentShape = this._segmentShapes[segment.id];
|
|
@@ -146,7 +143,6 @@ define([
|
|
|
146
143
|
SegmentsGroup.prototype._onSegmentUpdated = function() {
|
|
147
144
|
this._peaks.emit('segments.updated', this._updatedSegments);
|
|
148
145
|
this._updatedSegments = [];
|
|
149
|
-
this._overlappingSegments = [];
|
|
150
146
|
};
|
|
151
147
|
|
|
152
148
|
SegmentsGroup.prototype._onSegmentsAdd = function(segments) {
|
|
@@ -464,25 +460,6 @@ define([
|
|
|
464
460
|
}
|
|
465
461
|
};
|
|
466
462
|
|
|
467
|
-
SegmentsGroup.prototype.checkOverlapping = function(segment, message) {
|
|
468
|
-
/* eslint-disable max-len */
|
|
469
|
-
if ((this._segments[segment.id].prevSegmentId
|
|
470
|
-
&& this._segments[this._segments[segment.id].prevSegmentId].segment.endTime > segment.startTime)
|
|
471
|
-
|| (this._segments[segment.id].nextSegmentId
|
|
472
|
-
&& this._segments[this._segments[segment.id].nextSegmentId].segment.startTime < segment.endTime)) {
|
|
473
|
-
if (!this._overlappingSegments.includes(segment.id)) {
|
|
474
|
-
this._peaks.emit('segments.overlap', {
|
|
475
|
-
message: message,
|
|
476
|
-
segment: segment,
|
|
477
|
-
prevSegment: this._segments[segment.id].prevSegmentId ? this._segments[this._segments[segment.id].prevSegmentId].segment : null,
|
|
478
|
-
nextSegment: this._segments[segment.id].nextSegmentId ? this._segments[this._segments[segment.id].nextSegmentId].segment : null
|
|
479
|
-
});
|
|
480
|
-
this._overlappingSegments.push(segment.id);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
/* eslint-enable max-len */
|
|
484
|
-
};
|
|
485
|
-
|
|
486
463
|
SegmentsGroup.prototype.manageCollision = function(segment, newStartX, newEndX) {
|
|
487
464
|
var newStartTime = null;
|
|
488
465
|
var newEndTime = null;
|
package/src/source.js
CHANGED
|
@@ -197,6 +197,10 @@ define([
|
|
|
197
197
|
else if (options.wrapping === 'complete') {
|
|
198
198
|
options.wrapped = false;
|
|
199
199
|
}
|
|
200
|
+
|
|
201
|
+
if (!Utils.isNullOrUndefined(options.tts) && !Utils.isBoolean(options.tts)) {
|
|
202
|
+
throw new TypeError('peaks.sources.' + context + ': tts must be a boolean or undefined');
|
|
203
|
+
}
|
|
200
204
|
}
|
|
201
205
|
|
|
202
206
|
/**
|
|
@@ -222,7 +226,7 @@ define([
|
|
|
222
226
|
function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind,
|
|
223
227
|
duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor,
|
|
224
228
|
selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping,
|
|
225
|
-
previewHeight, binaryHeight) {
|
|
229
|
+
previewHeight, binaryHeight, tts) {
|
|
226
230
|
var opts = {
|
|
227
231
|
title: title,
|
|
228
232
|
url: url,
|
|
@@ -245,7 +249,8 @@ define([
|
|
|
245
249
|
resizable: resizable,
|
|
246
250
|
wrapping: wrapping,
|
|
247
251
|
previewHeight: previewHeight,
|
|
248
|
-
binaryHeight: binaryHeight
|
|
252
|
+
binaryHeight: binaryHeight,
|
|
253
|
+
tts: tts
|
|
249
254
|
};
|
|
250
255
|
|
|
251
256
|
validateSource(peaks, opts, 'add()');
|
|
@@ -277,6 +282,7 @@ define([
|
|
|
277
282
|
this._previewHeight = opts.previewHeight;
|
|
278
283
|
this._binaryHeight = opts.binaryHeight;
|
|
279
284
|
this._minSize = peaks.options.minSourceSize;
|
|
285
|
+
this._tts = opts.tts;
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
Object.defineProperties(Source.prototype, {
|
|
@@ -497,6 +503,15 @@ define([
|
|
|
497
503
|
get: function() {
|
|
498
504
|
return this._minSize;
|
|
499
505
|
}
|
|
506
|
+
},
|
|
507
|
+
tts: {
|
|
508
|
+
get: function() {
|
|
509
|
+
return this._tts;
|
|
510
|
+
},
|
|
511
|
+
|
|
512
|
+
set: function(tts) {
|
|
513
|
+
this._tts = tts;
|
|
514
|
+
}
|
|
500
515
|
}
|
|
501
516
|
});
|
|
502
517
|
|
|
@@ -638,7 +653,8 @@ define([
|
|
|
638
653
|
resizable: this.resizable,
|
|
639
654
|
wrapping: this.wrapping,
|
|
640
655
|
previewHeight: this.previewHeight,
|
|
641
|
-
binaryHeight: this.binaryHeight
|
|
656
|
+
binaryHeight: this.binaryHeight,
|
|
657
|
+
tts: this._tts
|
|
642
658
|
};
|
|
643
659
|
|
|
644
660
|
Utils.extend(opts, options);
|
|
@@ -667,6 +683,7 @@ define([
|
|
|
667
683
|
this._wrapping = opts.wrapping;
|
|
668
684
|
this._previewHeight = opts.previewHeight;
|
|
669
685
|
this._binaryHeight = opts.binaryHeight;
|
|
686
|
+
this._tts = opts.tts;
|
|
670
687
|
|
|
671
688
|
this._peaks.emit('source.update', this);
|
|
672
689
|
};
|
package/src/sources-layer.js
CHANGED
|
@@ -297,7 +297,9 @@ define([
|
|
|
297
297
|
updateWidth: false
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
this.
|
|
300
|
+
if (this._peaks.options.canMoveSourcesBetweenLines) {
|
|
301
|
+
this.manageVerticalPosition(source, newY);
|
|
302
|
+
}
|
|
301
303
|
|
|
302
304
|
newXs = this.manageSourceOrder(source, newStartX, newEndX);
|
|
303
305
|
|
package/src/timeline-sources.js
CHANGED
|
@@ -87,7 +87,8 @@ define([
|
|
|
87
87
|
resizable: sourceToCut.resizable,
|
|
88
88
|
wrapping: sourceToCut.wrapping,
|
|
89
89
|
previewHeight: sourceToCut.previewHeight,
|
|
90
|
-
binaryHeight: sourceToCut.binaryHeight
|
|
90
|
+
binaryHeight: sourceToCut.binaryHeight,
|
|
91
|
+
tts: sourceToCut.tts
|
|
91
92
|
}]);
|
|
92
93
|
|
|
93
94
|
this._peaks.emit('sources.updated');
|
|
@@ -159,7 +160,8 @@ define([
|
|
|
159
160
|
options.resizable,
|
|
160
161
|
options.wrapping,
|
|
161
162
|
options.previewHeight,
|
|
162
|
-
options.binaryHeight
|
|
163
|
+
options.binaryHeight,
|
|
164
|
+
options.tts
|
|
163
165
|
);
|
|
164
166
|
|
|
165
167
|
return source;
|