@checksub_team/peaks_timeline 1.9.5-beta.15 → 1.9.5-beta.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checksub_team/peaks_timeline",
3
- "version": "1.9.5-beta.15",
3
+ "version": "1.9.5-beta.2",
4
4
  "description": "JavaScript UI component for displaying audio waveforms",
5
5
  "main": "./peaks.js",
6
6
  "types": "./peaks.js.d.ts",
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, notify) {
15593
- this.sources.destroyById(sourceId, !notify);
15592
+ Peaks.prototype.destroySource = function (sourceId) {
15593
+ this.sources.destroyById(sourceId);
15594
15594
  };
15595
15595
  Peaks.prototype.showSource = function (sourceId) {
15596
15596
  this.sources.showById(sourceId);
@@ -15757,23 +15757,21 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
15757
15757
  elements.forEach(function (element) {
15758
15758
  if (!self._selectedElements[element.id]) {
15759
15759
  self._selectedElements[element.id] = element;
15760
- element.selected = true;
15761
- if (element instanceof Source) {
15762
- sources.push(element);
15763
- } else {
15764
- segments.push(element);
15760
+ element.setSelected(true);
15761
+ if (notify) {
15762
+ if (element instanceof Source) {
15763
+ sources.push(element);
15764
+ } else {
15765
+ segments.push(element);
15766
+ }
15765
15767
  }
15766
15768
  }
15767
15769
  });
15768
- if (sources.length) {
15769
- this._peaks.emit('sources.setSelected', sources);
15770
- if (notify) {
15770
+ if (notify) {
15771
+ if (sources.length) {
15771
15772
  this._peaks.emit('sources.selected', sources);
15772
15773
  }
15773
- }
15774
- if (segments.length) {
15775
- this._peaks.emit('segments.setSelected', segments);
15776
- if (notify) {
15774
+ if (segments.length) {
15777
15775
  this._peaks.emit('segments.selected', segments);
15778
15776
  }
15779
15777
  }
@@ -15791,24 +15789,22 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
15791
15789
  for (var id in elements) {
15792
15790
  if (Utils.objectHasProperty(this._selectedElements, id)) {
15793
15791
  const element = this._selectedElements[id];
15794
- element.selected = false;
15795
- if (element instanceof Source) {
15796
- sources.push(element);
15797
- } else {
15798
- segments.push(element);
15792
+ element.setSelected(false);
15793
+ if (notify) {
15794
+ if (element instanceof Source) {
15795
+ sources.push(element);
15796
+ } else {
15797
+ segments.push(element);
15798
+ }
15799
15799
  }
15800
15800
  delete this._selectedElements[id];
15801
15801
  }
15802
15802
  }
15803
- if (sources.length) {
15804
- this._peaks.emit('sources.setSelected', sources);
15805
- if (notify) {
15803
+ if (notify) {
15804
+ if (sources.length) {
15806
15805
  this._peaks.emit('sources.deselected', sources);
15807
15806
  }
15808
- }
15809
- if (segments.length) {
15810
- this._peaks.emit('segments.setSelected', segments);
15811
- if (notify) {
15807
+ if (segments.length) {
15812
15808
  this._peaks.emit('segments.deselected', segments);
15813
15809
  }
15814
15810
  }
@@ -17064,15 +17060,6 @@ module.exports = function (Utils) {
17064
17060
  set: function (newId) {
17065
17061
  this._relativeId = newId;
17066
17062
  }
17067
- },
17068
- selected: {
17069
- enumerable: true,
17070
- get: function () {
17071
- return this._selected;
17072
- },
17073
- set: function (selected) {
17074
- this._selected = selected;
17075
- }
17076
17063
  }
17077
17064
  });
17078
17065
  Segment.prototype.update = function (options) {
@@ -17118,7 +17105,6 @@ module.exports = function (Utils) {
17118
17105
  };
17119
17106
  Segment.prototype.setSelected = function (selected) {
17120
17107
  this._selected = selected;
17121
- this._peaks.emit('segment.selected', this);
17122
17108
  };
17123
17109
  Segment.prototype.isVisible = function (startTime, endTime) {
17124
17110
  return this.startTime < endTime && startTime < this.endTime;
@@ -17713,7 +17699,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17713
17699
  }
17714
17700
  this._addHandles();
17715
17701
  this.setWrapping(source.wrapped);
17716
- this.setSelected();
17702
+ this._setSelected();
17717
17703
  this._indicatorsGroup = new Konva.Group();
17718
17704
  this._group.add(this._indicatorsGroup);
17719
17705
  this.createIndicators();
@@ -18176,9 +18162,9 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18176
18162
  return preview.type === 'audio';
18177
18163
  });
18178
18164
  };
18179
- SourceGroup.prototype.setSelected = function () {
18165
+ SourceGroup.prototype._setSelected = function () {
18180
18166
  if (this._border) {
18181
- if (this._source.selected) {
18167
+ if (this._source._selected) {
18182
18168
  this._border.fill(this._source.selectedColor);
18183
18169
  this._borderWidth = this._peaks.options.sourceSelectedBorderWidth;
18184
18170
  } else {
@@ -18191,7 +18177,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18191
18177
  return node.getClassName() === 'Shape';
18192
18178
  });
18193
18179
  if (unwrap_background) {
18194
- if (this._source.selected) {
18180
+ if (this._source._selected) {
18195
18181
  unwrap_background.stroke(this._source.selectedColor);
18196
18182
  unwrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
18197
18183
  } else {
@@ -18204,7 +18190,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18204
18190
  return node.getClassName() === 'Shape';
18205
18191
  });
18206
18192
  if (wrap_background) {
18207
- if (this._source.selected) {
18193
+ if (this._source._selected) {
18208
18194
  wrap_background.stroke(this._source.selectedColor);
18209
18195
  wrap_background.strokeWidth(this._peaks.options.sourceSelectedBorderWidth);
18210
18196
  } else {
@@ -18912,15 +18898,6 @@ module.exports = function (Utils) {
18912
18898
  get: function () {
18913
18899
  return this._minSize;
18914
18900
  }
18915
- },
18916
- selected: {
18917
- enumerable: true,
18918
- get: function () {
18919
- return this._selected;
18920
- },
18921
- set: function (selected) {
18922
- this._selected = selected;
18923
- }
18924
18901
  }
18925
18902
  });
18926
18903
  Source.prototype.updateTimes = function (newStartTime, newEndTime) {
@@ -19080,6 +19057,10 @@ module.exports = function (Utils) {
19080
19057
  this._indicators = opts.indicators;
19081
19058
  this._peaks.emit('source.update', this);
19082
19059
  };
19060
+ Source.prototype.setSelected = function (selected) {
19061
+ this._selected = selected;
19062
+ this._peaks.emit('source.update', this);
19063
+ };
19083
19064
  Source.prototype.isVisible = function (startTime, endTime) {
19084
19065
  return this._startTime < endTime && startTime < this._endTime;
19085
19066
  };
@@ -19107,7 +19088,6 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
19107
19088
  this._peaks.on('sources.destroy', this._onSourcesDestroy.bind(this));
19108
19089
  this._peaks.on('sources.show', this._onSourcesShow.bind(this));
19109
19090
  this._peaks.on('sources.hide', this._onSourcesHide.bind(this));
19110
- this._peaks.on('sources.setSelected', this._onSourcesSetSelected.bind(this));
19111
19091
  this._peaks.on('source.update', this._onSourceUpdate.bind(this));
19112
19092
  this._peaks.on('data.retrieved', this._onDataRetrieved.bind(this));
19113
19093
  this._peaks.on('sources.refresh', this._onSourcesRefresh.bind(this));
@@ -19177,15 +19157,6 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
19177
19157
  this.updateSources(frameStartTime, frameEndTime);
19178
19158
  }
19179
19159
  };
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
- };
19189
19160
  SourcesLayer.prototype._onSourcesShow = function (sources) {
19190
19161
  var self = this;
19191
19162
  sources.forEach(function (source) {
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, notify) {
641
- this.sources.destroyById(sourceId, !notify);
640
+ Peaks.prototype.destroySource = function(sourceId) {
641
+ this.sources.destroyById(sourceId);
642
642
  };
643
643
 
644
644
  /**
package/src/mode-layer.js CHANGED
@@ -91,25 +91,23 @@ define([
91
91
  elements.forEach(function(element) {
92
92
  if (!self._selectedElements[element.id]) {
93
93
  self._selectedElements[element.id] = element;
94
- element.selected = true;
95
- if (element instanceof Source) {
96
- sources.push(element);
97
- }
98
- else {
99
- segments.push(element);
94
+ element.setSelected(true);
95
+ if (notify) {
96
+ if (element instanceof Source) {
97
+ sources.push(element);
98
+ }
99
+ else {
100
+ segments.push(element);
101
+ }
100
102
  }
101
103
  }
102
104
  });
103
105
 
104
- if (sources.length) {
105
- this._peaks.emit('sources.setSelected', sources);
106
- if (notify) {
106
+ if (notify) {
107
+ if (sources.length) {
107
108
  this._peaks.emit('sources.selected', sources);
108
109
  }
109
- }
110
- if (segments.length) {
111
- this._peaks.emit('segments.setSelected', segments);
112
- if (notify) {
110
+ if (segments.length) {
113
111
  this._peaks.emit('segments.selected', segments);
114
112
  }
115
113
  }
@@ -133,26 +131,24 @@ define([
133
131
  if (Utils.objectHasProperty(this._selectedElements, id)) {
134
132
  const element = this._selectedElements[id];
135
133
 
136
- element.selected = false;
137
- if (element instanceof Source) {
138
- sources.push(element);
139
- }
140
- else {
141
- segments.push(element);
134
+ element.setSelected(false);
135
+ if (notify) {
136
+ if (element instanceof Source) {
137
+ sources.push(element);
138
+ }
139
+ else {
140
+ segments.push(element);
141
+ }
142
142
  }
143
143
  delete this._selectedElements[id];
144
144
  }
145
145
  }
146
146
 
147
- if (sources.length) {
148
- this._peaks.emit('sources.setSelected', sources);
149
- if (notify) {
147
+ if (notify) {
148
+ if (sources.length) {
150
149
  this._peaks.emit('sources.deselected', sources);
151
150
  }
152
- }
153
- if (segments.length) {
154
- this._peaks.emit('segments.setSelected', segments);
155
- if (notify) {
151
+ if (segments.length) {
156
152
  this._peaks.emit('segments.deselected', segments);
157
153
  }
158
154
  }
package/src/segment.js CHANGED
@@ -292,16 +292,6 @@ 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
- }
305
295
  }
306
296
  });
307
297
 
@@ -353,7 +343,7 @@ define([
353
343
 
354
344
  Segment.prototype.setSelected = function(selected) {
355
345
  this._selected = selected;
356
- this._peaks.emit('segment.selected', this);
346
+ // this._peaks.emit('segment.update', this); // It's currently useless
357
347
  };
358
348
 
359
349
  /**
@@ -98,7 +98,7 @@ define([
98
98
 
99
99
  this.setWrapping(source.wrapped);
100
100
 
101
- this.setSelected();
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.setSelected = function() {
744
+ SourceGroup.prototype._setSelected = function() {
745
745
  if (this._border) {
746
- if (this._source.selected) {
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.selected) {
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.selected) {
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,16 +669,6 @@ 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
- }
682
672
  }
683
673
  });
684
674
 
@@ -875,6 +865,11 @@ define([
875
865
  this._peaks.emit('source.update', this);
876
866
  };
877
867
 
868
+ Source.prototype.setSelected = function(selected) {
869
+ this._selected = selected;
870
+ this._peaks.emit('source.update', this);
871
+ };
872
+
878
873
  /**
879
874
  * Returns <code>true</code> if the source overlaps a given time region.
880
875
  *
@@ -53,7 +53,6 @@ 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));
57
56
  this._peaks.on('source.update', this._onSourceUpdate.bind(this));
58
57
  this._peaks.on('data.retrieved', this._onDataRetrieved.bind(this));
59
58
  this._peaks.on('sources.refresh', this._onSourcesRefresh.bind(this));
@@ -153,18 +152,6 @@ define([
153
152
  }
154
153
  };
155
154
 
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
-
168
155
  SourcesLayer.prototype._onSourcesShow = function(sources) {
169
156
  var self = this;
170
157