@checksub_team/peaks_timeline 1.6.0-beta.0 → 1.6.0-beta.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.6.0-beta.0",
3
+ "version": "1.6.0-beta.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
@@ -17769,38 +17769,45 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17769
17769
  self.drawSourceShape(ctx, null, true);
17770
17770
  }
17771
17771
  });
17772
- var background = new Konva.Shape({
17773
- fill: this._source.backgroundColor,
17774
- sceneFunc: function (ctx, shape) {
17775
- self.drawSourceShape(ctx, shape, true);
17776
- },
17777
- draggable: this._source.draggable,
17778
- dragBoundFunc: function () {
17779
- return self._onSourceGroupDrag(this);
17780
- }
17781
- });
17782
17772
  if (this._source.draggable) {
17783
- background.on('mouseenter', function () {
17773
+ unwrap.on('mouseenter', function () {
17784
17774
  self._view.setCursor('pointer');
17785
17775
  });
17786
- background.on('mouseout', function () {
17776
+ unwrap.on('mouseout', function () {
17787
17777
  self._view.setCursor('default');
17788
17778
  });
17789
- background.on('dragstart', function () {
17779
+ unwrap.on('dragstart', function () {
17790
17780
  this._scrollInterval = null;
17791
17781
  });
17792
- background.on('dragend', function () {
17782
+ unwrap.on('dragend', function () {
17793
17783
  if (this._scrollingInterval) {
17794
17784
  clearInterval(this._scrollingInterval);
17795
17785
  this._scrollingInterval = null;
17796
17786
  }
17797
17787
  });
17798
17788
  }
17799
- var title = this._createTitle(false);
17789
+ var background = new Konva.Group();
17790
+ background.add(new Konva.Shape({
17791
+ fill: this._source.backgroundColor,
17792
+ sceneFunc: function (ctx, shape) {
17793
+ self.drawSourceShape(ctx, shape, true);
17794
+ },
17795
+ draggable: this._source.draggable,
17796
+ dragBoundFunc: function () {
17797
+ return self._onSourceGroupDrag(this);
17798
+ }
17799
+ }));
17800
17800
  unwrap.add(background);
17801
- unwrap.add(title);
17801
+ unwrap.add(this._createTitle(false));
17802
17802
  return unwrap;
17803
17803
  };
17804
+ SourceGroup.prototype._addToUnwrap = function (element, inForeground) {
17805
+ if (inForeground) {
17806
+ this._unwrap.add(element);
17807
+ } else {
17808
+ this._unwrap.getChildren()[0].add(element);
17809
+ }
17810
+ };
17804
17811
  SourceGroup.prototype._removeUnwrap = function () {
17805
17812
  if (this._unwrap) {
17806
17813
  this._unwrap.remove();
@@ -17828,38 +17835,45 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17828
17835
  self.drawSourceShape(ctx, null, true);
17829
17836
  }
17830
17837
  });
17831
- var background = new Konva.Shape({
17832
- fill: this._source.backgroundColor,
17833
- sceneFunc: function (ctx, shape) {
17834
- self.drawSourceShape(ctx, shape, true);
17835
- },
17836
- draggable: this._source.draggable,
17837
- dragBoundFunc: function () {
17838
- return self._onSourceGroupDrag(this);
17839
- }
17840
- });
17841
17838
  if (this._source.draggable) {
17842
- background.on('mouseenter', function () {
17839
+ wrap.on('mouseenter', function () {
17843
17840
  self._view.setCursor('pointer');
17844
17841
  });
17845
- background.on('mouseout', function () {
17842
+ wrap.on('mouseout', function () {
17846
17843
  self._view.setCursor('default');
17847
17844
  });
17848
- background.on('dragstart', function () {
17845
+ wrap.on('dragstart', function () {
17849
17846
  this._scrollInterval = null;
17850
17847
  });
17851
- background.on('dragend', function () {
17848
+ wrap.on('dragend', function () {
17852
17849
  if (this._scrollingInterval) {
17853
17850
  clearInterval(this._scrollingInterval);
17854
17851
  this._scrollingInterval = null;
17855
17852
  }
17856
17853
  });
17857
17854
  }
17858
- var title = this._createTitle(true);
17855
+ var background = new Konva.Group();
17856
+ background.add(new Konva.Shape({
17857
+ fill: this._source.backgroundColor,
17858
+ sceneFunc: function (ctx, shape) {
17859
+ self.drawSourceShape(ctx, shape, true);
17860
+ },
17861
+ draggable: this._source.draggable,
17862
+ dragBoundFunc: function () {
17863
+ return self._onSourceGroupDrag(this);
17864
+ }
17865
+ }));
17859
17866
  wrap.add(background);
17860
- wrap.add(title);
17867
+ wrap.add(this._createTitle(true));
17861
17868
  return wrap;
17862
17869
  };
17870
+ SourceGroup.prototype._addToWrap = function (element, inForeground) {
17871
+ if (inForeground) {
17872
+ this._wrap.add(element);
17873
+ } else {
17874
+ this._wrap.getChildren()[0].add(element);
17875
+ }
17876
+ };
17863
17877
  SourceGroup.prototype._removeWrap = function () {
17864
17878
  if (this._wrap) {
17865
17879
  this._wrap.remove();
@@ -18074,7 +18088,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18074
18088
  url: preview.url
18075
18089
  });
18076
18090
  preview.group.add(waveform);
18077
- this._unwrap.add(preview.group);
18091
+ this._addToUnwrap(preview.group);
18078
18092
  if (redraw) {
18079
18093
  this._layer.rescale(true);
18080
18094
  }
@@ -18200,7 +18214,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
18200
18214
  preview.group.add(imagePreview);
18201
18215
  currentX += preview.imageData.width + preview.imageData.imageSpacing;
18202
18216
  }
18203
- this._unwrap.add(preview.group);
18217
+ this._addToUnwrap(preview.group);
18204
18218
  if (redraw) {
18205
18219
  this._group.draw();
18206
18220
  }
@@ -414,30 +414,19 @@ define([
414
414
  }
415
415
  });
416
416
 
417
- var background = new Konva.Shape({
418
- fill: this._source.backgroundColor,
419
- sceneFunc: function(ctx, shape) {
420
- self.drawSourceShape(ctx, shape, true);
421
- },
422
- draggable: this._source.draggable,
423
- dragBoundFunc: function() {
424
- return self._onSourceGroupDrag(this);
425
- }
426
- });
427
-
428
417
  if (this._source.draggable) {
429
- background.on('mouseenter', function() {
418
+ unwrap.on('mouseenter', function() {
430
419
  self._view.setCursor('pointer');
431
420
  });
432
- background.on('mouseout', function() {
421
+ unwrap.on('mouseout', function() {
433
422
  self._view.setCursor('default');
434
423
  });
435
424
 
436
- background.on('dragstart', function() {
425
+ unwrap.on('dragstart', function() {
437
426
  this._scrollInterval = null;
438
427
  });
439
428
 
440
- background.on('dragend', function() {
429
+ unwrap.on('dragend', function() {
441
430
  if (this._scrollingInterval) {
442
431
  clearInterval(this._scrollingInterval);
443
432
  this._scrollingInterval = null;
@@ -445,14 +434,34 @@ define([
445
434
  });
446
435
  }
447
436
 
448
- var title = this._createTitle(false);
437
+ var background = new Konva.Group();
438
+
439
+ background.add(new Konva.Shape({
440
+ fill: this._source.backgroundColor,
441
+ sceneFunc: function(ctx, shape) {
442
+ self.drawSourceShape(ctx, shape, true);
443
+ },
444
+ draggable: this._source.draggable,
445
+ dragBoundFunc: function() {
446
+ return self._onSourceGroupDrag(this);
447
+ }
448
+ }));
449
449
 
450
450
  unwrap.add(background);
451
- unwrap.add(title);
451
+ unwrap.add(this._createTitle(false));
452
452
 
453
453
  return unwrap;
454
454
  };
455
455
 
456
+ SourceGroup.prototype._addToUnwrap = function(element, inForeground) {
457
+ if (inForeground) {
458
+ this._unwrap.add(element);
459
+ }
460
+ else {
461
+ this._unwrap.getChildren()[0].add(element);
462
+ }
463
+ };
464
+
456
465
  SourceGroup.prototype._removeUnwrap = function() {
457
466
  if (this._unwrap) {
458
467
  this._unwrap.remove();
@@ -485,30 +494,19 @@ define([
485
494
  }
486
495
  });
487
496
 
488
- var background = new Konva.Shape({
489
- fill: this._source.backgroundColor,
490
- sceneFunc: function(ctx, shape) {
491
- self.drawSourceShape(ctx, shape, true);
492
- },
493
- draggable: this._source.draggable,
494
- dragBoundFunc: function() {
495
- return self._onSourceGroupDrag(this);
496
- }
497
- });
498
-
499
497
  if (this._source.draggable) {
500
- background.on('mouseenter', function() {
498
+ wrap.on('mouseenter', function() {
501
499
  self._view.setCursor('pointer');
502
500
  });
503
- background.on('mouseout', function() {
501
+ wrap.on('mouseout', function() {
504
502
  self._view.setCursor('default');
505
503
  });
506
504
 
507
- background.on('dragstart', function() {
505
+ wrap.on('dragstart', function() {
508
506
  this._scrollInterval = null;
509
507
  });
510
508
 
511
- background.on('dragend', function() {
509
+ wrap.on('dragend', function() {
512
510
  if (this._scrollingInterval) {
513
511
  clearInterval(this._scrollingInterval);
514
512
  this._scrollingInterval = null;
@@ -516,14 +514,34 @@ define([
516
514
  });
517
515
  }
518
516
 
519
- var title = this._createTitle(true);
517
+ var background = new Konva.Group();
518
+
519
+ background.add(new Konva.Shape({
520
+ fill: this._source.backgroundColor,
521
+ sceneFunc: function(ctx, shape) {
522
+ self.drawSourceShape(ctx, shape, true);
523
+ },
524
+ draggable: this._source.draggable,
525
+ dragBoundFunc: function() {
526
+ return self._onSourceGroupDrag(this);
527
+ }
528
+ }));
520
529
 
521
530
  wrap.add(background);
522
- wrap.add(title);
531
+ wrap.add(this._createTitle(true));
523
532
 
524
533
  return wrap;
525
534
  };
526
535
 
536
+ SourceGroup.prototype._addToWrap = function(element, inForeground) {
537
+ if (inForeground) {
538
+ this._wrap.add(element);
539
+ }
540
+ else {
541
+ this._wrap.getChildren()[0].add(element);
542
+ }
543
+ };
544
+
527
545
  SourceGroup.prototype._removeWrap = function() {
528
546
  if (this._wrap) {
529
547
  this._wrap.remove();
@@ -804,7 +822,7 @@ define([
804
822
  });
805
823
 
806
824
  preview.group.add(waveform);
807
- this._unwrap.add(preview.group);
825
+ this._addToUnwrap(preview.group);
808
826
 
809
827
  if (redraw) {
810
828
  this._layer.rescale(true);
@@ -972,7 +990,7 @@ define([
972
990
  currentX += preview.imageData.width + preview.imageData.imageSpacing;
973
991
  }
974
992
 
975
- this._unwrap.add(preview.group);
993
+ this._addToUnwrap(preview.group);
976
994
 
977
995
  if (redraw) {
978
996
  this._group.draw();