@checksub_team/peaks_timeline 1.15.0 → 1.15.1-alpha.1

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.15.0",
3
+ "version": "1.15.1-alpha.1",
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
@@ -16078,6 +16078,9 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
16078
16078
  Peaks.prototype.getSelectedElements = function () {
16079
16079
  return this.view.getSelectedElements();
16080
16080
  };
16081
+ Peaks.prototype.getSourceGroupById = function (id) {
16082
+ return this.view.getSourceGroupById(id);
16083
+ };
16081
16084
  Peaks.prototype.selectSourceById = function (sourceId) {
16082
16085
  return this.view.selectSourceById(sourceId);
16083
16086
  };
@@ -18840,6 +18843,17 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18840
18843
  SourceGroup.prototype.getLine = function () {
18841
18844
  return this._source.position;
18842
18845
  };
18846
+ SourceGroup.prototype.getAbsoluteBoundingBox = function () {
18847
+ var stageContainer = this._group.getStage().container();
18848
+ var containerRect = stageContainer.getBoundingClientRect();
18849
+ var elementPos = this._group.getAbsolutePosition();
18850
+ return {
18851
+ left: containerRect.left + elementPos.x,
18852
+ top: containerRect.top + elementPos.y,
18853
+ width: this._width,
18854
+ height: this._height
18855
+ };
18856
+ };
18843
18857
  SourceGroup.prototype.createIndicators = function () {
18844
18858
  var newIndicatorsColors = this._source.indicators;
18845
18859
  var oldIndicators = this._indicators;
@@ -18916,7 +18930,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18916
18930
  var buttonsGap = this._peaks.options.sourceButtonsGap;
18917
18931
  var self = this;
18918
18932
  this._source.buttons.forEach(function (button) {
18919
- const {id, width, height, cornerRadius, color, borderColor, borderWidth, svg, image} = button;
18933
+ const {id, width, height, cornerRadius, color, hoverColor, borderColor, borderWidth, svg, image} = button;
18920
18934
  if (buttonsGroupWidth > 0) {
18921
18935
  buttonsGroupWidth += buttonsGap;
18922
18936
  }
@@ -18962,16 +18976,20 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18962
18976
  };
18963
18977
  imageObj.src = image.data;
18964
18978
  }
18965
- if (button.hoverColor) {
18966
- buttonGroup.on('mouseover', function () {
18967
- buttonRect.fill(button.hoverColor);
18979
+ buttonGroup.on('mouseover', function () {
18980
+ if (hoverColor) {
18981
+ buttonRect.fill(hoverColor);
18968
18982
  buttonGroup.draw();
18969
- });
18970
- buttonGroup.on('mouseout', function () {
18971
- buttonRect.fill(button.color);
18983
+ }
18984
+ self._peaks.emit('source.buttonEnter', self._source, id);
18985
+ });
18986
+ buttonGroup.on('mouseout', function () {
18987
+ if (buttonRect.fill() !== color) {
18988
+ buttonRect.fill(color);
18972
18989
  buttonGroup.draw();
18973
- });
18974
- }
18990
+ }
18991
+ self._peaks.emit('source.buttonLeave', self._source, id);
18992
+ });
18975
18993
  buttonGroup.on('click', function () {
18976
18994
  self._peaks.emit('source.buttonClicked', self._source, id);
18977
18995
  });
@@ -21282,6 +21300,9 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
21282
21300
  TimelineZoomView.prototype.getSelectedElements = function () {
21283
21301
  return this._modeLayer.getSelectedElements();
21284
21302
  };
21303
+ TimelineZoomView.prototype.getSourceGroupById = function (sourceId) {
21304
+ return this._sourcesLayer.getSourceGroupById(sourceId);
21305
+ };
21285
21306
  TimelineZoomView.prototype.selectSourceById = function (sourceId) {
21286
21307
  const sourceGroup = this._sourcesLayer.getSourceGroupById(sourceId);
21287
21308
  if (sourceGroup) {
package/src/main.js CHANGED
@@ -734,6 +734,11 @@ define([
734
734
  .getSelectedElements();
735
735
  };
736
736
 
737
+ Peaks.prototype.getSourceGroupById = function(id) {
738
+ return this.view
739
+ .getSourceGroupById(id);
740
+ };
741
+
737
742
  Peaks.prototype.selectSourceById = function(sourceId) {
738
743
  return this.view
739
744
  .selectSourceById(sourceId);
@@ -1025,6 +1025,20 @@ define([
1025
1025
  return this._source.position;
1026
1026
  };
1027
1027
 
1028
+ SourceGroup.prototype.getAbsoluteBoundingBox = function() {
1029
+ var stageContainer = this._group.getStage().container();
1030
+ var containerRect = stageContainer.getBoundingClientRect();
1031
+
1032
+ var elementPos = this._group.getAbsolutePosition();
1033
+
1034
+ return {
1035
+ left: containerRect.left + elementPos.x,
1036
+ top: containerRect.top + elementPos.y,
1037
+ width: this._width,
1038
+ height: this._height
1039
+ };
1040
+ };
1041
+
1028
1042
  SourceGroup.prototype.createIndicators = function() {
1029
1043
  var newIndicatorsColors = this._source.indicators;
1030
1044
 
@@ -1126,6 +1140,7 @@ define([
1126
1140
  height,
1127
1141
  cornerRadius,
1128
1142
  color,
1143
+ hoverColor,
1129
1144
  borderColor,
1130
1145
  borderWidth,
1131
1146
  svg,
@@ -1188,17 +1203,21 @@ define([
1188
1203
  imageObj.src = image.data;
1189
1204
  }
1190
1205
 
1191
- if (button.hoverColor) {
1192
- buttonGroup.on('mouseover', function() {
1193
- buttonRect.fill(button.hoverColor);
1206
+ buttonGroup.on('mouseover', function() {
1207
+ if (hoverColor) {
1208
+ buttonRect.fill(hoverColor);
1194
1209
  buttonGroup.draw();
1195
- });
1210
+ }
1211
+ self._peaks.emit('source.buttonEnter', self._source, id);
1212
+ });
1196
1213
 
1197
- buttonGroup.on('mouseout', function() {
1198
- buttonRect.fill(button.color);
1214
+ buttonGroup.on('mouseout', function() {
1215
+ if (buttonRect.fill() !== color) {
1216
+ buttonRect.fill(color);
1199
1217
  buttonGroup.draw();
1200
- });
1201
- }
1218
+ }
1219
+ self._peaks.emit('source.buttonLeave', self._source, id);
1220
+ });
1202
1221
 
1203
1222
  buttonGroup.on('click', function() {
1204
1223
  self._peaks.emit('source.buttonClicked', self._source, id);
@@ -384,6 +384,10 @@ define([
384
384
  return this._modeLayer.getSelectedElements();
385
385
  };
386
386
 
387
+ TimelineZoomView.prototype.getSourceGroupById = function(sourceId) {
388
+ return this._sourcesLayer.getSourceGroupById(sourceId);
389
+ };
390
+
387
391
  TimelineZoomView.prototype.selectSourceById = function(sourceId) {
388
392
  const sourceGroup = this._sourcesLayer.getSourceGroupById(sourceId);
389
393