@checksub_team/peaks_timeline 1.15.0 → 1.15.1-alpha.0

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.0",
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,19 @@ 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
+ x: containerRect.left + elementPos.x,
18852
+ y: containerRect.top + elementPos.y,
18853
+ width: this._width,
18854
+ height: this._height,
18855
+ pageX: containerRect.left + elementPos.x + window.pageXOffset,
18856
+ pageY: containerRect.top + elementPos.y + window.pageYOffset
18857
+ };
18858
+ };
18843
18859
  SourceGroup.prototype.createIndicators = function () {
18844
18860
  var newIndicatorsColors = this._source.indicators;
18845
18861
  var oldIndicators = this._indicators;
@@ -18916,7 +18932,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18916
18932
  var buttonsGap = this._peaks.options.sourceButtonsGap;
18917
18933
  var self = this;
18918
18934
  this._source.buttons.forEach(function (button) {
18919
- const {id, width, height, cornerRadius, color, borderColor, borderWidth, svg, image} = button;
18935
+ const {id, width, height, cornerRadius, color, hoverColor, borderColor, borderWidth, svg, image} = button;
18920
18936
  if (buttonsGroupWidth > 0) {
18921
18937
  buttonsGroupWidth += buttonsGap;
18922
18938
  }
@@ -18962,16 +18978,20 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18962
18978
  };
18963
18979
  imageObj.src = image.data;
18964
18980
  }
18965
- if (button.hoverColor) {
18966
- buttonGroup.on('mouseover', function () {
18967
- buttonRect.fill(button.hoverColor);
18981
+ buttonGroup.on('mouseover', function () {
18982
+ if (hoverColor) {
18983
+ buttonRect.fill(hoverColor);
18968
18984
  buttonGroup.draw();
18969
- });
18970
- buttonGroup.on('mouseout', function () {
18971
- buttonRect.fill(button.color);
18985
+ }
18986
+ self._peaks.emit('source.buttonEnter', self._source, id);
18987
+ });
18988
+ buttonGroup.on('mouseout', function () {
18989
+ if (buttonRect.fill() !== color) {
18990
+ buttonRect.fill(color);
18972
18991
  buttonGroup.draw();
18973
- });
18974
- }
18992
+ }
18993
+ self._peaks.emit('source.buttonLeave', self._source, id);
18994
+ });
18975
18995
  buttonGroup.on('click', function () {
18976
18996
  self._peaks.emit('source.buttonClicked', self._source, id);
18977
18997
  });
@@ -21282,6 +21302,9 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
21282
21302
  TimelineZoomView.prototype.getSelectedElements = function () {
21283
21303
  return this._modeLayer.getSelectedElements();
21284
21304
  };
21305
+ TimelineZoomView.prototype.getSourceGroupById = function (sourceId) {
21306
+ return this._sourcesLayer.getSourceGroupById(sourceId);
21307
+ };
21285
21308
  TimelineZoomView.prototype.selectSourceById = function (sourceId) {
21286
21309
  const sourceGroup = this._sourcesLayer.getSourceGroupById(sourceId);
21287
21310
  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,22 @@ 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
+ x: containerRect.left + elementPos.x,
1036
+ y: containerRect.top + elementPos.y,
1037
+ width: this._width,
1038
+ height: this._height,
1039
+ pageX: containerRect.left + elementPos.x + window.pageXOffset,
1040
+ pageY: containerRect.top + elementPos.y + window.pageYOffset
1041
+ };
1042
+ };
1043
+
1028
1044
  SourceGroup.prototype.createIndicators = function() {
1029
1045
  var newIndicatorsColors = this._source.indicators;
1030
1046
 
@@ -1126,6 +1142,7 @@ define([
1126
1142
  height,
1127
1143
  cornerRadius,
1128
1144
  color,
1145
+ hoverColor,
1129
1146
  borderColor,
1130
1147
  borderWidth,
1131
1148
  svg,
@@ -1188,17 +1205,21 @@ define([
1188
1205
  imageObj.src = image.data;
1189
1206
  }
1190
1207
 
1191
- if (button.hoverColor) {
1192
- buttonGroup.on('mouseover', function() {
1193
- buttonRect.fill(button.hoverColor);
1208
+ buttonGroup.on('mouseover', function() {
1209
+ if (hoverColor) {
1210
+ buttonRect.fill(hoverColor);
1194
1211
  buttonGroup.draw();
1195
- });
1212
+ }
1213
+ self._peaks.emit('source.buttonEnter', self._source, id);
1214
+ });
1196
1215
 
1197
- buttonGroup.on('mouseout', function() {
1198
- buttonRect.fill(button.color);
1216
+ buttonGroup.on('mouseout', function() {
1217
+ if (buttonRect.fill() !== color) {
1218
+ buttonRect.fill(color);
1199
1219
  buttonGroup.draw();
1200
- });
1201
- }
1220
+ }
1221
+ self._peaks.emit('source.buttonLeave', self._source, id);
1222
+ });
1202
1223
 
1203
1224
  buttonGroup.on('click', function() {
1204
1225
  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