@checksub_team/peaks_timeline 1.5.9 → 1.5.11

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.5.9",
3
+ "version": "1.5.11",
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
@@ -14306,6 +14306,7 @@ module.exports = function (Konva, Utils, SVGs) {
14306
14306
  noVisibility: this._peaks.options.lineIndicatorNoVisibilityIconSize
14307
14307
  }
14308
14308
  };
14309
+ this._yPadding = 30;
14309
14310
  this._defaultPadding = 5;
14310
14311
  this._types = ['default'].concat(Object.keys(SVGs));
14311
14312
  this._stage = new Konva.Stage({
@@ -14460,13 +14461,13 @@ module.exports = function (Konva, Utils, SVGs) {
14460
14461
  };
14461
14462
  LineIndicator.prototype.updateIndicator = function (lineId) {
14462
14463
  if (this._indicators[lineId]) {
14463
- var y = this._indicators[lineId].line.getY() + this._indicators[lineId].line.lineHeight() / 2;
14464
- if (y + this._indicators[lineId].line.lineHeight() > 0 && y < this._height) {
14464
+ var y = this._indicators[lineId].line.getY();
14465
+ if (y + this._indicators[lineId].line.lineHeight() + this._yPadding > 0 && y - this._yPadding < this._height) {
14465
14466
  if (!this._indicators[lineId].indicator) {
14466
14467
  this._indicators[lineId].indicator = this._createIndicator(this._indicators[lineId].line, this._indicators[lineId].type, this._indicators[lineId].text);
14467
14468
  this._layer.add(this._indicators[lineId].indicator);
14468
14469
  } else {
14469
- this._indicators[lineId].indicator.y(y - this._indicators[lineId].indicator.getAttr('trueHeight') / 2);
14470
+ this._indicators[lineId].indicator.y(y + this._indicators[lineId].line.lineHeight() / 2 - this._indicators[lineId].indicator.getAttr('trueHeight') / 2);
14470
14471
  }
14471
14472
  } else {
14472
14473
  this.removeIndicator(lineId, true);
@@ -45,6 +45,7 @@ define([
45
45
  }
46
46
  };
47
47
 
48
+ this._yPadding = 30;
48
49
  this._defaultPadding = 5;
49
50
  this._types = ['default'].concat(Object.keys(SVGs));
50
51
 
@@ -247,10 +248,10 @@ define([
247
248
 
248
249
  LineIndicator.prototype.updateIndicator = function(lineId) {
249
250
  if (this._indicators[lineId]) {
250
- var y = this._indicators[lineId].line.getY()
251
- + (this._indicators[lineId].line.lineHeight() / 2);
251
+ var y = this._indicators[lineId].line.getY();
252
252
 
253
- if (y + this._indicators[lineId].line.lineHeight() > 0 && y < this._height) {
253
+ if (y + this._indicators[lineId].line.lineHeight() + this._yPadding > 0
254
+ && y - this._yPadding < this._height) {
254
255
  // The indicator is visible
255
256
  if (!this._indicators[lineId].indicator) {
256
257
  this._indicators[lineId].indicator = this._createIndicator(
@@ -262,7 +263,8 @@ define([
262
263
  }
263
264
  else {
264
265
  this._indicators[lineId].indicator.y(
265
- y - this._indicators[lineId].indicator.getAttr('trueHeight') / 2
266
+ y + this._indicators[lineId].line.lineHeight() / 2
267
+ - this._indicators[lineId].indicator.getAttr('trueHeight') / 2
266
268
  );
267
269
  }
268
270
  }