@checksub_team/peaks_timeline 1.9.4 → 1.9.5-beta.10
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 +46 -22
- package/src/main.js +4 -4
- package/src/mode-layer.js +25 -6
- package/src/segment.js +10 -5
- package/src/source-group.js +3 -4
- package/src/source.js +10 -5
- 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);
|
|
@@ -15735,7 +15735,17 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15735
15735
|
this._onMouseLeaveInCutMode = this._onMouseLeaveInCutMode.bind(this);
|
|
15736
15736
|
this._onMouseClickInCutMode = this._onMouseClickInCutMode.bind(this);
|
|
15737
15737
|
this.setMode(initialMode);
|
|
15738
|
+
this._peaks.on('sources.destroy', this._onSourcesDestroy.bind(this));
|
|
15738
15739
|
}
|
|
15740
|
+
ModeLayer.prototype._onSourcesDestroy = function (sources) {
|
|
15741
|
+
const selectedElementsToDeselect = {};
|
|
15742
|
+
sources.forEach(function (source) {
|
|
15743
|
+
if (this._selectedElements[source.id]) {
|
|
15744
|
+
selectedElementsToDeselect[source.id] = source;
|
|
15745
|
+
}
|
|
15746
|
+
}.bind(this));
|
|
15747
|
+
this._deselectElements(selectedElementsToDeselect, false);
|
|
15748
|
+
};
|
|
15739
15749
|
ModeLayer.prototype.addToStage = function (stage) {
|
|
15740
15750
|
stage.add(this._layer);
|
|
15741
15751
|
};
|
|
@@ -15743,11 +15753,11 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15743
15753
|
const sources = [];
|
|
15744
15754
|
const segments = [];
|
|
15745
15755
|
const self = this;
|
|
15746
|
-
this.deselectDifference(elements,
|
|
15756
|
+
this.deselectDifference(elements, false);
|
|
15747
15757
|
elements.forEach(function (element) {
|
|
15748
15758
|
if (!self._selectedElements[element.id]) {
|
|
15749
15759
|
self._selectedElements[element.id] = element;
|
|
15750
|
-
element.
|
|
15760
|
+
element.selected = true;
|
|
15751
15761
|
if (notify) {
|
|
15752
15762
|
if (element instanceof Source) {
|
|
15753
15763
|
sources.push(element);
|
|
@@ -15767,16 +15777,19 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15767
15777
|
}
|
|
15768
15778
|
};
|
|
15769
15779
|
ModeLayer.prototype.deselectDifference = function (newElements, notify) {
|
|
15770
|
-
const sources = [];
|
|
15771
|
-
const segments = [];
|
|
15772
15780
|
const selectedElementsToDeselect = Object.assign({}, this._selectedElements);
|
|
15773
15781
|
newElements.forEach(function (element) {
|
|
15774
15782
|
delete selectedElementsToDeselect[element.id];
|
|
15775
15783
|
});
|
|
15776
|
-
|
|
15784
|
+
this._deselectElements(selectedElementsToDeselect, notify);
|
|
15785
|
+
};
|
|
15786
|
+
ModeLayer.prototype._deselectElements = function (elements, notify) {
|
|
15787
|
+
const sources = [];
|
|
15788
|
+
const segments = [];
|
|
15789
|
+
for (var id in elements) {
|
|
15777
15790
|
if (Utils.objectHasProperty(this._selectedElements, id)) {
|
|
15778
15791
|
const element = this._selectedElements[id];
|
|
15779
|
-
element.
|
|
15792
|
+
element.selected = false;
|
|
15780
15793
|
if (notify) {
|
|
15781
15794
|
if (element instanceof Source) {
|
|
15782
15795
|
sources.push(element);
|
|
@@ -17047,6 +17060,15 @@ module.exports = function (Utils) {
|
|
|
17047
17060
|
set: function (newId) {
|
|
17048
17061
|
this._relativeId = newId;
|
|
17049
17062
|
}
|
|
17063
|
+
},
|
|
17064
|
+
selected: {
|
|
17065
|
+
enumerable: true,
|
|
17066
|
+
get: function () {
|
|
17067
|
+
return this._selected;
|
|
17068
|
+
},
|
|
17069
|
+
set: function (selected) {
|
|
17070
|
+
this._selected = selected;
|
|
17071
|
+
}
|
|
17050
17072
|
}
|
|
17051
17073
|
});
|
|
17052
17074
|
Segment.prototype.update = function (options) {
|
|
@@ -17090,9 +17112,6 @@ module.exports = function (Utils) {
|
|
|
17090
17112
|
this._indicators = opts.indicators;
|
|
17091
17113
|
this._peaks.emit('segment.updated', this);
|
|
17092
17114
|
};
|
|
17093
|
-
Segment.prototype.setSelected = function (selected) {
|
|
17094
|
-
this._selected = selected;
|
|
17095
|
-
};
|
|
17096
17115
|
Segment.prototype.isVisible = function (startTime, endTime) {
|
|
17097
17116
|
return this.startTime < endTime && startTime < this.endTime;
|
|
17098
17117
|
};
|
|
@@ -18151,7 +18170,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18151
18170
|
};
|
|
18152
18171
|
SourceGroup.prototype._setSelected = function () {
|
|
18153
18172
|
if (this._border) {
|
|
18154
|
-
if (this._source.
|
|
18173
|
+
if (this._source.selected) {
|
|
18155
18174
|
this._border.fill(this._source.selectedColor);
|
|
18156
18175
|
this._borderWidth = this._peaks.options.sourceSelectedBorderWidth;
|
|
18157
18176
|
} else {
|
|
@@ -18164,7 +18183,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18164
18183
|
return node.getClassName() === 'Shape';
|
|
18165
18184
|
});
|
|
18166
18185
|
if (unwrap_background) {
|
|
18167
|
-
if (this._source.
|
|
18186
|
+
if (this._source.selected) {
|
|
18168
18187
|
unwrap_background.stroke(this._source.selectedColor);
|
|
18169
18188
|
unwrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
18170
18189
|
} else {
|
|
@@ -18177,7 +18196,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18177
18196
|
return node.getClassName() === 'Shape';
|
|
18178
18197
|
});
|
|
18179
18198
|
if (wrap_background) {
|
|
18180
|
-
if (this._source.
|
|
18199
|
+
if (this._source.selected) {
|
|
18181
18200
|
wrap_background.stroke(this._source.selectedColor);
|
|
18182
18201
|
wrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
|
|
18183
18202
|
} else {
|
|
@@ -18885,6 +18904,15 @@ module.exports = function (Utils) {
|
|
|
18885
18904
|
get: function () {
|
|
18886
18905
|
return this._minSize;
|
|
18887
18906
|
}
|
|
18907
|
+
},
|
|
18908
|
+
selected: {
|
|
18909
|
+
enumerable: true,
|
|
18910
|
+
get: function () {
|
|
18911
|
+
return this._selected;
|
|
18912
|
+
},
|
|
18913
|
+
set: function (selected) {
|
|
18914
|
+
this._selected = selected;
|
|
18915
|
+
}
|
|
18888
18916
|
}
|
|
18889
18917
|
});
|
|
18890
18918
|
Source.prototype.updateTimes = function (newStartTime, newEndTime) {
|
|
@@ -19044,10 +19072,6 @@ module.exports = function (Utils) {
|
|
|
19044
19072
|
this._indicators = opts.indicators;
|
|
19045
19073
|
this._peaks.emit('source.update', this);
|
|
19046
19074
|
};
|
|
19047
|
-
Source.prototype.setSelected = function (selected) {
|
|
19048
|
-
this._selected = selected;
|
|
19049
|
-
this._peaks.emit('source.update', this);
|
|
19050
|
-
};
|
|
19051
19075
|
Source.prototype.isVisible = function (startTime, endTime) {
|
|
19052
19076
|
return this._startTime < endTime && startTime < this._endTime;
|
|
19053
19077
|
};
|
|
@@ -20235,8 +20259,8 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
20235
20259
|
this._modeLayer.selectElements(sources, false);
|
|
20236
20260
|
}
|
|
20237
20261
|
};
|
|
20238
|
-
TimelineZoomView.prototype.deselectAll = function () {
|
|
20239
|
-
this._modeLayer.deselectDifference([],
|
|
20262
|
+
TimelineZoomView.prototype.deselectAll = function (notify) {
|
|
20263
|
+
this._modeLayer.deselectDifference([], notify);
|
|
20240
20264
|
};
|
|
20241
20265
|
TimelineZoomView.prototype.isListening = function () {
|
|
20242
20266
|
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
|
@@ -55,8 +55,22 @@ define([
|
|
|
55
55
|
this._onMouseClickInCutMode = this._onMouseClickInCutMode.bind(this);
|
|
56
56
|
|
|
57
57
|
this.setMode(initialMode);
|
|
58
|
+
|
|
59
|
+
this._peaks.on('sources.destroy', this._onSourcesDestroy.bind(this));
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
ModeLayer.prototype._onSourcesDestroy = function(sources) {
|
|
63
|
+
const selectedElementsToDeselect = {};
|
|
64
|
+
|
|
65
|
+
sources.forEach(function(source) {
|
|
66
|
+
if (this._selectedElements[source.id]) {
|
|
67
|
+
selectedElementsToDeselect[source.id] = source;
|
|
68
|
+
}
|
|
69
|
+
}.bind(this));
|
|
70
|
+
|
|
71
|
+
this._deselectElements(selectedElementsToDeselect, false);
|
|
72
|
+
};
|
|
73
|
+
|
|
60
74
|
/**
|
|
61
75
|
* Adds the layer to the given {Konva.Stage}.
|
|
62
76
|
*
|
|
@@ -72,12 +86,12 @@ define([
|
|
|
72
86
|
const segments = [];
|
|
73
87
|
const self = this;
|
|
74
88
|
|
|
75
|
-
this.deselectDifference(elements,
|
|
89
|
+
this.deselectDifference(elements, false);
|
|
76
90
|
|
|
77
91
|
elements.forEach(function(element) {
|
|
78
92
|
if (!self._selectedElements[element.id]) {
|
|
79
93
|
self._selectedElements[element.id] = element;
|
|
80
|
-
element.
|
|
94
|
+
element.selected = true;
|
|
81
95
|
if (notify) {
|
|
82
96
|
if (element instanceof Source) {
|
|
83
97
|
sources.push(element);
|
|
@@ -100,19 +114,24 @@ define([
|
|
|
100
114
|
};
|
|
101
115
|
|
|
102
116
|
ModeLayer.prototype.deselectDifference = function(newElements, notify) {
|
|
103
|
-
const sources = [];
|
|
104
|
-
const segments = [];
|
|
105
117
|
const selectedElementsToDeselect = Object.assign({}, this._selectedElements);
|
|
106
118
|
|
|
107
119
|
newElements.forEach(function(element) {
|
|
108
120
|
delete selectedElementsToDeselect[element.id];
|
|
109
121
|
});
|
|
110
122
|
|
|
111
|
-
|
|
123
|
+
this._deselectElements(selectedElementsToDeselect, notify);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
ModeLayer.prototype._deselectElements = function(elements, notify) {
|
|
127
|
+
const sources = [];
|
|
128
|
+
const segments = [];
|
|
129
|
+
|
|
130
|
+
for (var id in elements) {
|
|
112
131
|
if (Utils.objectHasProperty(this._selectedElements, id)) {
|
|
113
132
|
const element = this._selectedElements[id];
|
|
114
133
|
|
|
115
|
-
element.
|
|
134
|
+
element.selected = false;
|
|
116
135
|
if (notify) {
|
|
117
136
|
if (element instanceof Source) {
|
|
118
137
|
sources.push(element);
|
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
|
|
|
@@ -341,11 +351,6 @@ define([
|
|
|
341
351
|
this._peaks.emit('segment.updated', this);
|
|
342
352
|
};
|
|
343
353
|
|
|
344
|
-
Segment.prototype.setSelected = function(selected) {
|
|
345
|
-
this._selected = selected;
|
|
346
|
-
// this._peaks.emit('segment.update', this); // It's currently useless
|
|
347
|
-
};
|
|
348
|
-
|
|
349
354
|
/**
|
|
350
355
|
* Returns <code>true</code> if the segment overlaps a given time region.
|
|
351
356
|
*
|
package/src/source-group.js
CHANGED
|
@@ -743,7 +743,7 @@ define([
|
|
|
743
743
|
|
|
744
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
|
}
|
|
@@ -787,7 +787,6 @@ define([
|
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
|
-
// this.setDraggingBehavior();
|
|
791
790
|
};
|
|
792
791
|
|
|
793
792
|
SourceGroup.prototype.updatePreviews = function() {
|
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/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() {
|