@checksub_team/peaks_timeline 1.9.5 → 1.9.6
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 +65 -36
- package/src/main.js +4 -4
- package/src/mode-layer.js +27 -23
- package/src/segment.js +11 -1
- package/src/source-group.js +5 -5
- package/src/source.js +10 -5
- package/src/sources-layer.js +13 -0
- package/src/timeline-zoomview.js +2 -2
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15589,8 +15589,8 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15589
15589
|
Peaks.prototype.addSource = function (source) {
|
|
15590
15590
|
this.sources.add(source);
|
|
15591
15591
|
};
|
|
15592
|
-
Peaks.prototype.destroySource = function (sourceId) {
|
|
15593
|
-
this.sources.destroyById(sourceId);
|
|
15592
|
+
Peaks.prototype.destroySource = function (sourceId, notify) {
|
|
15593
|
+
this.sources.destroyById(sourceId, !notify);
|
|
15594
15594
|
};
|
|
15595
15595
|
Peaks.prototype.showSource = function (sourceId) {
|
|
15596
15596
|
this.sources.showById(sourceId);
|
|
@@ -15639,8 +15639,8 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
|
|
|
15639
15639
|
Peaks.prototype.selectSourcesOnLineAfter = function (lineId, time) {
|
|
15640
15640
|
return this.view.selectSourcesOnLineAfter(lineId, time);
|
|
15641
15641
|
};
|
|
15642
|
-
Peaks.prototype.deselectAll = function () {
|
|
15643
|
-
return this.view.deselectAll();
|
|
15642
|
+
Peaks.prototype.deselectAll = function (notify) {
|
|
15643
|
+
return this.view.deselectAll(notify);
|
|
15644
15644
|
};
|
|
15645
15645
|
Peaks.prototype._addWindowResizeHandler = function () {
|
|
15646
15646
|
this._onResize = this._onResize.bind(this);
|
|
@@ -15753,25 +15753,27 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15753
15753
|
const sources = [];
|
|
15754
15754
|
const segments = [];
|
|
15755
15755
|
const self = this;
|
|
15756
|
-
this.deselectDifference(elements,
|
|
15756
|
+
this.deselectDifference(elements, false);
|
|
15757
15757
|
elements.forEach(function (element) {
|
|
15758
15758
|
if (!self._selectedElements[element.id]) {
|
|
15759
15759
|
self._selectedElements[element.id] = element;
|
|
15760
|
-
element.
|
|
15761
|
-
if (
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
|
|
15765
|
-
segments.push(element);
|
|
15766
|
-
}
|
|
15760
|
+
element.selected = true;
|
|
15761
|
+
if (element instanceof Source) {
|
|
15762
|
+
sources.push(element);
|
|
15763
|
+
} else {
|
|
15764
|
+
segments.push(element);
|
|
15767
15765
|
}
|
|
15768
15766
|
}
|
|
15769
15767
|
});
|
|
15770
|
-
if (
|
|
15771
|
-
|
|
15768
|
+
if (sources.length) {
|
|
15769
|
+
this._peaks.emit('sources.setSelected', sources);
|
|
15770
|
+
if (notify) {
|
|
15772
15771
|
this._peaks.emit('sources.selected', sources);
|
|
15773
15772
|
}
|
|
15774
|
-
|
|
15773
|
+
}
|
|
15774
|
+
if (segments.length) {
|
|
15775
|
+
this._peaks.emit('segments.setSelected', segments);
|
|
15776
|
+
if (notify) {
|
|
15775
15777
|
this._peaks.emit('segments.selected', segments);
|
|
15776
15778
|
}
|
|
15777
15779
|
}
|
|
@@ -15789,22 +15791,24 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15789
15791
|
for (var id in elements) {
|
|
15790
15792
|
if (Utils.objectHasProperty(this._selectedElements, id)) {
|
|
15791
15793
|
const element = this._selectedElements[id];
|
|
15792
|
-
element.
|
|
15793
|
-
if (
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
segments.push(element);
|
|
15798
|
-
}
|
|
15794
|
+
element.selected = false;
|
|
15795
|
+
if (element instanceof Source) {
|
|
15796
|
+
sources.push(element);
|
|
15797
|
+
} else {
|
|
15798
|
+
segments.push(element);
|
|
15799
15799
|
}
|
|
15800
15800
|
delete this._selectedElements[id];
|
|
15801
15801
|
}
|
|
15802
15802
|
}
|
|
15803
|
-
if (
|
|
15804
|
-
|
|
15803
|
+
if (sources.length) {
|
|
15804
|
+
this._peaks.emit('sources.setSelected', sources);
|
|
15805
|
+
if (notify) {
|
|
15805
15806
|
this._peaks.emit('sources.deselected', sources);
|
|
15806
15807
|
}
|
|
15807
|
-
|
|
15808
|
+
}
|
|
15809
|
+
if (segments.length) {
|
|
15810
|
+
this._peaks.emit('segments.setSelected', segments);
|
|
15811
|
+
if (notify) {
|
|
15808
15812
|
this._peaks.emit('segments.deselected', segments);
|
|
15809
15813
|
}
|
|
15810
15814
|
}
|
|
@@ -17060,6 +17064,15 @@ module.exports = function (Utils) {
|
|
|
17060
17064
|
set: function (newId) {
|
|
17061
17065
|
this._relativeId = newId;
|
|
17062
17066
|
}
|
|
17067
|
+
},
|
|
17068
|
+
selected: {
|
|
17069
|
+
enumerable: true,
|
|
17070
|
+
get: function () {
|
|
17071
|
+
return this._selected;
|
|
17072
|
+
},
|
|
17073
|
+
set: function (selected) {
|
|
17074
|
+
this._selected = selected;
|
|
17075
|
+
}
|
|
17063
17076
|
}
|
|
17064
17077
|
});
|
|
17065
17078
|
Segment.prototype.update = function (options) {
|
|
@@ -17105,6 +17118,7 @@ module.exports = function (Utils) {
|
|
|
17105
17118
|
};
|
|
17106
17119
|
Segment.prototype.setSelected = function (selected) {
|
|
17107
17120
|
this._selected = selected;
|
|
17121
|
+
this._peaks.emit('segment.selected', this);
|
|
17108
17122
|
};
|
|
17109
17123
|
Segment.prototype.isVisible = function (startTime, endTime) {
|
|
17110
17124
|
return this.startTime < endTime && startTime < this.endTime;
|
|
@@ -17699,7 +17713,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17699
17713
|
}
|
|
17700
17714
|
this._addHandles();
|
|
17701
17715
|
this.setWrapping(source.wrapped);
|
|
17702
|
-
this.
|
|
17716
|
+
this.setSelected();
|
|
17703
17717
|
this._indicatorsGroup = new Konva.Group();
|
|
17704
17718
|
this._group.add(this._indicatorsGroup);
|
|
17705
17719
|
this.createIndicators();
|
|
@@ -18162,9 +18176,9 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18162
18176
|
return preview.type === 'audio';
|
|
18163
18177
|
});
|
|
18164
18178
|
};
|
|
18165
|
-
SourceGroup.prototype.
|
|
18179
|
+
SourceGroup.prototype.setSelected = function () {
|
|
18166
18180
|
if (this._border) {
|
|
18167
|
-
if (this._source.
|
|
18181
|
+
if (this._source.selected) {
|
|
18168
18182
|
this._border.fill(this._source.selectedColor);
|
|
18169
18183
|
this._borderWidth = this._peaks.options.sourceSelectedBorderWidth;
|
|
18170
18184
|
} else {
|
|
@@ -18177,7 +18191,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18177
18191
|
return node.getClassName() === 'Shape';
|
|
18178
18192
|
});
|
|
18179
18193
|
if (unwrap_background) {
|
|
18180
|
-
if (this._source.
|
|
18194
|
+
if (this._source.selected) {
|
|
18181
18195
|
unwrap_background.stroke(this._source.selectedColor);
|
|
18182
18196
|
unwrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
18183
18197
|
} else {
|
|
@@ -18190,7 +18204,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18190
18204
|
return node.getClassName() === 'Shape';
|
|
18191
18205
|
});
|
|
18192
18206
|
if (wrap_background) {
|
|
18193
|
-
if (this._source.
|
|
18207
|
+
if (this._source.selected) {
|
|
18194
18208
|
wrap_background.stroke(this._source.selectedColor);
|
|
18195
18209
|
wrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
18196
18210
|
} else {
|
|
@@ -18898,6 +18912,15 @@ module.exports = function (Utils) {
|
|
|
18898
18912
|
get: function () {
|
|
18899
18913
|
return this._minSize;
|
|
18900
18914
|
}
|
|
18915
|
+
},
|
|
18916
|
+
selected: {
|
|
18917
|
+
enumerable: true,
|
|
18918
|
+
get: function () {
|
|
18919
|
+
return this._selected;
|
|
18920
|
+
},
|
|
18921
|
+
set: function (selected) {
|
|
18922
|
+
this._selected = selected;
|
|
18923
|
+
}
|
|
18901
18924
|
}
|
|
18902
18925
|
});
|
|
18903
18926
|
Source.prototype.updateTimes = function (newStartTime, newEndTime) {
|
|
@@ -19057,10 +19080,6 @@ module.exports = function (Utils) {
|
|
|
19057
19080
|
this._indicators = opts.indicators;
|
|
19058
19081
|
this._peaks.emit('source.update', this);
|
|
19059
19082
|
};
|
|
19060
|
-
Source.prototype.setSelected = function (selected) {
|
|
19061
|
-
this._selected = selected;
|
|
19062
|
-
this._peaks.emit('source.update', this);
|
|
19063
|
-
};
|
|
19064
19083
|
Source.prototype.isVisible = function (startTime, endTime) {
|
|
19065
19084
|
return this._startTime < endTime && startTime < this._endTime;
|
|
19066
19085
|
};
|
|
@@ -19088,6 +19107,7 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
|
|
|
19088
19107
|
this._peaks.on('sources.destroy', this._onSourcesDestroy.bind(this));
|
|
19089
19108
|
this._peaks.on('sources.show', this._onSourcesShow.bind(this));
|
|
19090
19109
|
this._peaks.on('sources.hide', this._onSourcesHide.bind(this));
|
|
19110
|
+
this._peaks.on('sources.setSelected', this._onSourcesSetSelected.bind(this));
|
|
19091
19111
|
this._peaks.on('source.update', this._onSourceUpdate.bind(this));
|
|
19092
19112
|
this._peaks.on('data.retrieved', this._onDataRetrieved.bind(this));
|
|
19093
19113
|
this._peaks.on('sources.refresh', this._onSourcesRefresh.bind(this));
|
|
@@ -19157,6 +19177,15 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
|
|
|
19157
19177
|
this.updateSources(frameStartTime, frameEndTime);
|
|
19158
19178
|
}
|
|
19159
19179
|
};
|
|
19180
|
+
SourcesLayer.prototype._onSourcesSetSelected = function (sources) {
|
|
19181
|
+
sources.forEach(function (source) {
|
|
19182
|
+
const sourceGroup = this._sourcesGroup[source.id];
|
|
19183
|
+
if (sourceGroup) {
|
|
19184
|
+
sourceGroup.setSelected();
|
|
19185
|
+
}
|
|
19186
|
+
}.bind(this));
|
|
19187
|
+
this.draw();
|
|
19188
|
+
};
|
|
19160
19189
|
SourcesLayer.prototype._onSourcesShow = function (sources) {
|
|
19161
19190
|
var self = this;
|
|
19162
19191
|
sources.forEach(function (source) {
|
|
@@ -20248,8 +20277,8 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
20248
20277
|
this._modeLayer.selectElements(sources, false);
|
|
20249
20278
|
}
|
|
20250
20279
|
};
|
|
20251
|
-
TimelineZoomView.prototype.deselectAll = function () {
|
|
20252
|
-
this._modeLayer.deselectDifference([],
|
|
20280
|
+
TimelineZoomView.prototype.deselectAll = function (notify) {
|
|
20281
|
+
this._modeLayer.deselectDifference([], notify);
|
|
20253
20282
|
};
|
|
20254
20283
|
TimelineZoomView.prototype.isListening = function () {
|
|
20255
20284
|
return this._stage.listening();
|
package/src/main.js
CHANGED
|
@@ -637,8 +637,8 @@ define([
|
|
|
637
637
|
* @param {String} sourceId
|
|
638
638
|
*/
|
|
639
639
|
|
|
640
|
-
Peaks.prototype.destroySource = function(sourceId) {
|
|
641
|
-
this.sources.destroyById(sourceId);
|
|
640
|
+
Peaks.prototype.destroySource = function(sourceId, notify) {
|
|
641
|
+
this.sources.destroyById(sourceId, !notify);
|
|
642
642
|
};
|
|
643
643
|
|
|
644
644
|
/**
|
|
@@ -730,9 +730,9 @@ define([
|
|
|
730
730
|
.selectSourcesOnLineAfter(lineId, time);
|
|
731
731
|
};
|
|
732
732
|
|
|
733
|
-
Peaks.prototype.deselectAll = function() {
|
|
733
|
+
Peaks.prototype.deselectAll = function(notify) {
|
|
734
734
|
return this.view
|
|
735
|
-
.deselectAll();
|
|
735
|
+
.deselectAll(notify);
|
|
736
736
|
};
|
|
737
737
|
|
|
738
738
|
Peaks.prototype._addWindowResizeHandler = function() {
|
package/src/mode-layer.js
CHANGED
|
@@ -86,28 +86,30 @@ define([
|
|
|
86
86
|
const segments = [];
|
|
87
87
|
const self = this;
|
|
88
88
|
|
|
89
|
-
this.deselectDifference(elements,
|
|
89
|
+
this.deselectDifference(elements, false);
|
|
90
90
|
|
|
91
91
|
elements.forEach(function(element) {
|
|
92
92
|
if (!self._selectedElements[element.id]) {
|
|
93
93
|
self._selectedElements[element.id] = element;
|
|
94
|
-
element.
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
segments.push(element);
|
|
101
|
-
}
|
|
94
|
+
element.selected = true;
|
|
95
|
+
if (element instanceof Source) {
|
|
96
|
+
sources.push(element);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
segments.push(element);
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
});
|
|
105
103
|
|
|
106
|
-
if (
|
|
107
|
-
|
|
104
|
+
if (sources.length) {
|
|
105
|
+
this._peaks.emit('sources.setSelected', sources);
|
|
106
|
+
if (notify) {
|
|
108
107
|
this._peaks.emit('sources.selected', sources);
|
|
109
108
|
}
|
|
110
|
-
|
|
109
|
+
}
|
|
110
|
+
if (segments.length) {
|
|
111
|
+
this._peaks.emit('segments.setSelected', segments);
|
|
112
|
+
if (notify) {
|
|
111
113
|
this._peaks.emit('segments.selected', segments);
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -131,24 +133,26 @@ define([
|
|
|
131
133
|
if (Utils.objectHasProperty(this._selectedElements, id)) {
|
|
132
134
|
const element = this._selectedElements[id];
|
|
133
135
|
|
|
134
|
-
element.
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
segments.push(element);
|
|
141
|
-
}
|
|
136
|
+
element.selected = false;
|
|
137
|
+
if (element instanceof Source) {
|
|
138
|
+
sources.push(element);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
segments.push(element);
|
|
142
142
|
}
|
|
143
143
|
delete this._selectedElements[id];
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
if (
|
|
148
|
-
|
|
147
|
+
if (sources.length) {
|
|
148
|
+
this._peaks.emit('sources.setSelected', sources);
|
|
149
|
+
if (notify) {
|
|
149
150
|
this._peaks.emit('sources.deselected', sources);
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
}
|
|
153
|
+
if (segments.length) {
|
|
154
|
+
this._peaks.emit('segments.setSelected', segments);
|
|
155
|
+
if (notify) {
|
|
152
156
|
this._peaks.emit('segments.deselected', segments);
|
|
153
157
|
}
|
|
154
158
|
}
|
package/src/segment.js
CHANGED
|
@@ -292,6 +292,16 @@ define([
|
|
|
292
292
|
set: function(newId) {
|
|
293
293
|
this._relativeId = newId;
|
|
294
294
|
}
|
|
295
|
+
},
|
|
296
|
+
selected: {
|
|
297
|
+
enumerable: true,
|
|
298
|
+
get: function() {
|
|
299
|
+
return this._selected;
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
set: function(selected) {
|
|
303
|
+
this._selected = selected;
|
|
304
|
+
}
|
|
295
305
|
}
|
|
296
306
|
});
|
|
297
307
|
|
|
@@ -343,7 +353,7 @@ define([
|
|
|
343
353
|
|
|
344
354
|
Segment.prototype.setSelected = function(selected) {
|
|
345
355
|
this._selected = selected;
|
|
346
|
-
|
|
356
|
+
this._peaks.emit('segment.selected', this);
|
|
347
357
|
};
|
|
348
358
|
|
|
349
359
|
/**
|
package/src/source-group.js
CHANGED
|
@@ -98,7 +98,7 @@ define([
|
|
|
98
98
|
|
|
99
99
|
this.setWrapping(source.wrapped);
|
|
100
100
|
|
|
101
|
-
this.
|
|
101
|
+
this.setSelected();
|
|
102
102
|
|
|
103
103
|
this._indicatorsGroup = new Konva.Group();
|
|
104
104
|
this._group.add(this._indicatorsGroup);
|
|
@@ -741,9 +741,9 @@ define([
|
|
|
741
741
|
});
|
|
742
742
|
};
|
|
743
743
|
|
|
744
|
-
SourceGroup.prototype.
|
|
744
|
+
SourceGroup.prototype.setSelected = function() {
|
|
745
745
|
if (this._border) {
|
|
746
|
-
if (this._source.
|
|
746
|
+
if (this._source.selected) {
|
|
747
747
|
this._border.fill(this._source.selectedColor);
|
|
748
748
|
this._borderWidth = this._peaks.options.sourceSelectedBorderWidth;
|
|
749
749
|
}
|
|
@@ -760,7 +760,7 @@ define([
|
|
|
760
760
|
});
|
|
761
761
|
|
|
762
762
|
if (unwrap_background) {
|
|
763
|
-
if (this._source.
|
|
763
|
+
if (this._source.selected) {
|
|
764
764
|
unwrap_background.stroke(this._source.selectedColor);
|
|
765
765
|
unwrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
766
766
|
}
|
|
@@ -777,7 +777,7 @@ define([
|
|
|
777
777
|
});
|
|
778
778
|
|
|
779
779
|
if (wrap_background) {
|
|
780
|
-
if (this._source.
|
|
780
|
+
if (this._source.selected) {
|
|
781
781
|
wrap_background.stroke(this._source.selectedColor);
|
|
782
782
|
wrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
783
783
|
}
|
package/src/source.js
CHANGED
|
@@ -669,6 +669,16 @@ define([
|
|
|
669
669
|
get: function() {
|
|
670
670
|
return this._minSize;
|
|
671
671
|
}
|
|
672
|
+
},
|
|
673
|
+
selected: {
|
|
674
|
+
enumerable: true,
|
|
675
|
+
get: function() {
|
|
676
|
+
return this._selected;
|
|
677
|
+
},
|
|
678
|
+
|
|
679
|
+
set: function(selected) {
|
|
680
|
+
this._selected = selected;
|
|
681
|
+
}
|
|
672
682
|
}
|
|
673
683
|
});
|
|
674
684
|
|
|
@@ -865,11 +875,6 @@ define([
|
|
|
865
875
|
this._peaks.emit('source.update', this);
|
|
866
876
|
};
|
|
867
877
|
|
|
868
|
-
Source.prototype.setSelected = function(selected) {
|
|
869
|
-
this._selected = selected;
|
|
870
|
-
this._peaks.emit('source.update', this);
|
|
871
|
-
};
|
|
872
|
-
|
|
873
878
|
/**
|
|
874
879
|
* Returns <code>true</code> if the source overlaps a given time region.
|
|
875
880
|
*
|
package/src/sources-layer.js
CHANGED
|
@@ -53,6 +53,7 @@ define([
|
|
|
53
53
|
this._peaks.on('sources.destroy', this._onSourcesDestroy.bind(this));
|
|
54
54
|
this._peaks.on('sources.show', this._onSourcesShow.bind(this));
|
|
55
55
|
this._peaks.on('sources.hide', this._onSourcesHide.bind(this));
|
|
56
|
+
this._peaks.on('sources.setSelected', this._onSourcesSetSelected.bind(this));
|
|
56
57
|
this._peaks.on('source.update', this._onSourceUpdate.bind(this));
|
|
57
58
|
this._peaks.on('data.retrieved', this._onDataRetrieved.bind(this));
|
|
58
59
|
this._peaks.on('sources.refresh', this._onSourcesRefresh.bind(this));
|
|
@@ -152,6 +153,18 @@ define([
|
|
|
152
153
|
}
|
|
153
154
|
};
|
|
154
155
|
|
|
156
|
+
SourcesLayer.prototype._onSourcesSetSelected = function(sources) {
|
|
157
|
+
sources.forEach(function(source) {
|
|
158
|
+
const sourceGroup = this._sourcesGroup[source.id];
|
|
159
|
+
|
|
160
|
+
if (sourceGroup) {
|
|
161
|
+
sourceGroup.setSelected();
|
|
162
|
+
}
|
|
163
|
+
}.bind(this));
|
|
164
|
+
|
|
165
|
+
this.draw();
|
|
166
|
+
};
|
|
167
|
+
|
|
155
168
|
SourcesLayer.prototype._onSourcesShow = function(sources) {
|
|
156
169
|
var self = this;
|
|
157
170
|
|
package/src/timeline-zoomview.js
CHANGED
|
@@ -400,8 +400,8 @@ define([
|
|
|
400
400
|
}
|
|
401
401
|
};
|
|
402
402
|
|
|
403
|
-
TimelineZoomView.prototype.deselectAll = function() {
|
|
404
|
-
this._modeLayer.deselectDifference([],
|
|
403
|
+
TimelineZoomView.prototype.deselectAll = function(notify) {
|
|
404
|
+
this._modeLayer.deselectDifference([], notify);
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
TimelineZoomView.prototype.isListening = function() {
|