@checksub_team/peaks_timeline 1.8.2 → 1.9.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 +1 -1
- package/peaks.js +324 -177
- package/src/line.js +22 -0
- package/src/lines.js +4 -0
- package/src/main.js +12 -2
- package/src/mode-layer.js +77 -30
- package/src/playhead-layer.js +3 -5
- package/src/segment-shape.js +18 -19
- package/src/segment.js +6 -0
- package/src/source-group.js +101 -139
- package/src/source.js +35 -3
- package/src/sources-layer.js +109 -3
- package/src/timeline-sources.js +2 -1
- package/src/timeline-zoomview.js +50 -23
package/src/timeline-zoomview.js
CHANGED
|
@@ -241,6 +241,10 @@ define([
|
|
|
241
241
|
// prevent parent scrolling
|
|
242
242
|
e.evt.preventDefault();
|
|
243
243
|
|
|
244
|
+
if (self._mouseDragHandler.isDragging()) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
244
248
|
if (self._peaks.keyboardHandler.isCtrlCmdPressed()) {
|
|
245
249
|
if (e.evt.deltaY > 0) {
|
|
246
250
|
self.setZoom(
|
|
@@ -288,38 +292,50 @@ define([
|
|
|
288
292
|
}
|
|
289
293
|
}
|
|
290
294
|
});
|
|
295
|
+
|
|
296
|
+
window.addEventListener('mouseup', this._mouseUp.bind(this), false);
|
|
297
|
+
window.addEventListener('touchend', this._mouseUp.bind(this), false);
|
|
298
|
+
window.addEventListener('blur', this._mouseUp.bind(this), false);
|
|
291
299
|
}
|
|
292
300
|
|
|
293
|
-
TimelineZoomView.prototype.
|
|
301
|
+
TimelineZoomView.prototype._mouseUp = function() {
|
|
302
|
+
this.clearScrollingInterval();
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
TimelineZoomView.prototype.getSelectedElements = function() {
|
|
306
|
+
return this._modeLayer.getSelectedElements();
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
TimelineZoomView.prototype.updateWithAutoScroll = function(updateInInterval,
|
|
294
310
|
updateOutInterval) {
|
|
295
311
|
var self = this;
|
|
296
312
|
var posX = this.getPointerPosition().x;
|
|
297
313
|
var threshold = Math.round(this._peaks.options.autoScrollThreshold * this.getWidth());
|
|
298
314
|
|
|
299
|
-
|
|
315
|
+
this._limited = 0;
|
|
300
316
|
|
|
301
317
|
if (posX < threshold) {
|
|
302
|
-
|
|
318
|
+
this._limited = Math.round(-30 * Math.min(1, (threshold - posX) / threshold));
|
|
303
319
|
}
|
|
304
320
|
else if (posX > this.getWidth() - threshold) {
|
|
305
|
-
|
|
321
|
+
this._limited = Math.round(
|
|
306
322
|
30 * Math.min(1, (posX - (this.getWidth() - threshold)) / threshold)
|
|
307
323
|
);
|
|
308
324
|
}
|
|
309
325
|
|
|
310
|
-
if (
|
|
311
|
-
if (!
|
|
312
|
-
|
|
326
|
+
if (this._limited && self.getFrameOffset() > 0 || this._limited > 0) {
|
|
327
|
+
if (!this._scrollingInterval) {
|
|
328
|
+
this._scrollingInterval = setInterval(
|
|
313
329
|
function() {
|
|
314
|
-
var newOffset = self.getFrameOffset() +
|
|
330
|
+
var newOffset = self.getFrameOffset() + self._limited;
|
|
315
331
|
|
|
316
332
|
if (newOffset < 0) {
|
|
317
333
|
self.updateTimeline(0, null, false);
|
|
318
|
-
clearInterval(
|
|
319
|
-
|
|
334
|
+
clearInterval(self._scrollingInterval);
|
|
335
|
+
self._scrollingInterval = null;
|
|
320
336
|
}
|
|
321
337
|
else {
|
|
322
|
-
self.updateTimeline(self.getFrameOffset() +
|
|
338
|
+
self.updateTimeline(self.getFrameOffset() + self._limited, null, false);
|
|
323
339
|
}
|
|
324
340
|
|
|
325
341
|
updateInInterval();
|
|
@@ -329,10 +345,7 @@ define([
|
|
|
329
345
|
}
|
|
330
346
|
}
|
|
331
347
|
else {
|
|
332
|
-
|
|
333
|
-
clearInterval(obj._scrollingInterval);
|
|
334
|
-
obj._scrollingInterval = null;
|
|
335
|
-
}
|
|
348
|
+
this.clearScrollingInterval();
|
|
336
349
|
|
|
337
350
|
if (updateOutInterval) {
|
|
338
351
|
updateOutInterval();
|
|
@@ -341,11 +354,13 @@ define([
|
|
|
341
354
|
updateInInterval();
|
|
342
355
|
}
|
|
343
356
|
}
|
|
357
|
+
};
|
|
344
358
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
359
|
+
TimelineZoomView.prototype.clearScrollingInterval = function() {
|
|
360
|
+
if (this._scrollingInterval) {
|
|
361
|
+
clearInterval(this._scrollingInterval);
|
|
362
|
+
this._scrollingInterval = null;
|
|
363
|
+
}
|
|
349
364
|
};
|
|
350
365
|
|
|
351
366
|
TimelineZoomView.prototype.getCurrentMode = function() {
|
|
@@ -365,16 +380,28 @@ define([
|
|
|
365
380
|
this._sourcesLayer.draw();
|
|
366
381
|
};
|
|
367
382
|
|
|
383
|
+
TimelineZoomView.prototype.getSelectedElements = function() {
|
|
384
|
+
return this._modeLayer.getSelectedElements();
|
|
385
|
+
};
|
|
386
|
+
|
|
368
387
|
TimelineZoomView.prototype.selectSourceById = function(sourceId) {
|
|
369
|
-
|
|
388
|
+
const sourceGroup = this._sourcesLayer.getSourceGroupById(sourceId);
|
|
370
389
|
|
|
371
390
|
if (sourceGroup) {
|
|
372
|
-
this._modeLayer.
|
|
391
|
+
this._modeLayer.selectElements([sourceGroup.getSource()], false);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
TimelineZoomView.prototype.selectSourcesOnLineAfter = function(lineId, time) {
|
|
396
|
+
const sources = this._sourcesLayer.getSourcesOnLineAfter(lineId, time);
|
|
397
|
+
|
|
398
|
+
if (sources) {
|
|
399
|
+
this._modeLayer.selectElements(sources, false);
|
|
373
400
|
}
|
|
374
401
|
};
|
|
375
402
|
|
|
376
|
-
TimelineZoomView.prototype.
|
|
377
|
-
this._modeLayer.
|
|
403
|
+
TimelineZoomView.prototype.deselectAll = function() {
|
|
404
|
+
this._modeLayer.deselectAll(false);
|
|
378
405
|
};
|
|
379
406
|
|
|
380
407
|
TimelineZoomView.prototype.isListening = function() {
|