@checksub_team/peaks_timeline 2.0.0-alpha.4 → 2.0.0-alpha.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checksub_team/peaks_timeline",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.6",
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
@@ -15601,19 +15601,15 @@ module.exports = function (SegmentsGroup, LineGroup, LineIndicator, Utils) {
15601
15601
  };
15602
15602
  LineGroups.prototype.refreshLineYs = function () {
15603
15603
  var y = this._peaks.options.padding - this._view.getFrameOffsetY();
15604
- var anyChange = false;
15605
15604
  for (var position in this._lineGroupsByPosition) {
15606
15605
  if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
15607
15606
  if (this._lineGroupsByPosition[position].y() !== y) {
15608
- anyChange = true;
15609
15607
  this._lineGroupsByPosition[position].y(y);
15610
15608
  }
15611
15609
  y += this._lineGroupsByPosition[position].lineHeight() + this._peaks.options.interline;
15612
15610
  }
15613
15611
  }
15614
- if (anyChange && this._lineIndicator.refreshIndicators()) {
15615
- this._lineIndicator.draw();
15616
- }
15612
+ this._lineIndicator.refreshIndicators();
15617
15613
  };
15618
15614
  LineGroups.prototype._setLinePosition = function (lineId, position) {
15619
15615
  const lineGroup = this._lineGroupsById[lineId];
@@ -15911,6 +15907,9 @@ module.exports = function (Konva, SVGs, Utils) {
15911
15907
  anyChange = this.refreshIndicator(lineId) || anyChange;
15912
15908
  }
15913
15909
  }
15910
+ if (anyChange) {
15911
+ this.draw();
15912
+ }
15914
15913
  return anyChange;
15915
15914
  };
15916
15915
  LineIndicator.prototype.draw = function () {
@@ -18109,7 +18108,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
18109
18108
  return group.isAncestorOf(this._group);
18110
18109
  };
18111
18110
  SourceGroup.prototype.hideButKeepFocus = function () {
18112
- this._group.moveTo(this._view.getTempLayer());
18111
+ this._group.moveTo(this._view.getTempGroup());
18113
18112
  };
18114
18113
  SourceGroup.prototype.getParent = function () {
18115
18114
  return this._group.getParent();
@@ -22090,8 +22089,7 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
22090
22089
  width: self._width - self._peaks.options.lineIndicatorWidth,
22091
22090
  height: self._height
22092
22091
  });
22093
- self._tempLayer = new Konva.Layer();
22094
- self._stage.add(self._tempLayer);
22092
+ self._tempGroup = new Konva.Group({ listening: false });
22095
22093
  self._width -= self._peaks.options.lineIndicatorWidth;
22096
22094
  self._axis = new Axis(self._peaks, self, {
22097
22095
  axisGridlineColor: this._options.axisGridlineColor,
@@ -22100,6 +22098,7 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
22100
22098
  self._axis.addBackToStage(self._stage);
22101
22099
  self._sourcesLayer = new SourcesLayer(peaks, self, true);
22102
22100
  self._sourcesLayer.addToStage(self._stage);
22101
+ self._sourcesLayer.add(self._tempGroup);
22103
22102
  self._axis.addFrontToStage(self._stage);
22104
22103
  self._playheadLayer = new PlayheadLayer(peaks, self, self._sourcesLayer, self._options.showPlayheadTime);
22105
22104
  self._playheadLayer.addToStage(self._stage);
@@ -22208,8 +22207,8 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
22208
22207
  View.prototype.setClickable = function (clickable) {
22209
22208
  this._isClickable = clickable;
22210
22209
  };
22211
- View.prototype.getTempLayer = function () {
22212
- return this._tempLayer;
22210
+ View.prototype.getTempGroup = function () {
22211
+ return this._tempGroup;
22213
22212
  };
22214
22213
  View.prototype.getSelectedElements = function () {
22215
22214
  return Object.values(this._modeLayer.getSelectedElements());
@@ -441,23 +441,19 @@ define([
441
441
 
442
442
  LineGroups.prototype.refreshLineYs = function() {
443
443
  var y = this._peaks.options.padding - this._view.getFrameOffsetY();
444
- var anyChange = false;
445
444
 
446
445
  // This code assumes that lines are ordered in ascending order of position
447
446
  // This is the case as the keys are integers
448
447
  for (var position in this._lineGroupsByPosition) {
449
448
  if (Utils.objectHasProperty(this._lineGroupsByPosition, position)) {
450
449
  if (this._lineGroupsByPosition[position].y() !== y) {
451
- anyChange = true;
452
450
  this._lineGroupsByPosition[position].y(y);
453
451
  }
454
452
  y += this._lineGroupsByPosition[position].lineHeight() + this._peaks.options.interline;
455
453
  }
456
454
  }
457
455
 
458
- if (anyChange && this._lineIndicator.refreshIndicators()) {
459
- this._lineIndicator.draw();
460
- }
456
+ this._lineIndicator.refreshIndicators();
461
457
  };
462
458
 
463
459
  LineGroups.prototype._setLinePosition = function(lineId, position) {
@@ -297,6 +297,9 @@ define([
297
297
  }
298
298
  }
299
299
 
300
+ if (anyChange) {
301
+ this.draw();
302
+ }
300
303
  return anyChange;
301
304
  };
302
305
 
@@ -691,7 +691,7 @@ define([
691
691
  };
692
692
 
693
693
  SourceGroup.prototype.hideButKeepFocus = function() {
694
- this._group.moveTo(this._view.getTempLayer());
694
+ this._group.moveTo(this._view.getTempGroup());
695
695
  };
696
696
 
697
697
  SourceGroup.prototype.getParent = function() {
package/src/view.js CHANGED
@@ -119,9 +119,7 @@ define([
119
119
  height: self._height
120
120
  });
121
121
 
122
- self._tempLayer = new Konva.Layer();
123
- // self._tempLayer.listening(false);
124
- self._stage.add(self._tempLayer);
122
+ self._tempGroup = new Konva.Group({ listening: false });
125
123
 
126
124
  self._width -= self._peaks.options.lineIndicatorWidth;
127
125
 
@@ -135,6 +133,8 @@ define([
135
133
  self._sourcesLayer = new SourcesLayer(peaks, self, true);
136
134
  self._sourcesLayer.addToStage(self._stage);
137
135
 
136
+ self._sourcesLayer.add(self._tempGroup);
137
+
138
138
  self._axis.addFrontToStage(self._stage);
139
139
 
140
140
  self._playheadLayer = new PlayheadLayer(
@@ -317,8 +317,8 @@ define([
317
317
  this._isClickable = clickable;
318
318
  };
319
319
 
320
- View.prototype.getTempLayer = function() {
321
- return this._tempLayer;
320
+ View.prototype.getTempGroup = function() {
321
+ return this._tempGroup;
322
322
  };
323
323
 
324
324
  View.prototype.getSelectedElements = function() {