@checksub_team/peaks_timeline 1.5.6 → 1.5.8

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.6",
3
+ "version": "1.5.8",
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
@@ -14155,7 +14155,7 @@ module.exports = function (Utils, Konva) {
14155
14155
  };
14156
14156
  return DefaultSegmentMarker;
14157
14157
  }(_dereq_('./utils'), _dereq_('konva'));
14158
- },{"./utils":111,"konva":43}],89:[function(_dereq_,module,exports){
14158
+ },{"./utils":112,"konva":43}],89:[function(_dereq_,module,exports){
14159
14159
  module.exports = function () {
14160
14160
  'use strict';
14161
14161
  function Invoker() {
@@ -14288,7 +14288,7 @@ module.exports = function () {
14288
14288
  return KeyboardHandler;
14289
14289
  }();
14290
14290
  },{}],91:[function(_dereq_,module,exports){
14291
- module.exports = function (Konva, Utils) {
14291
+ module.exports = function (Konva, Utils, SVGs) {
14292
14292
  'use strict';
14293
14293
  function LineIndicator(peaks, view, container) {
14294
14294
  this._peaks = peaks;
@@ -14296,7 +14296,18 @@ module.exports = function (Konva, Utils) {
14296
14296
  this._container = container;
14297
14297
  this._width = this._peaks.options.lineIndicatorWidth;
14298
14298
  this._height = this._view.getHeight();
14299
- this._indicatorRadius = this._width / 4;
14299
+ this._sizes = {
14300
+ font: this._peaks.options.lineIndicatorFontSize,
14301
+ icon: {
14302
+ default: this._peaks.options.lineIndicatorDefaultIconSize,
14303
+ volume: this._peaks.options.lineIndicatorVolumeIconSize,
14304
+ noVolume: this._peaks.options.lineIndicatorNoVolumeIconSize,
14305
+ visibility: this._peaks.options.lineIndicatorVisibilityIconSize,
14306
+ noVisibility: this._peaks.options.lineIndicatorNoVisibilityIconSize
14307
+ }
14308
+ };
14309
+ this._defaultPadding = 5;
14310
+ this._types = ['default'].concat(Object.keys(SVGs));
14300
14311
  this._stage = new Konva.Stage({
14301
14312
  container: container,
14302
14313
  width: this._width,
@@ -14321,15 +14332,8 @@ module.exports = function (Konva, Utils) {
14321
14332
  if (this._peaks.options.enableLineIndicatorContextMenu) {
14322
14333
  this._createContextMenu();
14323
14334
  }
14324
- this.ICON_SIZE = 18;
14325
- this._volumeSVGPath = 'M0 6.00001V12H4L9 17V1.00001L4 6.00001H0ZM13.5 9.00001C13.5 7.23001 12.48 5.71001 11 4.97001V13.02C12.48 12.29 13.5 10.77 13.5 9.00001ZM11 0.230011V2.29001C13.89 3.15001 16 5.83001 16 9.00001C16 12.17 13.89 14.85 11 15.71V17.77C15.01 16.86 18 13.28 18 9.00001C18 4.72001 15.01 1.14001 11 0.230011Z';
14326
- this._noVolumeSVGPath = 'M13.5 9C13.5 7.23 12.48 5.71 11 4.97V7.18L13.45 9.63C13.48 9.43 13.5 9.22 13.5 9ZM16 9C16 9.94 15.8 10.82 15.46 11.64L16.97 13.15C17.63 11.91 18 10.5 18 9C18 4.72 15.01 1.14 11 0.23V2.29C13.89 3.15 16 5.83 16 9ZM1.27 0L0 1.27L4.73 6H0V12H4L9 17V10.27L13.25 14.52C12.58 15.04 11.83 15.45 11 15.7V17.76C12.38 17.45 13.63 16.81 14.69 15.95L16.73 18L18 16.73L9 7.73L1.27 0ZM9 1L6.91 3.09L9 5.18V1Z';
14327
14335
  this._peaks.on('lineIndicator.setType', this._onSetType.bind(this));
14328
- this._types = [
14329
- 'default',
14330
- 'volume',
14331
- 'noVolume'
14332
- ];
14336
+ this._peaks.on('lineIndicator.setText', this._onSetText.bind(this));
14333
14337
  }
14334
14338
  LineIndicator.prototype.fitToView = function () {
14335
14339
  this._height = this._view.getHeight();
@@ -14344,51 +14348,82 @@ module.exports = function (Konva, Utils) {
14344
14348
  LineIndicator.prototype._onSetType = function (lineId, type) {
14345
14349
  this.removeIndicator(lineId, true);
14346
14350
  type = this._types.includes(type) ? type : 'default';
14347
- var indicator = this._createIndicator(this._indicators[lineId].line, type);
14351
+ var indicator = this._createIndicator(this._indicators[lineId].line, type, this._indicators[lineId].text);
14348
14352
  this._layer.add(indicator);
14349
14353
  this._indicators[lineId].indicator = indicator;
14350
14354
  this._indicators[lineId].type = type;
14351
14355
  this.draw();
14352
14356
  };
14357
+ LineIndicator.prototype._onSetText = function (lineId, text) {
14358
+ this.removeIndicator(lineId, true);
14359
+ var indicator = this._createIndicator(this._indicators[lineId].line, this._indicators[lineId].type, text);
14360
+ this._layer.add(indicator);
14361
+ this._indicators[lineId].indicator = indicator;
14362
+ this._indicators[lineId].text = text;
14363
+ this.draw();
14364
+ };
14353
14365
  LineIndicator.prototype._showMenu = function (menu) {
14354
14366
  menu.style.display = 'block';
14355
14367
  var containerRect = this._stage.container().getBoundingClientRect();
14356
14368
  menu.style.top = containerRect.top + this._stage.getPointerPosition().y - menu.offsetHeight + 'px';
14357
14369
  menu.style.left = containerRect.left + this._stage.getPointerPosition().x + 6 + 'px';
14358
14370
  };
14359
- LineIndicator.prototype._createIndicator = function (line, type) {
14360
- var indicator;
14361
- type = typeof type !== 'undefined' ? type : 'default';
14371
+ LineIndicator.prototype._createIndicator = function (line, type, text) {
14372
+ var indicator = new Konva.Group();
14373
+ var indicatorHeight = 0;
14374
+ if (text) {
14375
+ var textNode = new Konva.Text({
14376
+ text: text,
14377
+ fontSize: this._sizes.font,
14378
+ fontFamily: 'Arial',
14379
+ fill: this._peaks.options.lineIndicatorColor,
14380
+ align: 'center',
14381
+ width: this._width
14382
+ });
14383
+ indicator.add(textNode);
14384
+ indicatorHeight += this._sizes.font;
14385
+ }
14386
+ type = this._types.includes(type) ? type : 'default';
14387
+ var iconNode;
14362
14388
  if (type === 'default') {
14363
- indicator = new Konva.Circle({
14389
+ var padding = text ? this._defaultPadding : 0;
14390
+ iconNode = new Konva.Circle({
14364
14391
  x: this._width / 2,
14365
- y: line.getY() + line.lineHeight() / 2,
14366
- radius: this._indicatorRadius,
14392
+ y: indicatorHeight + this._sizes.icon.default / 2 + padding,
14393
+ radius: this._sizes.icon.default / 2,
14367
14394
  fill: this._peaks.options.lineIndicatorColor,
14368
14395
  strokeWidth: 0,
14369
14396
  lineId: line.getId()
14370
14397
  });
14398
+ indicatorHeight += padding;
14371
14399
  } else {
14372
- var scaleFactor = this._width / 2 / this.ICON_SIZE;
14373
- indicator = new Konva.Path({
14374
- x: this._width / 4,
14375
- y: line.getY() + line.lineHeight() / 2 - this._width / 4,
14376
- data: type === 'volume' ? this._volumeSVGPath : this._noVolumeSVGPath,
14400
+ iconNode = new Konva.Path({
14401
+ x: (this._width - this._sizes.icon[type]) / 2,
14402
+ y: indicatorHeight,
14403
+ data: SVGs[type].path,
14377
14404
  fill: this._peaks.options.lineIndicatorColor,
14378
14405
  scale: {
14379
- x: scaleFactor,
14380
- y: scaleFactor
14406
+ x: this._sizes.icon[type] / SVGs[type].width,
14407
+ y: this._sizes.icon[type] / SVGs[type].height
14381
14408
  },
14382
14409
  lineId: line.getId()
14383
14410
  });
14384
14411
  }
14412
+ indicator.add(iconNode);
14413
+ indicatorHeight += this._sizes.icon[type];
14414
+ indicator.setAttr('trueHeight', indicatorHeight);
14415
+ indicator.y(line.getY() + (line.lineHeight() - indicatorHeight) / 2);
14385
14416
  var self = this;
14386
14417
  indicator.on('mouseover', function () {
14387
- indicator.fill(self._peaks.options.lineIndicatorSelected);
14418
+ indicator.getChildren().forEach(function (child) {
14419
+ child.fill(self._peaks.options.lineIndicatorSelected);
14420
+ });
14388
14421
  self.draw();
14389
14422
  });
14390
14423
  indicator.on('mouseout', function () {
14391
- indicator.fill(self._peaks.options.lineIndicatorColor);
14424
+ indicator.getChildren().forEach(function (child) {
14425
+ child.fill(self._peaks.options.lineIndicatorColor);
14426
+ });
14392
14427
  self.draw();
14393
14428
  });
14394
14429
  indicator.on('click', function (e) {
@@ -14419,18 +14454,15 @@ module.exports = function (Konva, Utils) {
14419
14454
  }
14420
14455
  }
14421
14456
  };
14422
- LineIndicator.prototype.getPixelsFromCenter = function (lineId) {
14423
- return this._indicators[lineId].type === 'default' ? 0 : this._width / 4;
14424
- };
14425
14457
  LineIndicator.prototype.updateIndicator = function (lineId) {
14426
14458
  if (this._indicators[lineId]) {
14427
14459
  var y = this._indicators[lineId].line.getY() + this._indicators[lineId].line.lineHeight() / 2;
14428
- if (y + this._indicatorRadius > 0 && y - this._indicatorRadius < this._height) {
14460
+ if (y + this._indicators[lineId].line.lineHeight() > 0 && y < this._height) {
14429
14461
  if (!this._indicators[lineId].indicator) {
14430
- this._indicators[lineId].indicator = this._createIndicator(this._indicators[lineId].line, this._indicators[lineId].type);
14462
+ this._indicators[lineId].indicator = this._createIndicator(this._indicators[lineId].line, this._indicators[lineId].type, this._indicators[lineId].text);
14431
14463
  this._layer.add(this._indicators[lineId].indicator);
14432
14464
  } else {
14433
- this._indicators[lineId].indicator.y(y - this.getPixelsFromCenter(lineId));
14465
+ this._indicators[lineId].indicator.y(y - this._indicators[lineId].indicator.getAttr('trueHeight') / 2);
14434
14466
  }
14435
14467
  } else {
14436
14468
  this.removeIndicator(lineId, true);
@@ -14560,8 +14592,8 @@ module.exports = function (Konva, Utils) {
14560
14592
  });
14561
14593
  };
14562
14594
  return LineIndicator;
14563
- }(_dereq_('konva'), _dereq_('./utils'));
14564
- },{"./utils":111,"konva":43}],92:[function(_dereq_,module,exports){
14595
+ }(_dereq_('konva'), _dereq_('./utils'), _dereq_('./svgs'));
14596
+ },{"./svgs":107,"./utils":112,"konva":43}],92:[function(_dereq_,module,exports){
14565
14597
  module.exports = function (Konva, Utils) {
14566
14598
  'use strict';
14567
14599
  function Line(peaks, view, y, id, position) {
@@ -15024,7 +15056,7 @@ module.exports = function (Konva, Utils) {
15024
15056
  };
15025
15057
  return Line;
15026
15058
  }(_dereq_('konva'), _dereq_('./utils'));
15027
- },{"./utils":111,"konva":43}],93:[function(_dereq_,module,exports){
15059
+ },{"./utils":112,"konva":43}],93:[function(_dereq_,module,exports){
15028
15060
  module.exports = function (SegmentsGroup, Line, LineIndicator, Utils) {
15029
15061
  'use strict';
15030
15062
  function Lines(peaks, view, layer) {
@@ -15329,7 +15361,7 @@ module.exports = function (SegmentsGroup, Line, LineIndicator, Utils) {
15329
15361
  };
15330
15362
  return Lines;
15331
15363
  }(_dereq_('./segments-group'), _dereq_('./line'), _dereq_('./line-indicator'), _dereq_('./utils'));
15332
- },{"./line":92,"./line-indicator":91,"./segments-group":103,"./utils":111}],94:[function(_dereq_,module,exports){
15364
+ },{"./line":92,"./line-indicator":91,"./segments-group":103,"./utils":112}],94:[function(_dereq_,module,exports){
15333
15365
  module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSources, KeyboardHandler, Player, MarkerFactories, TimelineZoomView, Utils) {
15334
15366
  'use strict';
15335
15367
  function Peaks() {
@@ -15379,6 +15411,12 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
15379
15411
  segmentMagnetThreshold: 15,
15380
15412
  enableVerticalScrolling: true,
15381
15413
  lineIndicatorWidth: 20,
15414
+ lineIndicatorDefaultIconSize: 19,
15415
+ lineIndicatorVolumeIconSize: 24,
15416
+ lineIndicatorNoVolumeIconSize: 24,
15417
+ lineIndicatorVisibilityIconSize: 24,
15418
+ lineIndicatorNoVisibilityIconSize: 24,
15419
+ lineIndicatorFontSize: 10,
15382
15420
  lineIndicatorColor: '#8A8F98',
15383
15421
  lineIndicatorSelected: '#ccc',
15384
15422
  autoScrollThreshold: 0.05,
@@ -15522,6 +15560,10 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
15522
15560
  var lineId = this.view.getLineByPosition(linePosition).getId();
15523
15561
  this.emit('lineIndicator.setType', lineId, type);
15524
15562
  };
15563
+ Peaks.prototype.setIndicatorText = function (linePosition, text) {
15564
+ var lineId = this.view.getLineByPosition(linePosition).getId();
15565
+ this.emit('lineIndicator.setText', lineId, text);
15566
+ };
15525
15567
  Peaks.prototype.getVisibleSegments = function () {
15526
15568
  return this.view.getSegmentsGroup().getVisibleSegments();
15527
15569
  };
@@ -15572,7 +15614,7 @@ module.exports = function (Colors, EventEmitter, TimelineSegments, TimelineSourc
15572
15614
  };
15573
15615
  return Peaks;
15574
15616
  }(_dereq_('colors.css'), _dereq_('eventemitter2'), _dereq_('./timeline-segments'), _dereq_('./timeline-sources'), _dereq_('./keyboard-handler'), _dereq_('./player'), _dereq_('./marker-factories'), _dereq_('./timeline-zoomview'), _dereq_('./utils'));
15575
- },{"./keyboard-handler":90,"./marker-factories":95,"./player":98,"./timeline-segments":108,"./timeline-sources":109,"./timeline-zoomview":110,"./utils":111,"colors.css":1,"eventemitter2":2}],95:[function(_dereq_,module,exports){
15617
+ },{"./keyboard-handler":90,"./marker-factories":95,"./player":98,"./timeline-segments":109,"./timeline-sources":110,"./timeline-zoomview":111,"./utils":112,"colors.css":1,"eventemitter2":2}],95:[function(_dereq_,module,exports){
15576
15618
  module.exports = function (DefaultSegmentMarker, Utils, Konva) {
15577
15619
  'use strict';
15578
15620
  function createSegmentMarker(options) {
@@ -15604,7 +15646,7 @@ module.exports = function (DefaultSegmentMarker, Utils, Konva) {
15604
15646
  createSegmentLabel: createSegmentLabel
15605
15647
  };
15606
15648
  }(_dereq_('./default-segment-marker'), _dereq_('./utils'), _dereq_('konva'));
15607
- },{"./default-segment-marker":88,"./utils":111,"konva":43}],96:[function(_dereq_,module,exports){
15649
+ },{"./default-segment-marker":88,"./utils":112,"konva":43}],96:[function(_dereq_,module,exports){
15608
15650
  module.exports = function (Utils, SourceGroup, Konva) {
15609
15651
  'use strict';
15610
15652
  var TIME_X_OFFSET = 20;
@@ -15880,7 +15922,7 @@ module.exports = function (Utils, SourceGroup, Konva) {
15880
15922
  };
15881
15923
  return ModeLayer;
15882
15924
  }(_dereq_('./utils'), _dereq_('./source-group'), _dereq_('konva'));
15883
- },{"./source-group":104,"./utils":111,"konva":43}],97:[function(_dereq_,module,exports){
15925
+ },{"./source-group":104,"./utils":112,"konva":43}],97:[function(_dereq_,module,exports){
15884
15926
  module.exports = function (Konva) {
15885
15927
  'use strict';
15886
15928
  function getMarkerObject(obj) {
@@ -16009,7 +16051,7 @@ module.exports = function (Utils) {
16009
16051
  };
16010
16052
  return Player;
16011
16053
  }(_dereq_('./utils'));
16012
- },{"./utils":111}],99:[function(_dereq_,module,exports){
16054
+ },{"./utils":112}],99:[function(_dereq_,module,exports){
16013
16055
  module.exports = function (Utils, Konva) {
16014
16056
  'use strict';
16015
16057
  var HANDLE_RADIUS = 10;
@@ -16195,7 +16237,7 @@ module.exports = function (Utils, Konva) {
16195
16237
  };
16196
16238
  return PlayheadLayer;
16197
16239
  }(_dereq_('./utils'), _dereq_('konva'));
16198
- },{"./utils":111,"konva":43}],100:[function(_dereq_,module,exports){
16240
+ },{"./utils":112,"konva":43}],100:[function(_dereq_,module,exports){
16199
16241
  module.exports = function (Konva) {
16200
16242
  'use strict';
16201
16243
  function SegmentMarker(options) {
@@ -16647,7 +16689,7 @@ module.exports = function (Konva, SegmentMarker, Utils) {
16647
16689
  };
16648
16690
  return SegmentShape;
16649
16691
  }(_dereq_('konva'), _dereq_('./segment-marker'), _dereq_('./utils'));
16650
- },{"./segment-marker":100,"./utils":111,"konva":43}],102:[function(_dereq_,module,exports){
16692
+ },{"./segment-marker":100,"./utils":112,"konva":43}],102:[function(_dereq_,module,exports){
16651
16693
  module.exports = function (Utils) {
16652
16694
  'use strict';
16653
16695
  function validateSegment(peaks, options, context) {
@@ -16935,7 +16977,7 @@ module.exports = function (Utils) {
16935
16977
  };
16936
16978
  return Segment;
16937
16979
  }(_dereq_('./utils'));
16938
- },{"./utils":111}],103:[function(_dereq_,module,exports){
16980
+ },{"./utils":112}],103:[function(_dereq_,module,exports){
16939
16981
  module.exports = function (SegmentShape, Utils, Konva) {
16940
16982
  'use strict';
16941
16983
  function SegmentsGroup(peaks, view, allowEditing) {
@@ -17455,7 +17497,7 @@ module.exports = function (SegmentShape, Utils, Konva) {
17455
17497
  };
17456
17498
  return SegmentsGroup;
17457
17499
  }(_dereq_('./segment-shape'), _dereq_('./utils'), _dereq_('konva'));
17458
- },{"./segment-shape":101,"./utils":111,"konva":43}],104:[function(_dereq_,module,exports){
17500
+ },{"./segment-shape":101,"./utils":112,"konva":43}],104:[function(_dereq_,module,exports){
17459
17501
  module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17460
17502
  'use strict';
17461
17503
  var SPACING_BETWEEN_PREVIEW_AND_BORDER_RATIO = 0.15;
@@ -18176,7 +18218,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18176
18218
  };
18177
18219
  return SourceGroup;
18178
18220
  }(_dereq_('./waveform-builder'), _dereq_('./waveform-shape'), _dereq_('./utils'), _dereq_('konva'));
18179
- },{"./utils":111,"./waveform-builder":112,"./waveform-shape":113,"konva":43}],105:[function(_dereq_,module,exports){
18221
+ },{"./utils":112,"./waveform-builder":113,"./waveform-shape":114,"konva":43}],105:[function(_dereq_,module,exports){
18180
18222
  module.exports = function (Utils) {
18181
18223
  'use strict';
18182
18224
  function validateSource(peaks, options, context) {
@@ -18773,7 +18815,7 @@ module.exports = function (Utils) {
18773
18815
  };
18774
18816
  return Source;
18775
18817
  }(_dereq_('./utils'));
18776
- },{"./utils":111}],106:[function(_dereq_,module,exports){
18818
+ },{"./utils":112}],106:[function(_dereq_,module,exports){
18777
18819
  module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Konva) {
18778
18820
  'use strict';
18779
18821
  function SourcesLayer(peaks, view, allowEditing) {
@@ -19126,7 +19168,34 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
19126
19168
  };
19127
19169
  return SourcesLayer;
19128
19170
  }(_dereq_('./source-group'), _dereq_('./lines'), _dereq_('./data-retriever'), _dereq_('./utils'), _dereq_('./invoker'), _dereq_('konva'));
19129
- },{"./data-retriever":86,"./invoker":89,"./lines":93,"./source-group":104,"./utils":111,"konva":43}],107:[function(_dereq_,module,exports){
19171
+ },{"./data-retriever":86,"./invoker":89,"./lines":93,"./source-group":104,"./utils":112,"konva":43}],107:[function(_dereq_,module,exports){
19172
+ module.exports = function () {
19173
+ 'use strict';
19174
+ var SVGs = {
19175
+ volume: {
19176
+ width: 24,
19177
+ height: 24,
19178
+ path: 'M15.35 20.7262C15.0167 20.8595 14.7083 20.8179 14.425 20.6012C14.1417 20.3845 14 20.0845 14 19.7012C14 19.5179 14.0543 19.3555 14.163 19.2142C14.271 19.0722 14.4083 18.9679 14.575 18.9012C15.9083 18.3679 16.9793 17.5179 17.788 16.3512C18.596 15.1845 19 13.8679 19 12.4012C19 10.9345 18.596 9.61786 17.788 8.45119C16.9793 7.28452 15.9083 6.43452 14.575 5.90119C14.3917 5.83452 14.25 5.72619 14.15 5.57619C14.05 5.42619 14 5.25952 14 5.07619C14 4.70952 14.1417 4.41786 14.425 4.20119C14.7083 3.98452 15.0167 3.94286 15.35 4.07619C17.05 4.75952 18.4167 5.85119 19.45 7.35119C20.4833 8.85119 21 10.5345 21 12.4012C21 14.2679 20.4833 15.9512 19.45 17.4512C18.4167 18.9512 17.05 20.0429 15.35 20.7262ZM4 15.4262C3.71667 15.4262 3.47933 15.3302 3.288 15.1382C3.096 14.9469 3 14.7095 3 14.4262V10.4262C3 10.1429 3.096 9.90519 3.288 9.71319C3.47933 9.52186 3.71667 9.42619 4 9.42619H7L10.3 6.12619C10.6167 5.80952 10.979 5.73852 11.387 5.91319C11.7957 6.08852 12 6.40119 12 6.85119V18.0012C12 18.4512 11.7957 18.7635 11.387 18.9382C10.979 19.1135 10.6167 19.0429 10.3 18.7262L7 15.4262H4ZM14 16.4262V8.37619C14.75 8.72619 15.354 9.26786 15.812 10.0012C16.2707 10.7345 16.5 11.5429 16.5 12.4262C16.5 13.3095 16.2707 14.1095 15.812 14.8262C15.354 15.5429 14.75 16.0762 14 16.4262ZM10 9.27619L7.85 11.4262H5V13.4262H7.85L10 15.5762V9.27619Z'
19179
+ },
19180
+ noVolume: {
19181
+ width: 24,
19182
+ height: 24,
19183
+ path: 'M19.275 21.675L16.95 19.35C16.7167 19.4833 16.4833 19.6123 16.25 19.737C16.0167 19.8623 15.775 19.975 15.525 20.075C15.1917 20.2083 14.8833 20.1667 14.6 19.95C14.3167 19.7333 14.175 19.4333 14.175 19.05C14.175 18.8667 14.2293 18.7043 14.338 18.563C14.446 18.421 14.5833 18.3167 14.75 18.25C14.8833 18.2 15.0127 18.1457 15.138 18.087C15.2627 18.029 15.3833 17.9667 15.5 17.9L12.175 14.575V17.35C12.175 17.8 11.9707 18.1123 11.562 18.287C11.154 18.4623 10.7917 18.3917 10.475 18.075L7.175 14.775H4.175C3.89167 14.775 3.65433 14.679 3.463 14.487C3.271 14.2957 3.175 14.0583 3.175 13.775V9.775C3.175 9.49167 3.271 9.254 3.463 9.062C3.65433 8.87067 3.89167 8.775 4.175 8.775H6.375L2.275 4.675C2.09167 4.49167 2 4.25833 2 3.975C2 3.69167 2.09167 3.45833 2.275 3.275C2.45833 3.09167 2.69167 3 2.975 3C3.25833 3 3.49167 3.09167 3.675 3.275L20.675 20.275C20.8583 20.4583 20.95 20.6917 20.95 20.975C20.95 21.2583 20.8583 21.4917 20.675 21.675C20.4917 21.8583 20.2583 21.95 19.975 21.95C19.6917 21.95 19.4583 21.8583 19.275 21.675ZM15.525 3.425C17.225 4.10833 18.5917 5.2 19.625 6.7C20.6583 8.2 21.175 9.88333 21.175 11.75C21.175 12.6333 21.0543 13.4833 20.813 14.3C20.571 15.1167 20.225 15.875 19.775 16.575L18.325 15.125C18.6083 14.6083 18.821 14.0667 18.963 13.5C19.1043 12.9333 19.175 12.35 19.175 11.75C19.175 10.2833 18.771 8.96667 17.963 7.8C17.1543 6.63333 16.0833 5.78333 14.75 5.25C14.5667 5.18333 14.425 5.075 14.325 4.925C14.225 4.775 14.175 4.60833 14.175 4.425C14.175 4.05833 14.3167 3.76667 14.6 3.55C14.8833 3.33333 15.1917 3.29167 15.525 3.425ZM16.425 13.225L14.175 10.975V7.725C14.9583 8.09167 15.571 8.64167 16.013 9.375C16.4543 10.1083 16.675 10.9083 16.675 11.775C16.675 12.025 16.6543 12.271 16.613 12.513C16.571 12.7543 16.5083 12.9917 16.425 13.225ZM12.175 8.975L9.575 6.375L10.475 5.475C10.7917 5.15833 11.154 5.08733 11.562 5.262C11.9707 5.43733 12.175 5.75 12.175 6.2V8.975ZM10.175 14.925V12.575L8.375 10.775H5.175V12.775H8.025L10.175 14.925Z'
19184
+ },
19185
+ visibility: {
19186
+ width: 24,
19187
+ height: 24,
19188
+ path: 'M11.9998 17C13.2498 17 14.3125 16.5627 15.1878 15.688C16.0625 14.8127 16.4998 13.75 16.4998 12.5C16.4998 11.25 16.0625 10.1873 15.1878 9.312C14.3125 8.43733 13.2498 8 11.9998 8C10.7498 8 9.68714 8.43733 8.8118 9.312C7.93714 10.1873 7.4998 11.25 7.4998 12.5C7.4998 13.75 7.93714 14.8127 8.8118 15.688C9.68714 16.5627 10.7498 17 11.9998 17ZM11.9998 15.2C11.2498 15.2 10.6125 14.9373 10.0878 14.412C9.56247 13.8873 9.2998 13.25 9.2998 12.5C9.2998 11.75 9.56247 11.1123 10.0878 10.587C10.6125 10.0623 11.2498 9.8 11.9998 9.8C12.7498 9.8 13.3875 10.0623 13.9128 10.587C14.4375 11.1123 14.6998 11.75 14.6998 12.5C14.6998 13.25 14.4375 13.8873 13.9128 14.412C13.3875 14.9373 12.7498 15.2 11.9998 15.2ZM11.9998 20C9.68314 20 7.56647 19.3877 5.64981 18.163C3.73314 16.9377 2.28314 15.2833 1.2998 13.2C1.2498 13.1167 1.21647 13.0123 1.1998 12.887C1.18314 12.7623 1.1748 12.6333 1.1748 12.5C1.1748 12.3667 1.18314 12.2373 1.1998 12.112C1.21647 11.9873 1.2498 11.8833 1.2998 11.8C2.28314 9.71667 3.73314 8.06267 5.64981 6.838C7.56647 5.61267 9.68314 5 11.9998 5C14.3165 5 16.4331 5.61267 18.3498 6.838C20.2665 8.06267 21.7165 9.71667 22.6998 11.8C22.7498 11.8833 22.7831 11.9873 22.7998 12.112C22.8165 12.2373 22.8248 12.3667 22.8248 12.5C22.8248 12.6333 22.8165 12.7623 22.7998 12.887C22.7831 13.0123 22.7498 13.1167 22.6998 13.2C21.7165 15.2833 20.2665 16.9377 18.3498 18.163C16.4331 19.3877 14.3165 20 11.9998 20ZM11.9998 18C13.8831 18 15.6125 17.504 17.1878 16.512C18.7625 15.5207 19.9665 14.1833 20.7998 12.5C19.9665 10.8167 18.7625 9.479 17.1878 8.487C15.6125 7.49567 13.8831 7 11.9998 7C10.1165 7 8.38714 7.49567 6.8118 8.487C5.23714 9.479 4.03314 10.8167 3.1998 12.5C4.03314 14.1833 5.23714 15.5207 6.8118 16.512C8.38714 17.504 10.1165 18 11.9998 18Z'
19189
+ },
19190
+ noVisibility: {
19191
+ width: 24,
19192
+ height: 24,
19193
+ path: 'M16.0998 13.3L14.6498 11.85C14.7998 11.0666 14.5748 10.3333 13.9748 9.64998C13.3748 8.96664 12.5998 8.69998 11.6498 8.84998L10.1998 7.39998C10.4831 7.26664 10.7705 7.16664 11.0618 7.09998C11.3538 7.03331 11.6665 6.99998 11.9998 6.99998C13.2498 6.99998 14.3125 7.43731 15.1878 8.31198C16.0625 9.18731 16.4998 10.25 16.4998 11.5C16.4998 11.8333 16.4665 12.146 16.3998 12.438C16.3331 12.7293 16.2331 13.0166 16.0998 13.3ZM19.2998 16.45L17.8498 15.05C18.4831 14.5666 19.0458 14.0373 19.5378 13.462C20.0291 12.8873 20.4498 12.2333 20.7998 11.5C19.9665 9.81664 18.7705 8.47898 17.2118 7.48698C15.6538 6.49564 13.9165 5.99998 11.9998 5.99998C11.5165 5.99998 11.0415 6.03331 10.5748 6.09998C10.1081 6.16664 9.6498 6.26664 9.1998 6.39998L7.64981 4.84998C8.33314 4.56664 9.03314 4.35398 9.7498 4.21198C10.4665 4.07064 11.2165 3.99998 11.9998 3.99998C14.3831 3.99998 16.5248 4.62898 18.4248 5.88698C20.3248 7.14564 21.7498 8.78331 22.6998 10.8C22.7498 10.8833 22.7831 10.9873 22.7998 11.112C22.8165 11.2373 22.8248 11.3666 22.8248 11.5C22.8248 11.6333 22.8125 11.7623 22.7878 11.887C22.7625 12.0123 22.7331 12.1166 22.6998 12.2C22.3165 13.05 21.8375 13.8333 21.2628 14.55C20.6875 15.2666 20.0331 15.9 19.2998 16.45ZM19.0998 21.9L15.5998 18.45C15.0165 18.6333 14.4291 18.771 13.8378 18.863C13.2458 18.9543 12.6331 19 11.9998 19C9.61647 19 7.4748 18.371 5.5748 17.113C3.6748 15.8543 2.2498 14.2166 1.2998 12.2C1.2498 12.1166 1.21647 12.0123 1.1998 11.887C1.18314 11.7623 1.1748 11.6333 1.1748 11.5C1.1748 11.3666 1.18314 11.2416 1.1998 11.125C1.21647 11.0083 1.2498 10.9083 1.2998 10.825C1.6498 10.075 2.06647 9.38331 2.5498 8.74998C3.03314 8.11664 3.56647 7.53331 4.1498 6.99998L2.0748 4.89998C1.89147 4.71664 1.7998 4.48731 1.7998 4.21198C1.7998 3.93731 1.8998 3.69998 2.0998 3.49998C2.28314 3.31664 2.51647 3.22498 2.7998 3.22498C3.08314 3.22498 3.31647 3.31664 3.4998 3.49998L20.4998 20.5C20.6831 20.6833 20.7791 20.9126 20.7878 21.188C20.7958 21.4626 20.6998 21.7 20.4998 21.9C20.3165 22.0833 20.0831 22.175 19.7998 22.175C19.5165 22.175 19.2831 22.0833 19.0998 21.9ZM5.5498 8.39998C5.06647 8.83331 4.6248 9.30831 4.2248 9.82498C3.8248 10.3416 3.48314 10.9 3.1998 11.5C4.03314 13.1833 5.22881 14.5206 6.78681 15.512C8.34547 16.504 10.0831 17 11.9998 17C12.3331 17 12.6581 16.9793 12.9748 16.938C13.2915 16.896 13.6165 16.85 13.9498 16.8L13.0498 15.85C12.8665 15.9 12.6915 15.9373 12.5248 15.962C12.3581 15.9873 12.1831 16 11.9998 16C10.7498 16 9.68714 15.5626 8.8118 14.688C7.93714 13.8126 7.4998 12.75 7.4998 11.5C7.4998 11.3166 7.51214 11.1416 7.53681 10.975C7.56214 10.8083 7.5998 10.6333 7.64981 10.45L5.5498 8.39998Z'
19194
+ }
19195
+ };
19196
+ return SVGs;
19197
+ }();
19198
+ },{}],108:[function(_dereq_,module,exports){
19130
19199
  module.exports = function (Utils, Konva) {
19131
19200
  'use strict';
19132
19201
  var LEFT_PADDING = 4;
@@ -19268,7 +19337,7 @@ module.exports = function (Utils, Konva) {
19268
19337
  };
19269
19338
  return TimelineAxis;
19270
19339
  }(_dereq_('./utils'), _dereq_('konva'));
19271
- },{"./utils":111,"konva":43}],108:[function(_dereq_,module,exports){
19340
+ },{"./utils":112,"konva":43}],109:[function(_dereq_,module,exports){
19272
19341
  module.exports = function (Colors, Segment, Utils) {
19273
19342
  'use strict';
19274
19343
  function TimelineSegments(peaks) {
@@ -19430,7 +19499,7 @@ module.exports = function (Colors, Segment, Utils) {
19430
19499
  };
19431
19500
  return TimelineSegments;
19432
19501
  }(_dereq_('colors.css'), _dereq_('./segment'), _dereq_('./utils'));
19433
- },{"./segment":102,"./utils":111,"colors.css":1}],109:[function(_dereq_,module,exports){
19502
+ },{"./segment":102,"./utils":112,"colors.css":1}],110:[function(_dereq_,module,exports){
19434
19503
  module.exports = function (Source, Utils) {
19435
19504
  'use strict';
19436
19505
  function TimelineSources(peaks) {
@@ -19601,7 +19670,7 @@ module.exports = function (Source, Utils) {
19601
19670
  };
19602
19671
  return TimelineSources;
19603
19672
  }(_dereq_('./source'), _dereq_('./utils'));
19604
- },{"./source":105,"./utils":111}],110:[function(_dereq_,module,exports){
19673
+ },{"./source":105,"./utils":112}],111:[function(_dereq_,module,exports){
19605
19674
  module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLayer, TimelineAxis, Utils, Konva) {
19606
19675
  'use strict';
19607
19676
  function TimelineZoomView(container, peaks) {
@@ -20161,7 +20230,7 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
20161
20230
  };
20162
20231
  return TimelineZoomView;
20163
20232
  }(_dereq_('./mouse-drag-handler'), _dereq_('./playhead-layer'), _dereq_('./sources-layer'), _dereq_('./mode-layer'), _dereq_('./timeline-axis'), _dereq_('./utils'), _dereq_('konva'));
20164
- },{"./mode-layer":96,"./mouse-drag-handler":97,"./playhead-layer":99,"./sources-layer":106,"./timeline-axis":107,"./utils":111,"konva":43}],111:[function(_dereq_,module,exports){
20233
+ },{"./mode-layer":96,"./mouse-drag-handler":97,"./playhead-layer":99,"./sources-layer":106,"./timeline-axis":108,"./utils":112,"konva":43}],112:[function(_dereq_,module,exports){
20165
20234
  module.exports = function (UUID) {
20166
20235
  'use strict';
20167
20236
  if (typeof Number.isFinite !== 'function') {
@@ -20325,7 +20394,7 @@ module.exports = function (UUID) {
20325
20394
  }
20326
20395
  };
20327
20396
  }(_dereq_('uuid'));
20328
- },{"uuid":62}],112:[function(_dereq_,module,exports){
20397
+ },{"uuid":62}],113:[function(_dereq_,module,exports){
20329
20398
  module.exports = function (WaveformData, Utils) {
20330
20399
  'use strict';
20331
20400
  var isXhr2 = 'withCredentials' in new XMLHttpRequest();
@@ -20517,7 +20586,7 @@ module.exports = function (WaveformData, Utils) {
20517
20586
  };
20518
20587
  return WaveformBuilder;
20519
20588
  }(_dereq_('waveform-data'), _dereq_('./utils'));
20520
- },{"./utils":111,"waveform-data":85}],113:[function(_dereq_,module,exports){
20589
+ },{"./utils":112,"waveform-data":85}],114:[function(_dereq_,module,exports){
20521
20590
  module.exports = function (Utils, Konva) {
20522
20591
  'use strict';
20523
20592
  function scaleY(amplitude, height, scale) {
@@ -20607,6 +20676,6 @@ module.exports = function (Utils, Konva) {
20607
20676
  };
20608
20677
  return WaveformShape;
20609
20678
  }(_dereq_('./utils'), _dereq_('konva'));
20610
- },{"./utils":111,"konva":43}]},{},[94])(94)
20679
+ },{"./utils":112,"konva":43}]},{},[94])(94)
20611
20680
  });
20612
20681
  //# sourceMappingURL=peaks.js.map
@@ -8,10 +8,12 @@
8
8
 
9
9
  define([
10
10
  'konva',
11
- './utils'
11
+ './utils',
12
+ './svgs'
12
13
  ], function(
13
14
  Konva,
14
- Utils) {
15
+ Utils,
16
+ SVGs) {
15
17
  'use strict';
16
18
 
17
19
  /**
@@ -32,7 +34,19 @@ define([
32
34
  this._width = this._peaks.options.lineIndicatorWidth;
33
35
  this._height = this._view.getHeight();
34
36
 
35
- this._indicatorRadius = this._width / 4;
37
+ this._sizes = {
38
+ font: this._peaks.options.lineIndicatorFontSize,
39
+ icon: {
40
+ default: this._peaks.options.lineIndicatorDefaultIconSize,
41
+ volume: this._peaks.options.lineIndicatorVolumeIconSize,
42
+ noVolume: this._peaks.options.lineIndicatorNoVolumeIconSize,
43
+ visibility: this._peaks.options.lineIndicatorVisibilityIconSize,
44
+ noVisibility: this._peaks.options.lineIndicatorNoVisibilityIconSize
45
+ }
46
+ };
47
+
48
+ this._defaultPadding = 5;
49
+ this._types = ['default'].concat(Object.keys(SVGs));
36
50
 
37
51
  this._stage = new Konva.Stage({
38
52
  container: container,
@@ -59,15 +73,8 @@ define([
59
73
  this._createContextMenu();
60
74
  }
61
75
 
62
- /* eslint-disable max-len */
63
- this.ICON_SIZE = 18;
64
- this._volumeSVGPath = 'M0 6.00001V12H4L9 17V1.00001L4 6.00001H0ZM13.5 9.00001C13.5 7.23001 12.48 5.71001 11 4.97001V13.02C12.48 12.29 13.5 10.77 13.5 9.00001ZM11 0.230011V2.29001C13.89 3.15001 16 5.83001 16 9.00001C16 12.17 13.89 14.85 11 15.71V17.77C15.01 16.86 18 13.28 18 9.00001C18 4.72001 15.01 1.14001 11 0.230011Z';
65
- this._noVolumeSVGPath = 'M13.5 9C13.5 7.23 12.48 5.71 11 4.97V7.18L13.45 9.63C13.48 9.43 13.5 9.22 13.5 9ZM16 9C16 9.94 15.8 10.82 15.46 11.64L16.97 13.15C17.63 11.91 18 10.5 18 9C18 4.72 15.01 1.14 11 0.23V2.29C13.89 3.15 16 5.83 16 9ZM1.27 0L0 1.27L4.73 6H0V12H4L9 17V10.27L13.25 14.52C12.58 15.04 11.83 15.45 11 15.7V17.76C12.38 17.45 13.63 16.81 14.69 15.95L16.73 18L18 16.73L9 7.73L1.27 0ZM9 1L6.91 3.09L9 5.18V1Z';
66
- /* eslint-enable max-len */
67
-
68
76
  this._peaks.on('lineIndicator.setType', this._onSetType.bind(this));
69
-
70
- this._types = ['default', 'volume', 'noVolume'];
77
+ this._peaks.on('lineIndicator.setText', this._onSetText.bind(this));
71
78
  }
72
79
 
73
80
  LineIndicator.prototype.fitToView = function() {
@@ -85,7 +92,8 @@ define([
85
92
 
86
93
  var indicator = this._createIndicator(
87
94
  this._indicators[lineId].line,
88
- type
95
+ type,
96
+ this._indicators[lineId].text
89
97
  );
90
98
 
91
99
  this._layer.add(indicator);
@@ -96,6 +104,23 @@ define([
96
104
  this.draw();
97
105
  };
98
106
 
107
+ LineIndicator.prototype._onSetText = function(lineId, text) {
108
+ this.removeIndicator(lineId, true);
109
+
110
+ var indicator = this._createIndicator(
111
+ this._indicators[lineId].line,
112
+ this._indicators[lineId].type,
113
+ text
114
+ );
115
+
116
+ this._layer.add(indicator);
117
+
118
+ this._indicators[lineId].indicator = indicator;
119
+ this._indicators[lineId].text = text;
120
+
121
+ this.draw();
122
+ };
123
+
99
124
  LineIndicator.prototype._showMenu = function(menu) {
100
125
  menu.style.display = 'block';
101
126
  var containerRect = this._stage.container().getBoundingClientRect();
@@ -106,48 +131,76 @@ define([
106
131
  menu.style.left = containerRect.left + this._stage.getPointerPosition().x + 6 + 'px';
107
132
  };
108
133
 
109
- LineIndicator.prototype._createIndicator = function(line, type) {
110
- var indicator;
134
+ LineIndicator.prototype._createIndicator = function(line, type, text) {
135
+ var indicator = new Konva.Group();
136
+ var indicatorHeight = 0;
111
137
 
112
- type = typeof type !== 'undefined' ? type : 'default';
138
+ if (text) {
139
+ var textNode = new Konva.Text({
140
+ text: text,
141
+ fontSize: this._sizes.font,
142
+ fontFamily: 'Arial',
143
+ fill: this._peaks.options.lineIndicatorColor,
144
+ align: 'center',
145
+ width: this._width
146
+ });
147
+
148
+ indicator.add(textNode);
149
+ indicatorHeight += this._sizes.font;
150
+ }
151
+
152
+ type = this._types.includes(type) ? type : 'default';
153
+
154
+ var iconNode;
113
155
 
114
156
  if (type === 'default') {
115
- indicator = new Konva.Circle({
157
+ var padding = text ? this._defaultPadding : 0;
158
+
159
+ iconNode = new Konva.Circle({
116
160
  x: this._width / 2,
117
- y: line.getY() + (line.lineHeight() / 2),
118
- radius: this._indicatorRadius,
161
+ y: indicatorHeight + this._sizes.icon.default / 2 + padding,
162
+ radius: this._sizes.icon.default / 2,
119
163
  fill: this._peaks.options.lineIndicatorColor,
120
164
  strokeWidth: 0,
121
165
  lineId: line.getId()
122
166
  });
167
+
168
+ indicatorHeight += padding;
123
169
  }
124
170
  else {
125
- var scaleFactor = (this._width / 2) / this.ICON_SIZE;
126
-
127
- indicator = new Konva.Path({
128
- x: this._width / 4,
129
- y: line.getY() + (line.lineHeight() / 2) - (this._width / 4),
130
- data: type === 'volume' ?
131
- this._volumeSVGPath :
132
- this._noVolumeSVGPath,
171
+ iconNode = new Konva.Path({
172
+ x: (this._width - this._sizes.icon[type]) / 2,
173
+ y: indicatorHeight,
174
+ data: SVGs[type].path,
133
175
  fill: this._peaks.options.lineIndicatorColor,
134
176
  scale: {
135
- x: scaleFactor,
136
- y: scaleFactor
177
+ x: (this._sizes.icon[type]) / SVGs[type].width,
178
+ y: (this._sizes.icon[type]) / SVGs[type].height
137
179
  },
138
180
  lineId: line.getId()
139
181
  });
140
182
  }
141
183
 
184
+ indicator.add(iconNode);
185
+ indicatorHeight += this._sizes.icon[type];
186
+
187
+ indicator.setAttr('trueHeight', indicatorHeight);
188
+
189
+ indicator.y(line.getY() + (line.lineHeight() - indicatorHeight) / 2);
190
+
142
191
  var self = this;
143
192
 
144
193
  indicator.on('mouseover', function() {
145
- indicator.fill(self._peaks.options.lineIndicatorSelected);
194
+ indicator.getChildren().forEach(function(child) {
195
+ child.fill(self._peaks.options.lineIndicatorSelected);
196
+ });
146
197
  self.draw();
147
198
  });
148
199
 
149
200
  indicator.on('mouseout', function() {
150
- indicator.fill(self._peaks.options.lineIndicatorColor);
201
+ indicator.getChildren().forEach(function(child) {
202
+ child.fill(self._peaks.options.lineIndicatorColor);
203
+ });
151
204
  self.draw();
152
205
  });
153
206
 
@@ -186,28 +239,25 @@ define([
186
239
  }
187
240
  };
188
241
 
189
- LineIndicator.prototype.getPixelsFromCenter = function(lineId) {
190
- return this._indicators[lineId].type === 'default' ?
191
- 0 :
192
- this._width / 4;
193
- };
194
-
195
242
  LineIndicator.prototype.updateIndicator = function(lineId) {
196
243
  if (this._indicators[lineId]) {
197
244
  var y = this._indicators[lineId].line.getY()
198
- + (this._indicators[lineId].line.lineHeight() / 2);
245
+ + (this._indicators[lineId].line.lineHeight() / 2);
199
246
 
200
- if (y + this._indicatorRadius > 0 && y - this._indicatorRadius < this._height) {
247
+ if (y + this._indicators[lineId].line.lineHeight() > 0 && y < this._height) {
201
248
  // The indicator is visible
202
249
  if (!this._indicators[lineId].indicator) {
203
250
  this._indicators[lineId].indicator = this._createIndicator(
204
251
  this._indicators[lineId].line,
205
- this._indicators[lineId].type
252
+ this._indicators[lineId].type,
253
+ this._indicators[lineId].text
206
254
  );
207
255
  this._layer.add(this._indicators[lineId].indicator);
208
256
  }
209
257
  else {
210
- this._indicators[lineId].indicator.y(y - this.getPixelsFromCenter(lineId));
258
+ this._indicators[lineId].indicator.y(
259
+ y - this._indicators[lineId].indicator.getAttr('trueHeight') / 2
260
+ );
211
261
  }
212
262
  }
213
263
  else {
package/src/main.js CHANGED
@@ -281,8 +281,38 @@ define([
281
281
  lineIndicatorWidth: 20,
282
282
 
283
283
  /**
284
- * Color of the line indicators
284
+ * Size of the line indicators' icon, in pixels
285
+ */
286
+ lineIndicatorDefaultIconSize: 19,
287
+
288
+ /**
289
+ * Size of the line indicators' volume icon, in pixels
290
+ */
291
+ lineIndicatorVolumeIconSize: 24,
292
+
293
+ /**
294
+ * Size of the line indicators' no volume, in pixels
295
+ */
296
+ lineIndicatorNoVolumeIconSize: 24,
297
+
298
+ /**
299
+ * Size of the line indicators' visibility, in pixels
285
300
  */
301
+ lineIndicatorVisibilityIconSize: 24,
302
+
303
+ /**
304
+ * Size of the line indicators' no visibility icon, in pixels
305
+ */
306
+ lineIndicatorNoVisibilityIconSize: 24,
307
+
308
+ /**
309
+ * Font size of the line indicators' text, in pixels
310
+ */
311
+ lineIndicatorFontSize: 10,
312
+
313
+ /**
314
+ * Color of the line indicators
315
+ */
286
316
  lineIndicatorColor: '#8A8F98',
287
317
 
288
318
  /**
@@ -624,6 +654,12 @@ define([
624
654
  this.emit('lineIndicator.setType', lineId, type);
625
655
  };
626
656
 
657
+ Peaks.prototype.setIndicatorText = function(linePosition, text) {
658
+ var lineId = this.view.getLineByPosition(linePosition).getId();
659
+
660
+ this.emit('lineIndicator.setText', lineId, text);
661
+ };
662
+
627
663
  Peaks.prototype.getVisibleSegments = function() {
628
664
  return this.view
629
665
  .getSegmentsGroup()
package/src/svgs.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @file
3
+ *
4
+ * Defines the {@link data} class.
5
+ *
6
+ * @module data
7
+ */
8
+
9
+ define([
10
+ ], function() {
11
+ 'use strict';
12
+
13
+ /**
14
+ * A data object associated with a source.
15
+ *
16
+ * @class
17
+ * @alias Data
18
+ *
19
+ * @param {String} type The MIME type (image, video, audio...)
20
+ * @param {Object} content Content of the data retrieved.
21
+ */
22
+
23
+ /* eslint-disable max-len */
24
+ var SVGs = {
25
+ volume: {
26
+ width: 24,
27
+ height: 24,
28
+ path: 'M15.35 20.7262C15.0167 20.8595 14.7083 20.8179 14.425 20.6012C14.1417 20.3845 14 20.0845 14 19.7012C14 19.5179 14.0543 19.3555 14.163 19.2142C14.271 19.0722 14.4083 18.9679 14.575 18.9012C15.9083 18.3679 16.9793 17.5179 17.788 16.3512C18.596 15.1845 19 13.8679 19 12.4012C19 10.9345 18.596 9.61786 17.788 8.45119C16.9793 7.28452 15.9083 6.43452 14.575 5.90119C14.3917 5.83452 14.25 5.72619 14.15 5.57619C14.05 5.42619 14 5.25952 14 5.07619C14 4.70952 14.1417 4.41786 14.425 4.20119C14.7083 3.98452 15.0167 3.94286 15.35 4.07619C17.05 4.75952 18.4167 5.85119 19.45 7.35119C20.4833 8.85119 21 10.5345 21 12.4012C21 14.2679 20.4833 15.9512 19.45 17.4512C18.4167 18.9512 17.05 20.0429 15.35 20.7262ZM4 15.4262C3.71667 15.4262 3.47933 15.3302 3.288 15.1382C3.096 14.9469 3 14.7095 3 14.4262V10.4262C3 10.1429 3.096 9.90519 3.288 9.71319C3.47933 9.52186 3.71667 9.42619 4 9.42619H7L10.3 6.12619C10.6167 5.80952 10.979 5.73852 11.387 5.91319C11.7957 6.08852 12 6.40119 12 6.85119V18.0012C12 18.4512 11.7957 18.7635 11.387 18.9382C10.979 19.1135 10.6167 19.0429 10.3 18.7262L7 15.4262H4ZM14 16.4262V8.37619C14.75 8.72619 15.354 9.26786 15.812 10.0012C16.2707 10.7345 16.5 11.5429 16.5 12.4262C16.5 13.3095 16.2707 14.1095 15.812 14.8262C15.354 15.5429 14.75 16.0762 14 16.4262ZM10 9.27619L7.85 11.4262H5V13.4262H7.85L10 15.5762V9.27619Z'
29
+ },
30
+ noVolume: {
31
+ width: 24,
32
+ height: 24,
33
+ path: 'M19.275 21.675L16.95 19.35C16.7167 19.4833 16.4833 19.6123 16.25 19.737C16.0167 19.8623 15.775 19.975 15.525 20.075C15.1917 20.2083 14.8833 20.1667 14.6 19.95C14.3167 19.7333 14.175 19.4333 14.175 19.05C14.175 18.8667 14.2293 18.7043 14.338 18.563C14.446 18.421 14.5833 18.3167 14.75 18.25C14.8833 18.2 15.0127 18.1457 15.138 18.087C15.2627 18.029 15.3833 17.9667 15.5 17.9L12.175 14.575V17.35C12.175 17.8 11.9707 18.1123 11.562 18.287C11.154 18.4623 10.7917 18.3917 10.475 18.075L7.175 14.775H4.175C3.89167 14.775 3.65433 14.679 3.463 14.487C3.271 14.2957 3.175 14.0583 3.175 13.775V9.775C3.175 9.49167 3.271 9.254 3.463 9.062C3.65433 8.87067 3.89167 8.775 4.175 8.775H6.375L2.275 4.675C2.09167 4.49167 2 4.25833 2 3.975C2 3.69167 2.09167 3.45833 2.275 3.275C2.45833 3.09167 2.69167 3 2.975 3C3.25833 3 3.49167 3.09167 3.675 3.275L20.675 20.275C20.8583 20.4583 20.95 20.6917 20.95 20.975C20.95 21.2583 20.8583 21.4917 20.675 21.675C20.4917 21.8583 20.2583 21.95 19.975 21.95C19.6917 21.95 19.4583 21.8583 19.275 21.675ZM15.525 3.425C17.225 4.10833 18.5917 5.2 19.625 6.7C20.6583 8.2 21.175 9.88333 21.175 11.75C21.175 12.6333 21.0543 13.4833 20.813 14.3C20.571 15.1167 20.225 15.875 19.775 16.575L18.325 15.125C18.6083 14.6083 18.821 14.0667 18.963 13.5C19.1043 12.9333 19.175 12.35 19.175 11.75C19.175 10.2833 18.771 8.96667 17.963 7.8C17.1543 6.63333 16.0833 5.78333 14.75 5.25C14.5667 5.18333 14.425 5.075 14.325 4.925C14.225 4.775 14.175 4.60833 14.175 4.425C14.175 4.05833 14.3167 3.76667 14.6 3.55C14.8833 3.33333 15.1917 3.29167 15.525 3.425ZM16.425 13.225L14.175 10.975V7.725C14.9583 8.09167 15.571 8.64167 16.013 9.375C16.4543 10.1083 16.675 10.9083 16.675 11.775C16.675 12.025 16.6543 12.271 16.613 12.513C16.571 12.7543 16.5083 12.9917 16.425 13.225ZM12.175 8.975L9.575 6.375L10.475 5.475C10.7917 5.15833 11.154 5.08733 11.562 5.262C11.9707 5.43733 12.175 5.75 12.175 6.2V8.975ZM10.175 14.925V12.575L8.375 10.775H5.175V12.775H8.025L10.175 14.925Z'
34
+ },
35
+ visibility: {
36
+ width: 24,
37
+ height: 24,
38
+ path: 'M11.9998 17C13.2498 17 14.3125 16.5627 15.1878 15.688C16.0625 14.8127 16.4998 13.75 16.4998 12.5C16.4998 11.25 16.0625 10.1873 15.1878 9.312C14.3125 8.43733 13.2498 8 11.9998 8C10.7498 8 9.68714 8.43733 8.8118 9.312C7.93714 10.1873 7.4998 11.25 7.4998 12.5C7.4998 13.75 7.93714 14.8127 8.8118 15.688C9.68714 16.5627 10.7498 17 11.9998 17ZM11.9998 15.2C11.2498 15.2 10.6125 14.9373 10.0878 14.412C9.56247 13.8873 9.2998 13.25 9.2998 12.5C9.2998 11.75 9.56247 11.1123 10.0878 10.587C10.6125 10.0623 11.2498 9.8 11.9998 9.8C12.7498 9.8 13.3875 10.0623 13.9128 10.587C14.4375 11.1123 14.6998 11.75 14.6998 12.5C14.6998 13.25 14.4375 13.8873 13.9128 14.412C13.3875 14.9373 12.7498 15.2 11.9998 15.2ZM11.9998 20C9.68314 20 7.56647 19.3877 5.64981 18.163C3.73314 16.9377 2.28314 15.2833 1.2998 13.2C1.2498 13.1167 1.21647 13.0123 1.1998 12.887C1.18314 12.7623 1.1748 12.6333 1.1748 12.5C1.1748 12.3667 1.18314 12.2373 1.1998 12.112C1.21647 11.9873 1.2498 11.8833 1.2998 11.8C2.28314 9.71667 3.73314 8.06267 5.64981 6.838C7.56647 5.61267 9.68314 5 11.9998 5C14.3165 5 16.4331 5.61267 18.3498 6.838C20.2665 8.06267 21.7165 9.71667 22.6998 11.8C22.7498 11.8833 22.7831 11.9873 22.7998 12.112C22.8165 12.2373 22.8248 12.3667 22.8248 12.5C22.8248 12.6333 22.8165 12.7623 22.7998 12.887C22.7831 13.0123 22.7498 13.1167 22.6998 13.2C21.7165 15.2833 20.2665 16.9377 18.3498 18.163C16.4331 19.3877 14.3165 20 11.9998 20ZM11.9998 18C13.8831 18 15.6125 17.504 17.1878 16.512C18.7625 15.5207 19.9665 14.1833 20.7998 12.5C19.9665 10.8167 18.7625 9.479 17.1878 8.487C15.6125 7.49567 13.8831 7 11.9998 7C10.1165 7 8.38714 7.49567 6.8118 8.487C5.23714 9.479 4.03314 10.8167 3.1998 12.5C4.03314 14.1833 5.23714 15.5207 6.8118 16.512C8.38714 17.504 10.1165 18 11.9998 18Z'
39
+ },
40
+ noVisibility: {
41
+ width: 24,
42
+ height: 24,
43
+ path: 'M16.0998 13.3L14.6498 11.85C14.7998 11.0666 14.5748 10.3333 13.9748 9.64998C13.3748 8.96664 12.5998 8.69998 11.6498 8.84998L10.1998 7.39998C10.4831 7.26664 10.7705 7.16664 11.0618 7.09998C11.3538 7.03331 11.6665 6.99998 11.9998 6.99998C13.2498 6.99998 14.3125 7.43731 15.1878 8.31198C16.0625 9.18731 16.4998 10.25 16.4998 11.5C16.4998 11.8333 16.4665 12.146 16.3998 12.438C16.3331 12.7293 16.2331 13.0166 16.0998 13.3ZM19.2998 16.45L17.8498 15.05C18.4831 14.5666 19.0458 14.0373 19.5378 13.462C20.0291 12.8873 20.4498 12.2333 20.7998 11.5C19.9665 9.81664 18.7705 8.47898 17.2118 7.48698C15.6538 6.49564 13.9165 5.99998 11.9998 5.99998C11.5165 5.99998 11.0415 6.03331 10.5748 6.09998C10.1081 6.16664 9.6498 6.26664 9.1998 6.39998L7.64981 4.84998C8.33314 4.56664 9.03314 4.35398 9.7498 4.21198C10.4665 4.07064 11.2165 3.99998 11.9998 3.99998C14.3831 3.99998 16.5248 4.62898 18.4248 5.88698C20.3248 7.14564 21.7498 8.78331 22.6998 10.8C22.7498 10.8833 22.7831 10.9873 22.7998 11.112C22.8165 11.2373 22.8248 11.3666 22.8248 11.5C22.8248 11.6333 22.8125 11.7623 22.7878 11.887C22.7625 12.0123 22.7331 12.1166 22.6998 12.2C22.3165 13.05 21.8375 13.8333 21.2628 14.55C20.6875 15.2666 20.0331 15.9 19.2998 16.45ZM19.0998 21.9L15.5998 18.45C15.0165 18.6333 14.4291 18.771 13.8378 18.863C13.2458 18.9543 12.6331 19 11.9998 19C9.61647 19 7.4748 18.371 5.5748 17.113C3.6748 15.8543 2.2498 14.2166 1.2998 12.2C1.2498 12.1166 1.21647 12.0123 1.1998 11.887C1.18314 11.7623 1.1748 11.6333 1.1748 11.5C1.1748 11.3666 1.18314 11.2416 1.1998 11.125C1.21647 11.0083 1.2498 10.9083 1.2998 10.825C1.6498 10.075 2.06647 9.38331 2.5498 8.74998C3.03314 8.11664 3.56647 7.53331 4.1498 6.99998L2.0748 4.89998C1.89147 4.71664 1.7998 4.48731 1.7998 4.21198C1.7998 3.93731 1.8998 3.69998 2.0998 3.49998C2.28314 3.31664 2.51647 3.22498 2.7998 3.22498C3.08314 3.22498 3.31647 3.31664 3.4998 3.49998L20.4998 20.5C20.6831 20.6833 20.7791 20.9126 20.7878 21.188C20.7958 21.4626 20.6998 21.7 20.4998 21.9C20.3165 22.0833 20.0831 22.175 19.7998 22.175C19.5165 22.175 19.2831 22.0833 19.0998 21.9ZM5.5498 8.39998C5.06647 8.83331 4.6248 9.30831 4.2248 9.82498C3.8248 10.3416 3.48314 10.9 3.1998 11.5C4.03314 13.1833 5.22881 14.5206 6.78681 15.512C8.34547 16.504 10.0831 17 11.9998 17C12.3331 17 12.6581 16.9793 12.9748 16.938C13.2915 16.896 13.6165 16.85 13.9498 16.8L13.0498 15.85C12.8665 15.9 12.6915 15.9373 12.5248 15.962C12.3581 15.9873 12.1831 16 11.9998 16C10.7498 16 9.68714 15.5626 8.8118 14.688C7.93714 13.8126 7.4998 12.75 7.4998 11.5C7.4998 11.3166 7.51214 11.1416 7.53681 10.975C7.56214 10.8083 7.5998 10.6333 7.64981 10.45L5.5498 8.39998Z'
44
+ }
45
+ };
46
+ /* eslint-enable max-len */
47
+
48
+ return SVGs;
49
+ });