@checksub_team/peaks_timeline 1.15.3-alpha.7 → 1.15.4-alpha.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 +12 -13
- package/src/line.js +10 -11
- package/src/sources-layer.js +2 -4
- package/src/timeline-zoomview.js +1 -1
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15425,19 +15425,20 @@ module.exports = function (Konva, Utils) {
|
|
|
15425
15425
|
this._sources[source.id] = sourceObj;
|
|
15426
15426
|
};
|
|
15427
15427
|
Line.prototype.manageCollision = function (source, newStartX, newEndX) {
|
|
15428
|
+
var originalStartTime = null;
|
|
15429
|
+
var originalEndTime = null;
|
|
15428
15430
|
var newStartTime = null;
|
|
15429
15431
|
var newEndTime = null;
|
|
15430
15432
|
var startLimited = false;
|
|
15431
15433
|
var endLimited = false;
|
|
15432
|
-
var timeWidth = this._view.pixelsToTime(newEndX - newStartX);
|
|
15433
15434
|
var newXs = {
|
|
15434
15435
|
startX: newStartX,
|
|
15435
15436
|
endX: newEndX,
|
|
15436
|
-
updateWidth: false,
|
|
15437
15437
|
updateTimelineLength: false
|
|
15438
15438
|
};
|
|
15439
15439
|
if (newStartX !== null) {
|
|
15440
|
-
|
|
15440
|
+
originalStartTime = this._view.pixelsToTime(newStartX);
|
|
15441
|
+
newStartTime = originalStartTime;
|
|
15441
15442
|
if (source.startTime > newStartTime) {
|
|
15442
15443
|
if (this._sources[source.id].prevSourceId) {
|
|
15443
15444
|
var previousSource = this._sources[this._sources[source.id].prevSourceId].source;
|
|
@@ -15454,7 +15455,8 @@ module.exports = function (Konva, Utils) {
|
|
|
15454
15455
|
}
|
|
15455
15456
|
}
|
|
15456
15457
|
if (newEndX !== null) {
|
|
15457
|
-
|
|
15458
|
+
originalEndTime = this._view.pixelsToTime(newEndX);
|
|
15459
|
+
newEndTime = originalEndTime;
|
|
15458
15460
|
if (source.endTime < newEndTime) {
|
|
15459
15461
|
if (this._sources[source.id].nextSourceId) {
|
|
15460
15462
|
var nextSource = this._sources[this._sources[source.id].nextSourceId].source;
|
|
@@ -15466,6 +15468,7 @@ module.exports = function (Konva, Utils) {
|
|
|
15466
15468
|
}
|
|
15467
15469
|
}
|
|
15468
15470
|
if (newStartTime !== null && newEndTime !== null) {
|
|
15471
|
+
var timeWidth = Utils.roundTime(originalEndTime - originalStartTime);
|
|
15469
15472
|
if (startLimited) {
|
|
15470
15473
|
newEndTime = newStartTime + timeWidth;
|
|
15471
15474
|
}
|
|
@@ -15491,18 +15494,15 @@ module.exports = function (Konva, Utils) {
|
|
|
15491
15494
|
}
|
|
15492
15495
|
}
|
|
15493
15496
|
}
|
|
15494
|
-
if (newStartTime !== null) {
|
|
15497
|
+
if (newStartTime !== null && newStartTime !== originalStartTime) {
|
|
15495
15498
|
newXs.startX = this._view.timeToPixels(newStartTime);
|
|
15496
15499
|
}
|
|
15497
|
-
if (newEndTime !== null) {
|
|
15500
|
+
if (newEndTime !== null && newEndTime !== originalEndTime) {
|
|
15498
15501
|
newXs.endX = this._view.timeToPixels(newEndTime);
|
|
15499
15502
|
if (this._sources[source.id].nextSourceId === null) {
|
|
15500
15503
|
newXs.updateTimelineLength = true;
|
|
15501
15504
|
}
|
|
15502
15505
|
}
|
|
15503
|
-
if (newXs.startX !== null && newXs.endX === null || newXs.startX === null && newXs.endX !== null) {
|
|
15504
|
-
newXs.updateWidth = true;
|
|
15505
|
-
}
|
|
15506
15506
|
return newXs;
|
|
15507
15507
|
};
|
|
15508
15508
|
Line.prototype.getSourcesAfter = function (time) {
|
|
@@ -20562,8 +20562,7 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
|
|
|
20562
20562
|
SourcesLayer.prototype.updateSource = function (source, newStartX, newEndX, newY) {
|
|
20563
20563
|
var newXs = {
|
|
20564
20564
|
startX: newStartX,
|
|
20565
|
-
endX: newEndX
|
|
20566
|
-
updateWidth: false
|
|
20565
|
+
endX: newEndX
|
|
20567
20566
|
};
|
|
20568
20567
|
if (this._peaks.options.canMoveSourcesBetweenLines) {
|
|
20569
20568
|
this.manageVerticalPosition(source, newY);
|
|
@@ -20572,7 +20571,7 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
|
|
|
20572
20571
|
newXs = this.manageCollision(source, newXs.startX, newXs.endX);
|
|
20573
20572
|
source.updateTimes(newXs.startX !== null ? this._view.pixelsToTime(newXs.startX) : null, newXs.endX !== null ? this._view.pixelsToTime(newXs.endX) : null);
|
|
20574
20573
|
if (newXs) {
|
|
20575
|
-
this._updateSource(source
|
|
20574
|
+
this._updateSource(source);
|
|
20576
20575
|
return true;
|
|
20577
20576
|
}
|
|
20578
20577
|
return false;
|
|
@@ -21711,7 +21710,7 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
21711
21710
|
this.updateTimeline(this.timeToPixels(time));
|
|
21712
21711
|
};
|
|
21713
21712
|
TimelineZoomView.prototype.timeToPixels = function (time) {
|
|
21714
|
-
return
|
|
21713
|
+
return Utils.roundTime(time) * this._timeToPixelsScale;
|
|
21715
21714
|
};
|
|
21716
21715
|
TimelineZoomView.prototype.pixelsToTime = function (pixels) {
|
|
21717
21716
|
return Utils.roundTime(pixels / this._timeToPixelsScale);
|
package/src/line.js
CHANGED
|
@@ -535,22 +535,23 @@ define([
|
|
|
535
535
|
};
|
|
536
536
|
|
|
537
537
|
Line.prototype.manageCollision = function(source, newStartX, newEndX) {
|
|
538
|
+
var originalStartTime = null;
|
|
539
|
+
var originalEndTime = null;
|
|
538
540
|
var newStartTime = null;
|
|
539
541
|
var newEndTime = null;
|
|
540
542
|
var startLimited = false;
|
|
541
543
|
var endLimited = false;
|
|
542
|
-
var timeWidth = this._view.pixelsToTime(newEndX - newStartX);
|
|
543
544
|
|
|
544
545
|
var newXs = {
|
|
545
546
|
startX: newStartX,
|
|
546
547
|
endX: newEndX,
|
|
547
|
-
updateWidth: false,
|
|
548
548
|
updateTimelineLength: false
|
|
549
549
|
};
|
|
550
550
|
|
|
551
551
|
if (newStartX !== null) {
|
|
552
552
|
// startMarker changed
|
|
553
|
-
|
|
553
|
+
originalStartTime = this._view.pixelsToTime(newStartX);
|
|
554
|
+
newStartTime = originalStartTime;
|
|
554
555
|
|
|
555
556
|
if (source.startTime > newStartTime) {
|
|
556
557
|
// startMarker moved to the left
|
|
@@ -576,7 +577,8 @@ define([
|
|
|
576
577
|
|
|
577
578
|
if (newEndX !== null) {
|
|
578
579
|
// endMarker changed
|
|
579
|
-
|
|
580
|
+
originalEndTime = this._view.pixelsToTime(newEndX);
|
|
581
|
+
newEndTime = originalEndTime;
|
|
580
582
|
|
|
581
583
|
if (source.endTime < newEndTime) {
|
|
582
584
|
// endMarker moved to the right
|
|
@@ -596,6 +598,8 @@ define([
|
|
|
596
598
|
|
|
597
599
|
// Update the other edge if dragging and collision
|
|
598
600
|
if (newStartTime !== null && newEndTime !== null) {
|
|
601
|
+
var timeWidth = Utils.roundTime(originalEndTime - originalStartTime);
|
|
602
|
+
|
|
599
603
|
if (startLimited) {
|
|
600
604
|
newEndTime = newStartTime + timeWidth;
|
|
601
605
|
}
|
|
@@ -627,11 +631,11 @@ define([
|
|
|
627
631
|
}
|
|
628
632
|
}
|
|
629
633
|
|
|
630
|
-
if (newStartTime !== null) {
|
|
634
|
+
if (newStartTime !== null && newStartTime !== originalStartTime) {
|
|
631
635
|
newXs.startX = this._view.timeToPixels(newStartTime);
|
|
632
636
|
}
|
|
633
637
|
|
|
634
|
-
if (newEndTime !== null) {
|
|
638
|
+
if (newEndTime !== null && newEndTime !== originalEndTime) {
|
|
635
639
|
newXs.endX = this._view.timeToPixels(newEndTime);
|
|
636
640
|
|
|
637
641
|
if (this._sources[source.id].nextSourceId === null) {
|
|
@@ -639,11 +643,6 @@ define([
|
|
|
639
643
|
}
|
|
640
644
|
}
|
|
641
645
|
|
|
642
|
-
if ((newXs.startX !== null && newXs.endX === null)
|
|
643
|
-
|| (newXs.startX === null && newXs.endX !== null)) {
|
|
644
|
-
newXs.updateWidth = true;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
646
|
return newXs;
|
|
648
647
|
};
|
|
649
648
|
|
package/src/sources-layer.js
CHANGED
|
@@ -438,8 +438,7 @@ define([
|
|
|
438
438
|
SourcesLayer.prototype.updateSource = function(source, newStartX, newEndX, newY) {
|
|
439
439
|
var newXs = {
|
|
440
440
|
startX: newStartX,
|
|
441
|
-
endX: newEndX
|
|
442
|
-
updateWidth: false
|
|
441
|
+
endX: newEndX
|
|
443
442
|
};
|
|
444
443
|
|
|
445
444
|
if (this._peaks.options.canMoveSourcesBetweenLines) {
|
|
@@ -457,8 +456,7 @@ define([
|
|
|
457
456
|
|
|
458
457
|
if (newXs) {
|
|
459
458
|
this._updateSource(
|
|
460
|
-
source
|
|
461
|
-
newXs.updateWidth
|
|
459
|
+
source
|
|
462
460
|
);
|
|
463
461
|
|
|
464
462
|
return true;
|
package/src/timeline-zoomview.js
CHANGED