@checksub_team/peaks_timeline 1.15.8-alpha.0 → 1.15.9

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.8-alpha.0",
3
+ "version": "1.15.9",
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
@@ -14446,7 +14446,7 @@ module.exports = function (Data) {
14446
14446
  var data = new Data();
14447
14447
  this._data[url] = data;
14448
14448
  this._waitingForData[url] = [source];
14449
- this._fetch(url, data, 1000, 10);
14449
+ this._fetch(url, data, 2000, 3);
14450
14450
  };
14451
14451
  DataRetriever.prototype._fetch = function (url, data, delay, limit) {
14452
14452
  var self = this;
@@ -14459,12 +14459,15 @@ module.exports = function (Data) {
14459
14459
  if (timesTried >= limit) {
14460
14460
  return Promise.reject(err);
14461
14461
  }
14462
- return fetch(url).catch(function (err) {
14463
- later(delay).then(function () {
14464
- recur(timesTried + 1, err);
14465
- });
14466
- }).then(function (response) {
14462
+ return fetch(url).then(function (response) {
14463
+ if (!response.ok) {
14464
+ throw new Error('HTTP ' + response.status + ': ' + response.statusText);
14465
+ }
14467
14466
  return response.blob();
14467
+ }).catch(function (err) {
14468
+ return later(delay).then(function () {
14469
+ return recur(timesTried + 1, err);
14470
+ });
14468
14471
  }).then(function (blob) {
14469
14472
  var type = blob.type;
14470
14473
  if (type) {
@@ -20451,6 +20454,13 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
20451
20454
  const draggedElementId = element.currentTarget.attrs.sourceId;
20452
20455
  const shouldDragSelectedElements = Object.keys(this._view.getSelectedElements()).includes(draggedElementId);
20453
20456
  this._nonSelectedElement = shouldDragSelectedElements ? null : [this._sourcesGroup[draggedElementId].getSource()];
20457
+ this._isDraggable = true;
20458
+ (this._nonSelectedElement || Object.values(this._view.getSelectedElements())).forEach(function (source) {
20459
+ if (!source.draggable) {
20460
+ this._isDraggable = false;
20461
+ return;
20462
+ }
20463
+ }.bind(this));
20454
20464
  };
20455
20465
  SourcesLayer.prototype.onSourcesGroupDragEnd = function () {
20456
20466
  const updatedSources = (this._nonSelectedElement || Object.values(this._view.getSelectedElements())).map(function (source) {
@@ -20488,7 +20498,9 @@ module.exports = function (SourceGroup, Lines, DataRetriever, Utils, Invoker, Ko
20488
20498
  }
20489
20499
  const {initialStartTime, initialEndTime} = this._activeElements[source.id];
20490
20500
  newEnd = Math.max(newEnd, source.endTime);
20491
- shouldRedraw = this.updateSource(source, initialStartTime + diff + timeOffsetDiff, initialEndTime + diff + timeOffsetDiff, mousePosY) || shouldRedraw;
20501
+ if (this._isDraggable) {
20502
+ shouldRedraw = this.updateSource(source, initialStartTime + diff + timeOffsetDiff, initialEndTime + diff + timeOffsetDiff, mousePosY) || shouldRedraw;
20503
+ }
20492
20504
  }.bind(this));
20493
20505
  if (shouldRedraw) {
20494
20506
  this.draw();
@@ -59,7 +59,7 @@ define([
59
59
  this._data[url] = data;
60
60
  this._waitingForData[url] = [source];
61
61
 
62
- this._fetch(url, data, 1000, 10);
62
+ this._fetch(url, data, 2000, 3);
63
63
  };
64
64
 
65
65
  DataRetriever.prototype._fetch = function(url, data, delay, limit) {
@@ -77,15 +77,19 @@ define([
77
77
  }
78
78
 
79
79
  return fetch(url)
80
+ .then(function(response) {
81
+ if (!response.ok) {
82
+ throw new Error('HTTP ' + response.status + ': ' + response.statusText);
83
+ }
84
+
85
+ return response.blob();
86
+ })
80
87
  .catch(function(err) {
81
- later(delay)
88
+ return later(delay)
82
89
  .then(function() {
83
- recur(timesTried + 1, err);
90
+ return recur(timesTried + 1, err);
84
91
  });
85
92
  })
86
- .then(function(response) {
87
- return response.blob();
88
- })
89
93
  .then(function(blob) {
90
94
  var type = blob.type;
91
95
 
package/src/line.js CHANGED
@@ -643,14 +643,6 @@ define([
643
643
  return newTimes;
644
644
  };
645
645
 
646
- // Line.prototype.rescale = function() {
647
- // for (var sourceId in this._sourcesGroup) {
648
- // if (Utils.objectHasProperty(this._sourcesGroup, sourceId)) {
649
- // this._sourcesGroup[sourceId].rescale();
650
- // }
651
- // }
652
- // };
653
-
654
646
  Line.prototype.getSourcesAfter = function(time) {
655
647
  const sources = [];
656
648
  var currentId = this._firstSourceId;
package/src/lines.js CHANGED
@@ -384,14 +384,6 @@ define([
384
384
  return this._linesBySourceId[source.id].manageSourceOrder(source, newTimes);
385
385
  };
386
386
 
387
- // Lines.prototype.rescale = function() {
388
- // for (var position in this._linesByPosition) {
389
- // if (Utils.objectHasProperty(this._linesByPosition, position)) {
390
- // this._linesByPosition[position].rescale();
391
- // }
392
- // }
393
- // };
394
-
395
387
  Lines.prototype._setInteractions = function(position) {
396
388
  var line = this._linesByPosition[position];
397
389
 
@@ -348,6 +348,14 @@ define([
348
348
  this._nonSelectedElement = shouldDragSelectedElements ?
349
349
  null :
350
350
  [this._sourcesGroup[draggedElementId].getSource()];
351
+
352
+ this._isDraggable = true;
353
+ (this._nonSelectedElement || Object.values(this._view.getSelectedElements())).forEach(function(source) {
354
+ if (!source.draggable) {
355
+ this._isDraggable = false;
356
+ return;
357
+ }
358
+ }.bind(this));
351
359
  };
352
360
 
353
361
  SourcesLayer.prototype.onSourcesGroupDragEnd = function() {
@@ -407,12 +415,14 @@ define([
407
415
 
408
416
  newEnd = Math.max(newEnd, source.endTime);
409
417
 
410
- shouldRedraw = this.updateSource(
411
- source,
412
- initialStartTime + diff + timeOffsetDiff,
413
- initialEndTime + diff + timeOffsetDiff,
414
- mousePosY
415
- ) || shouldRedraw;
418
+ if (this._isDraggable) {
419
+ shouldRedraw = this.updateSource(
420
+ source,
421
+ initialStartTime + diff + timeOffsetDiff,
422
+ initialEndTime + diff + timeOffsetDiff,
423
+ mousePosY
424
+ ) || shouldRedraw;
425
+ }
416
426
  }.bind(this));
417
427
 
418
428
  if (shouldRedraw) {
@@ -635,7 +645,6 @@ define([
635
645
  };
636
646
 
637
647
  SourcesLayer.prototype.rescale = function(debounce) {
638
- // this._lines.rescale();
639
648
  if (debounce) {
640
649
  this._debouncedRescale();
641
650
  }