@checksub_team/peaks_timeline 1.4.25 → 1.4.28
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 +269 -85
- package/src/line.js +38 -1
- package/src/lines.js +62 -5
- package/src/main.js +30 -3
- package/src/mode-layer.js +47 -17
- package/src/playhead-layer.js +36 -26
- package/src/segment-shape.js +10 -1
- package/src/segment.js +30 -6
- package/src/segments-group.js +30 -16
- package/src/source.js +1 -1
- package/src/sources-layer.js +39 -8
- package/src/timeline-segments.js +7 -5
- package/src/timeline-zoomview.js +13 -1
package/src/sources-layer.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
define([
|
|
10
10
|
'./source-group',
|
|
11
|
-
'./segments-group',
|
|
12
11
|
'./lines',
|
|
13
12
|
'./data-retriever',
|
|
14
13
|
'./utils',
|
|
@@ -16,7 +15,6 @@ define([
|
|
|
16
15
|
'konva'
|
|
17
16
|
], function(
|
|
18
17
|
SourceGroup,
|
|
19
|
-
SegmentsGroup,
|
|
20
18
|
Lines,
|
|
21
19
|
DataRetriever,
|
|
22
20
|
Utils,
|
|
@@ -45,8 +43,6 @@ define([
|
|
|
45
43
|
this._lines = new Lines(peaks, view, this);
|
|
46
44
|
this._lines.addToLayer(this);
|
|
47
45
|
|
|
48
|
-
this._segmentsGroup = new SegmentsGroup(peaks, view, true);
|
|
49
|
-
|
|
50
46
|
this._loadedData = {};
|
|
51
47
|
|
|
52
48
|
this._debouncedRescale = new Invoker().debounce(
|
|
@@ -61,6 +57,7 @@ define([
|
|
|
61
57
|
this._peaks.on('data.retrieved', this._onDataRetrieved.bind(this));
|
|
62
58
|
this._peaks.on('sources.refresh', this._onSourcesRefresh.bind(this));
|
|
63
59
|
this._peaks.on('segments.show', this._onSegmentsShow.bind(this));
|
|
60
|
+
this._peaks.on('options.set.line_height', this._onOptionsLineHeightChange.bind(this));
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
SourcesLayer.prototype.getLoadedData = function(id) {
|
|
@@ -71,8 +68,8 @@ define([
|
|
|
71
68
|
this._loadedData[id] = data;
|
|
72
69
|
};
|
|
73
70
|
|
|
74
|
-
SourcesLayer.prototype.
|
|
75
|
-
return this.
|
|
71
|
+
SourcesLayer.prototype.getSegmentsGroups = function() {
|
|
72
|
+
return this._lines.getSegmentsGroups();
|
|
76
73
|
};
|
|
77
74
|
|
|
78
75
|
SourcesLayer.prototype.add = function(element) {
|
|
@@ -97,6 +94,36 @@ define([
|
|
|
97
94
|
return this._allowEditing;
|
|
98
95
|
};
|
|
99
96
|
|
|
97
|
+
SourcesLayer.prototype._onOptionsLineHeightChange = function(oldHeight) {
|
|
98
|
+
var positions = [];
|
|
99
|
+
|
|
100
|
+
for (var sourceId in this._sourcesGroup) {
|
|
101
|
+
if (Utils.objectHasProperty(this._sourcesGroup, sourceId)) {
|
|
102
|
+
var source = this._sourcesGroup[sourceId].getSource();
|
|
103
|
+
|
|
104
|
+
if (!positions.includes(source.position)) {
|
|
105
|
+
this._lines.changeLineHeight(
|
|
106
|
+
oldHeight,
|
|
107
|
+
this._peaks.options.lineHeight
|
|
108
|
+
);
|
|
109
|
+
positions.push(source.position);
|
|
110
|
+
}
|
|
111
|
+
this._removeSource(source);
|
|
112
|
+
this._addSourceGroup(source);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (positions) {
|
|
117
|
+
var frameOffset = this._view.getFrameOffset();
|
|
118
|
+
var width = this._view.getWidth();
|
|
119
|
+
|
|
120
|
+
this.updateSources(
|
|
121
|
+
this._view.pixelsToTime(frameOffset),
|
|
122
|
+
this._view.pixelsToTime(frameOffset + width)
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
100
127
|
SourcesLayer.prototype._onSourceUpdate = function(source) {
|
|
101
128
|
var redraw = false;
|
|
102
129
|
var sourceGroup = this._sourcesGroup[source.id];
|
|
@@ -211,8 +238,8 @@ define([
|
|
|
211
238
|
this._layer.draw();
|
|
212
239
|
};
|
|
213
240
|
|
|
214
|
-
SourcesLayer.prototype._onSegmentsShow = function(position) {
|
|
215
|
-
this._lines.addSegments(
|
|
241
|
+
SourcesLayer.prototype._onSegmentsShow = function(lineId, position) {
|
|
242
|
+
this._lines.addSegments(lineId, position);
|
|
216
243
|
this._view.updateTimelineLength();
|
|
217
244
|
this._layer.draw();
|
|
218
245
|
};
|
|
@@ -471,6 +498,10 @@ define([
|
|
|
471
498
|
this._layer.stopDrag();
|
|
472
499
|
};
|
|
473
500
|
|
|
501
|
+
SourcesLayer.prototype.getSourceGroupById = function(sourceId) {
|
|
502
|
+
return this._sourcesGroup[sourceId];
|
|
503
|
+
};
|
|
504
|
+
|
|
474
505
|
SourcesLayer.prototype._sourcesOverlapped = function(source1, source2) {
|
|
475
506
|
var endsLater = (source1.startTime < source2.startTime)
|
|
476
507
|
&& (source1.endTime > source2.startTime);
|
package/src/timeline-segments.js
CHANGED
|
@@ -136,7 +136,9 @@ define([
|
|
|
136
136
|
options.textColor || '#000000',
|
|
137
137
|
options.handleTextColor || '#000000',
|
|
138
138
|
options.opacity || 1,
|
|
139
|
-
true // editable
|
|
139
|
+
true, // editable
|
|
140
|
+
options.allowDeletion || false,
|
|
141
|
+
options.line
|
|
140
142
|
);
|
|
141
143
|
|
|
142
144
|
return segment;
|
|
@@ -156,8 +158,8 @@ define([
|
|
|
156
158
|
* Add segments to the given line so they can be displayed.
|
|
157
159
|
*/
|
|
158
160
|
|
|
159
|
-
TimelineSegments.prototype.addSegmentsToPosition = function(position) {
|
|
160
|
-
this._peaks.emit('segments.show', position);
|
|
161
|
+
TimelineSegments.prototype.addSegmentsToPosition = function(lineId, position) {
|
|
162
|
+
this._peaks.emit('segments.show', lineId, position);
|
|
161
163
|
};
|
|
162
164
|
|
|
163
165
|
/**
|
|
@@ -379,10 +381,10 @@ define([
|
|
|
379
381
|
* <code>segments.remove_all</code> event.
|
|
380
382
|
*/
|
|
381
383
|
|
|
382
|
-
TimelineSegments.prototype.removeAll = function() {
|
|
384
|
+
TimelineSegments.prototype.removeAll = function(lineId) {
|
|
383
385
|
this._segments = [];
|
|
384
386
|
this._segmentsById = {};
|
|
385
|
-
this._peaks.emit('segments.remove_all');
|
|
387
|
+
this._peaks.emit('segments.remove_all', lineId);
|
|
386
388
|
};
|
|
387
389
|
|
|
388
390
|
return TimelineSegments;
|
package/src/timeline-zoomview.js
CHANGED
|
@@ -131,7 +131,7 @@ define([
|
|
|
131
131
|
self._playheadLayer = new PlayheadLayer(
|
|
132
132
|
peaks,
|
|
133
133
|
self,
|
|
134
|
-
self._sourcesLayer
|
|
134
|
+
self._sourcesLayer,
|
|
135
135
|
self._options.showPlayheadTime
|
|
136
136
|
);
|
|
137
137
|
|
|
@@ -361,6 +361,18 @@ define([
|
|
|
361
361
|
this._sourcesLayer.draw();
|
|
362
362
|
};
|
|
363
363
|
|
|
364
|
+
TimelineZoomView.prototype.selectSourceById = function(sourceId) {
|
|
365
|
+
var sourceGroup = this._sourcesLayer.getSourceGroupById(sourceId);
|
|
366
|
+
|
|
367
|
+
if (sourceGroup) {
|
|
368
|
+
this._modeLayer.selectElement(sourceGroup, false);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
TimelineZoomView.prototype.deselectElement = function() {
|
|
373
|
+
this._modeLayer.deselectElement(false);
|
|
374
|
+
};
|
|
375
|
+
|
|
364
376
|
TimelineZoomView.prototype.isListening = function() {
|
|
365
377
|
return this._stage.listening();
|
|
366
378
|
};
|