@checksub_team/peaks_timeline 1.4.50 → 1.4.52
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 +33 -14
- package/src/line-indicator.js +16 -8
- package/src/lines.js +4 -0
- package/src/segment.js +1 -5
- package/src/sources-layer.js +4 -0
- package/src/timeline-zoomview.js +14 -9
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -14305,7 +14305,7 @@ module.exports = function (Konva, Utils) {
|
|
|
14305
14305
|
this._layer = new Konva.Layer();
|
|
14306
14306
|
this._stage.add(this._layer);
|
|
14307
14307
|
this._indicators = {};
|
|
14308
|
-
this.
|
|
14308
|
+
this._separatingLine = new Konva.Line({
|
|
14309
14309
|
points: [
|
|
14310
14310
|
this._width,
|
|
14311
14311
|
0,
|
|
@@ -14315,7 +14315,8 @@ module.exports = function (Konva, Utils) {
|
|
|
14315
14315
|
stroke: 'gray',
|
|
14316
14316
|
strokeWidth: 1,
|
|
14317
14317
|
listening: false
|
|
14318
|
-
})
|
|
14318
|
+
});
|
|
14319
|
+
this._layer.add(this._separatingLine);
|
|
14319
14320
|
this._layer.draw();
|
|
14320
14321
|
if (this._peaks.options.enableLineIndicatorContextMenu) {
|
|
14321
14322
|
this._createContextMenu();
|
|
@@ -14330,6 +14331,16 @@ module.exports = function (Konva, Utils) {
|
|
|
14330
14331
|
'noVolume'
|
|
14331
14332
|
];
|
|
14332
14333
|
}
|
|
14334
|
+
LineIndicator.prototype.fitToView = function () {
|
|
14335
|
+
this._height = this._view.getHeight();
|
|
14336
|
+
this._stage.height(this._height);
|
|
14337
|
+
this._separatingLine.points([
|
|
14338
|
+
this._width,
|
|
14339
|
+
0,
|
|
14340
|
+
this._width,
|
|
14341
|
+
this._height
|
|
14342
|
+
]);
|
|
14343
|
+
};
|
|
14333
14344
|
LineIndicator.prototype._onSetType = function (lineId, type) {
|
|
14334
14345
|
this.removeIndicator(lineId, true);
|
|
14335
14346
|
type = this._types.includes(type) ? type : 'default';
|
|
@@ -15038,6 +15049,9 @@ module.exports = function (SegmentsGroup, Line, LineIndicator, Utils) {
|
|
|
15038
15049
|
this._peaks.on('segments.remove_all', this._onSegmentsRemoveAll.bind(this));
|
|
15039
15050
|
this._peaks.on('segments.dragend', this._onSegmentUpdated.bind(this));
|
|
15040
15051
|
}
|
|
15052
|
+
Lines.prototype.fitToView = function () {
|
|
15053
|
+
this._lineIndicator.fitToView();
|
|
15054
|
+
};
|
|
15041
15055
|
Lines.prototype._onSegmentsAdd = function (segments) {
|
|
15042
15056
|
var self = this;
|
|
15043
15057
|
segments.forEach(function (segment) {
|
|
@@ -16882,7 +16896,7 @@ module.exports = function (Utils) {
|
|
|
16882
16896
|
indicators: this.indicators
|
|
16883
16897
|
};
|
|
16884
16898
|
Utils.extend(opts, options);
|
|
16885
|
-
|
|
16899
|
+
validateSegment(this._peaks, opts, 'update()');
|
|
16886
16900
|
this._startTime = opts.startTime;
|
|
16887
16901
|
this._endTime = opts.endTime;
|
|
16888
16902
|
this._labelText = opts.labelText;
|
|
@@ -16896,9 +16910,6 @@ module.exports = function (Utils) {
|
|
|
16896
16910
|
this._line = opts.line;
|
|
16897
16911
|
this._indicators = opts.indicators;
|
|
16898
16912
|
this._peaks.emit('segment.updated', this);
|
|
16899
|
-
if (shouldNotifyUpdate) {
|
|
16900
|
-
this._peaks.emit('segments.updated', [this]);
|
|
16901
|
-
}
|
|
16902
16913
|
};
|
|
16903
16914
|
Segment.prototype.isVisible = function (startTime, endTime) {
|
|
16904
16915
|
return this.startTime < endTime && startTime < this.endTime;
|
|
@@ -18697,6 +18708,9 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
|
|
|
18697
18708
|
this._peaks.on('segments.show', this._onSegmentsShow.bind(this));
|
|
18698
18709
|
this._peaks.on('options.set.line_height', this._onOptionsLineHeightChange.bind(this));
|
|
18699
18710
|
}
|
|
18711
|
+
SourcesLayer.prototype.fitToView = function () {
|
|
18712
|
+
this._lines.fitToView();
|
|
18713
|
+
};
|
|
18700
18714
|
SourcesLayer.prototype.getLoadedData = function (id) {
|
|
18701
18715
|
return this._loadedData[id];
|
|
18702
18716
|
};
|
|
@@ -20003,18 +20017,23 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
20003
20017
|
if (this._container.clientWidth === 0 && this._container.clientHeight === 0) {
|
|
20004
20018
|
return;
|
|
20005
20019
|
}
|
|
20006
|
-
var
|
|
20007
|
-
if (this._container.clientWidth !== this._width) {
|
|
20008
|
-
this._width = this._container.clientWidth;
|
|
20020
|
+
var shouldUpdate = false;
|
|
20021
|
+
if (this._container.clientWidth - this._peaks.options.lineIndicatorWidth !== this._width) {
|
|
20022
|
+
this._width = this._container.clientWidth - this._peaks.options.lineIndicatorWidth;
|
|
20009
20023
|
this._stage.width(this._width);
|
|
20024
|
+
shouldUpdate = true;
|
|
20010
20025
|
}
|
|
20011
|
-
this.
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20026
|
+
if (this._container.clientHeight !== this._height) {
|
|
20027
|
+
this._height = this._container.clientHeight;
|
|
20028
|
+
this._stage.height(this._height);
|
|
20029
|
+
shouldUpdate = true;
|
|
20030
|
+
}
|
|
20031
|
+
if (shouldUpdate) {
|
|
20032
|
+
this._sourcesLayer.fitToView();
|
|
20033
|
+
this._playheadLayer.fitToView();
|
|
20015
20034
|
this.updateTimeline(this._frameOffset);
|
|
20035
|
+
this._stage.draw();
|
|
20016
20036
|
}
|
|
20017
|
-
this._stage.draw();
|
|
20018
20037
|
};
|
|
20019
20038
|
TimelineZoomView.prototype.destroy = function () {
|
|
20020
20039
|
if (this._resizeTimeoutId) {
|
package/src/line-indicator.js
CHANGED
|
@@ -44,14 +44,14 @@ define([
|
|
|
44
44
|
|
|
45
45
|
this._indicators = {};
|
|
46
46
|
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
);
|
|
47
|
+
this._separatingLine = new Konva.Line({
|
|
48
|
+
points: [this._width, 0, this._width, this._height],
|
|
49
|
+
stroke: 'gray',
|
|
50
|
+
strokeWidth: 1,
|
|
51
|
+
listening: false
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
this._layer.add(this._separatingLine);
|
|
55
55
|
|
|
56
56
|
this._layer.draw();
|
|
57
57
|
|
|
@@ -70,6 +70,14 @@ define([
|
|
|
70
70
|
this._types = ['default', 'volume', 'noVolume'];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
LineIndicator.prototype.fitToView = function() {
|
|
74
|
+
this._height = this._view.getHeight();
|
|
75
|
+
|
|
76
|
+
this._stage.height(this._height);
|
|
77
|
+
|
|
78
|
+
this._separatingLine.points([this._width, 0, this._width, this._height]);
|
|
79
|
+
};
|
|
80
|
+
|
|
73
81
|
LineIndicator.prototype._onSetType = function(lineId, type) {
|
|
74
82
|
this.removeIndicator(lineId, true);
|
|
75
83
|
|
package/src/lines.js
CHANGED
|
@@ -50,6 +50,10 @@ define([
|
|
|
50
50
|
this._peaks.on('segments.dragend', this._onSegmentUpdated.bind(this));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
Lines.prototype.fitToView = function() {
|
|
54
|
+
this._lineIndicator.fitToView();
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
Lines.prototype._onSegmentsAdd = function(segments) {
|
|
54
58
|
var self = this;
|
|
55
59
|
|
package/src/segment.js
CHANGED
|
@@ -250,7 +250,7 @@ define([
|
|
|
250
250
|
|
|
251
251
|
Utils.extend(opts, options);
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
validateSegment(this._peaks, opts, 'update()');
|
|
254
254
|
|
|
255
255
|
this._startTime = opts.startTime;
|
|
256
256
|
this._endTime = opts.endTime;
|
|
@@ -266,10 +266,6 @@ define([
|
|
|
266
266
|
this._indicators = opts.indicators;
|
|
267
267
|
|
|
268
268
|
this._peaks.emit('segment.updated', this);
|
|
269
|
-
|
|
270
|
-
if (shouldNotifyUpdate) {
|
|
271
|
-
this._peaks.emit('segments.updated', [this]);
|
|
272
|
-
}
|
|
273
269
|
};
|
|
274
270
|
|
|
275
271
|
/**
|
package/src/sources-layer.js
CHANGED
|
@@ -60,6 +60,10 @@ define([
|
|
|
60
60
|
this._peaks.on('options.set.line_height', this._onOptionsLineHeightChange.bind(this));
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
SourcesLayer.prototype.fitToView = function() {
|
|
64
|
+
this._lines.fitToView();
|
|
65
|
+
};
|
|
66
|
+
|
|
63
67
|
SourcesLayer.prototype.getLoadedData = function(id) {
|
|
64
68
|
return this._loadedData[id];
|
|
65
69
|
};
|
package/src/timeline-zoomview.js
CHANGED
|
@@ -836,23 +836,28 @@ define([
|
|
|
836
836
|
return;
|
|
837
837
|
}
|
|
838
838
|
|
|
839
|
-
var
|
|
839
|
+
var shouldUpdate = false;
|
|
840
840
|
|
|
841
|
-
if (this._container.clientWidth !== this._width) {
|
|
842
|
-
this._width = this._container.clientWidth;
|
|
841
|
+
if (this._container.clientWidth - this._peaks.options.lineIndicatorWidth !== this._width) {
|
|
842
|
+
this._width = this._container.clientWidth - this._peaks.options.lineIndicatorWidth;
|
|
843
843
|
this._stage.width(this._width);
|
|
844
|
+
shouldUpdate = true;
|
|
844
845
|
}
|
|
845
846
|
|
|
846
|
-
this.
|
|
847
|
-
|
|
847
|
+
if (this._container.clientHeight !== this._height) {
|
|
848
|
+
this._height = this._container.clientHeight;
|
|
849
|
+
this._stage.height(this._height);
|
|
850
|
+
shouldUpdate = true;
|
|
851
|
+
}
|
|
848
852
|
|
|
849
|
-
|
|
853
|
+
if (shouldUpdate) {
|
|
854
|
+
this._sourcesLayer.fitToView();
|
|
855
|
+
this._playheadLayer.fitToView();
|
|
850
856
|
|
|
851
|
-
if (updateTimeline) {
|
|
852
857
|
this.updateTimeline(this._frameOffset);
|
|
853
|
-
}
|
|
854
858
|
|
|
855
|
-
|
|
859
|
+
this._stage.draw();
|
|
860
|
+
}
|
|
856
861
|
};
|
|
857
862
|
|
|
858
863
|
TimelineZoomView.prototype.destroy = function() {
|