@checksub_team/peaks_timeline 1.9.1-beta.2 → 1.9.1-beta.3
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 +67 -73
- package/src/mode-layer.js +4 -6
- package/src/playhead-layer.js +0 -1
- package/src/source-group.js +55 -69
- package/src/timeline-zoomview.js +38 -19
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15740,6 +15740,7 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15740
15740
|
const sources = [];
|
|
15741
15741
|
const segments = [];
|
|
15742
15742
|
const self = this;
|
|
15743
|
+
this.deselectAll(true);
|
|
15743
15744
|
elements.forEach(function (element) {
|
|
15744
15745
|
self._selectedElements[element.id] = element;
|
|
15745
15746
|
element.setSelected(true);
|
|
@@ -15836,11 +15837,6 @@ module.exports = function (Utils, Source, SourceGroup, Konva) {
|
|
|
15836
15837
|
};
|
|
15837
15838
|
ModeLayer.prototype._onMouseClickInDefaultMode = function () {
|
|
15838
15839
|
const hoveredKonvaElement = this._view.getHoveredElement();
|
|
15839
|
-
const currentLine = hoveredKonvaElement && hoveredKonvaElement.getLine();
|
|
15840
|
-
if (currentLine !== this._currentLine) {
|
|
15841
|
-
this.deselectAll(true);
|
|
15842
|
-
this._currentLine = currentLine;
|
|
15843
|
-
}
|
|
15844
15840
|
if (hoveredKonvaElement) {
|
|
15845
15841
|
if (hoveredKonvaElement instanceof SourceGroup) {
|
|
15846
15842
|
this.selectElements([hoveredKonvaElement.getSource()], true);
|
|
@@ -16269,7 +16265,6 @@ module.exports = function (Utils, Konva) {
|
|
|
16269
16265
|
PlayheadLayer.prototype._onPlayheadDragStart = function () {
|
|
16270
16266
|
this._view.enableAutoScroll(false);
|
|
16271
16267
|
this._dragging = true;
|
|
16272
|
-
this._scrollInterval = null;
|
|
16273
16268
|
};
|
|
16274
16269
|
PlayheadLayer.prototype._onPlayheadDragEnd = function () {
|
|
16275
16270
|
this._view.enableAutoScroll(true);
|
|
@@ -17643,14 +17638,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17643
17638
|
this._wrappedHeight = this._peaks.options.wrappedLineHeight;
|
|
17644
17639
|
this._borderWidth = this._source.borderWidth;
|
|
17645
17640
|
this._previewList = [];
|
|
17646
|
-
this._group = new Konva.Group({
|
|
17647
|
-
x: this._x,
|
|
17648
|
-
draggable: this._source.draggable,
|
|
17649
|
-
dragBoundFunc: function () {
|
|
17650
|
-
return self._onSourceGroupDrag(this);
|
|
17651
|
-
}
|
|
17652
|
-
});
|
|
17653
|
-
this._group.on('dragstart', this._onSourceGroupDragStart.bind(this));
|
|
17641
|
+
this._group = new Konva.Group({ x: this._x });
|
|
17654
17642
|
this._group.on('mouseover', function () {
|
|
17655
17643
|
self._view.setHoveredElement(self);
|
|
17656
17644
|
if (self._view.getCurrentMode() === 'cut') {
|
|
@@ -17665,7 +17653,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17665
17653
|
self.toggleResizing(true);
|
|
17666
17654
|
}
|
|
17667
17655
|
});
|
|
17668
|
-
this._group.on('dragend', this._onSourceGroupDragEnd.bind(this));
|
|
17669
17656
|
this._group.add(new Konva.Group());
|
|
17670
17657
|
if (this._borderWidth) {
|
|
17671
17658
|
this._border = new Konva.Shape({
|
|
@@ -17683,6 +17670,30 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17683
17670
|
this._group.add(this._indicatorsGroup);
|
|
17684
17671
|
this.createIndicators();
|
|
17685
17672
|
}
|
|
17673
|
+
SourceGroup.prototype.setDraggingParent = function () {
|
|
17674
|
+
if (this._source.draggable) {
|
|
17675
|
+
const self = this;
|
|
17676
|
+
if (this._draggingParent) {
|
|
17677
|
+
this._draggingParent.setAttrs({
|
|
17678
|
+
draggable: this._source.draggable,
|
|
17679
|
+
dragBoundFunc: function () {
|
|
17680
|
+
return self._onSourceGroupDrag(this);
|
|
17681
|
+
}
|
|
17682
|
+
});
|
|
17683
|
+
this._draggingParent.on('dragstart', this._onSourceGroupDragStart.bind(this));
|
|
17684
|
+
this._draggingParent.on('dragend', this._onSourceGroupDragEnd.bind(this));
|
|
17685
|
+
} else {
|
|
17686
|
+
this._group.setAttrs({
|
|
17687
|
+
draggable: this._source.draggable,
|
|
17688
|
+
dragBoundFunc: function () {
|
|
17689
|
+
return self._onSourceGroupDrag(this);
|
|
17690
|
+
}
|
|
17691
|
+
});
|
|
17692
|
+
this._group.on('dragstart', this._onSourceGroupDragStart.bind(this));
|
|
17693
|
+
this._group.on('dragend', this._onSourceGroupDragEnd.bind(this));
|
|
17694
|
+
}
|
|
17695
|
+
}
|
|
17696
|
+
};
|
|
17686
17697
|
SourceGroup.prototype._onSourceGroupDragStart = function () {
|
|
17687
17698
|
this._dragged = true;
|
|
17688
17699
|
this._mouseDownX = this._view.getPointerPosition().x;
|
|
@@ -17702,17 +17713,17 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17702
17713
|
this._view.updateTimelineLength();
|
|
17703
17714
|
this._peaks.emit('sources.updated', [this._source]);
|
|
17704
17715
|
};
|
|
17716
|
+
SourceGroup.prototype._updateSourceGroup = function () {
|
|
17717
|
+
var mousePos = Math.min(this._view.getWidth() - this._peaks.options.autoScrollThreshold * this._view.getWidth(), Math.max(0, this._view.getPointerPosition().x));
|
|
17718
|
+
var diff = mousePos - this._mouseDownX;
|
|
17719
|
+
this._layer.updateSource(this._source, this._initialStartPixel + diff + (this._view.getFrameOffset() - this._initialFrameOffset), this._initialEndPixel + diff + (this._view.getFrameOffset() - this._initialFrameOffset), this._view.getPointerPosition().y);
|
|
17720
|
+
this._view.setTimelineLength(this._view.timeToPixels(this._source.endTime) + this._view.getWidth());
|
|
17721
|
+
};
|
|
17705
17722
|
SourceGroup.prototype._onSourceGroupDrag = function (draggedElement) {
|
|
17706
|
-
|
|
17707
|
-
var pos = this._view.updateWithAutoScroll(draggedElement, function () {
|
|
17708
|
-
var mousePos = Math.min(self._view.getWidth() - self._peaks.options.autoScrollThreshold * self._view.getWidth(), Math.max(0, self._view.getPointerPosition().x));
|
|
17709
|
-
var diff = mousePos - self._mouseDownX;
|
|
17710
|
-
self._layer.updateSource(self._source, self._initialStartPixel + diff + (self._view.getFrameOffset() - self._initialFrameOffset), self._initialEndPixel + diff + (self._view.getFrameOffset() - self._initialFrameOffset), self._view.getPointerPosition().y);
|
|
17711
|
-
self._view.setTimelineLength(self._view.timeToPixels(self._source.endTime) + self._view.getWidth());
|
|
17712
|
-
});
|
|
17723
|
+
this._view.updateWithAutoScroll(this._updateSourceGroup.bind(this));
|
|
17713
17724
|
return {
|
|
17714
|
-
x:
|
|
17715
|
-
y:
|
|
17725
|
+
x: draggedElement.absolutePosition().x,
|
|
17726
|
+
y: draggedElement.absolutePosition().y
|
|
17716
17727
|
};
|
|
17717
17728
|
};
|
|
17718
17729
|
SourceGroup.prototype._onSourceGroupHandleDrag = function (draggedElement, dragPos, leftHandle) {
|
|
@@ -17777,12 +17788,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17777
17788
|
}
|
|
17778
17789
|
});
|
|
17779
17790
|
if (this._source.resizable) {
|
|
17780
|
-
this._leftHandle.on('dragend', function () {
|
|
17781
|
-
if (this._scrollingInterval) {
|
|
17782
|
-
clearInterval(this._scrollingInterval);
|
|
17783
|
-
this._scrollingInterval = null;
|
|
17784
|
-
}
|
|
17785
|
-
});
|
|
17786
17791
|
this._leftHandle.on('mouseover', function () {
|
|
17787
17792
|
self._view.setCursor('ew-resize');
|
|
17788
17793
|
});
|
|
@@ -17803,12 +17808,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17803
17808
|
}
|
|
17804
17809
|
});
|
|
17805
17810
|
if (this._source.resizable) {
|
|
17806
|
-
this._rightHandle.on('dragend', function () {
|
|
17807
|
-
if (this._scrollingInterval) {
|
|
17808
|
-
clearInterval(this._scrollingInterval);
|
|
17809
|
-
this._scrollingInterval = null;
|
|
17810
|
-
}
|
|
17811
|
-
});
|
|
17812
17811
|
this._rightHandle.on('mouseover', function () {
|
|
17813
17812
|
self._view.setCursor('ew-resize');
|
|
17814
17813
|
});
|
|
@@ -17890,15 +17889,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17890
17889
|
unwrap.on('mouseout', function () {
|
|
17891
17890
|
self._view.setCursor('default');
|
|
17892
17891
|
});
|
|
17893
|
-
unwrap.on('dragstart', function () {
|
|
17894
|
-
this._scrollInterval = null;
|
|
17895
|
-
});
|
|
17896
|
-
unwrap.on('dragend', function () {
|
|
17897
|
-
if (this._scrollingInterval) {
|
|
17898
|
-
clearInterval(this._scrollingInterval);
|
|
17899
|
-
this._scrollingInterval = null;
|
|
17900
|
-
}
|
|
17901
|
-
});
|
|
17902
17892
|
}
|
|
17903
17893
|
var background = new Konva.Group();
|
|
17904
17894
|
background.add(new Konva.Shape({
|
|
@@ -17945,15 +17935,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17945
17935
|
wrap.on('mouseout', function () {
|
|
17946
17936
|
self._view.setCursor('default');
|
|
17947
17937
|
});
|
|
17948
|
-
wrap.on('dragstart', function () {
|
|
17949
|
-
this._scrollInterval = null;
|
|
17950
|
-
});
|
|
17951
|
-
wrap.on('dragend', function () {
|
|
17952
|
-
if (this._scrollingInterval) {
|
|
17953
|
-
clearInterval(this._scrollingInterval);
|
|
17954
|
-
this._scrollingInterval = null;
|
|
17955
|
-
}
|
|
17956
|
-
});
|
|
17957
17938
|
}
|
|
17958
17939
|
var background = new Konva.Group();
|
|
17959
17940
|
background.add(new Konva.Shape({
|
|
@@ -18233,6 +18214,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
18233
18214
|
}
|
|
18234
18215
|
}
|
|
18235
18216
|
}
|
|
18217
|
+
this.setDraggingParent();
|
|
18236
18218
|
};
|
|
18237
18219
|
SourceGroup.prototype.updatePreviews = function () {
|
|
18238
18220
|
var self = this;
|
|
@@ -20124,6 +20106,9 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
20124
20106
|
});
|
|
20125
20107
|
this._stage.on('wheel', function (e) {
|
|
20126
20108
|
e.evt.preventDefault();
|
|
20109
|
+
if (self._mouseDragHandler.isDragging()) {
|
|
20110
|
+
return;
|
|
20111
|
+
}
|
|
20127
20112
|
if (self._peaks.keyboardHandler.isCtrlCmdPressed()) {
|
|
20128
20113
|
if (e.evt.deltaY > 0) {
|
|
20129
20114
|
self.setZoom(self.getTimeToPixelsScale() + Math.floor(self.getTimeToPixelsScale() / 10) + 1);
|
|
@@ -20150,46 +20135,55 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
20150
20135
|
}
|
|
20151
20136
|
}
|
|
20152
20137
|
});
|
|
20138
|
+
window.addEventListener('mouseup', this._mouseUp.bind(this), false);
|
|
20139
|
+
window.addEventListener('touchend', this._mouseUp.bind(this), false);
|
|
20140
|
+
window.addEventListener('blur', this._mouseUp.bind(this), false);
|
|
20153
20141
|
}
|
|
20154
|
-
TimelineZoomView.prototype.
|
|
20142
|
+
TimelineZoomView.prototype._mouseUp = function () {
|
|
20143
|
+
this.clearScrollingInterval();
|
|
20144
|
+
};
|
|
20145
|
+
TimelineZoomView.prototype._createElementGroup = function () {
|
|
20146
|
+
this._selectedGroup = new Konva.Group({ listening: false });
|
|
20147
|
+
this._layer.add(this._selectedGroup);
|
|
20148
|
+
};
|
|
20149
|
+
TimelineZoomView.prototype.updateWithAutoScroll = function (updateInInterval, updateOutInterval) {
|
|
20155
20150
|
var self = this;
|
|
20156
20151
|
var posX = this.getPointerPosition().x;
|
|
20157
20152
|
var threshold = Math.round(this._peaks.options.autoScrollThreshold * this.getWidth());
|
|
20158
|
-
|
|
20153
|
+
this._limited = 0;
|
|
20159
20154
|
if (posX < threshold) {
|
|
20160
|
-
|
|
20155
|
+
this._limited = Math.round(-30 * Math.min(1, (threshold - posX) / threshold));
|
|
20161
20156
|
} else if (posX > this.getWidth() - threshold) {
|
|
20162
|
-
|
|
20157
|
+
this._limited = Math.round(30 * Math.min(1, (posX - (this.getWidth() - threshold)) / threshold));
|
|
20163
20158
|
}
|
|
20164
|
-
if (
|
|
20165
|
-
if (!
|
|
20166
|
-
|
|
20167
|
-
var newOffset = self.getFrameOffset() +
|
|
20159
|
+
if (this._limited && self.getFrameOffset() > 0 || this._limited > 0) {
|
|
20160
|
+
if (!this._scrollingInterval) {
|
|
20161
|
+
this._scrollingInterval = setInterval(function () {
|
|
20162
|
+
var newOffset = self.getFrameOffset() + self._limited;
|
|
20168
20163
|
if (newOffset < 0) {
|
|
20169
20164
|
self.updateTimeline(0, null, false);
|
|
20170
|
-
clearInterval(
|
|
20171
|
-
|
|
20165
|
+
clearInterval(self._scrollingInterval);
|
|
20166
|
+
self._scrollingInterval = null;
|
|
20172
20167
|
} else {
|
|
20173
|
-
self.updateTimeline(self.getFrameOffset() +
|
|
20168
|
+
self.updateTimeline(self.getFrameOffset() + self._limited, null, false);
|
|
20174
20169
|
}
|
|
20175
20170
|
updateInInterval();
|
|
20176
20171
|
}, 10);
|
|
20177
20172
|
}
|
|
20178
20173
|
} else {
|
|
20179
|
-
|
|
20180
|
-
clearInterval(obj._scrollingInterval);
|
|
20181
|
-
obj._scrollingInterval = null;
|
|
20182
|
-
}
|
|
20174
|
+
this.clearScrollingInterval();
|
|
20183
20175
|
if (updateOutInterval) {
|
|
20184
20176
|
updateOutInterval();
|
|
20185
20177
|
} else {
|
|
20186
20178
|
updateInInterval();
|
|
20187
20179
|
}
|
|
20188
20180
|
}
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
|
|
20181
|
+
};
|
|
20182
|
+
TimelineZoomView.prototype.clearScrollingInterval = function () {
|
|
20183
|
+
if (this._scrollingInterval) {
|
|
20184
|
+
clearInterval(this._scrollingInterval);
|
|
20185
|
+
this._scrollingInterval = null;
|
|
20186
|
+
}
|
|
20193
20187
|
};
|
|
20194
20188
|
TimelineZoomView.prototype.getCurrentMode = function () {
|
|
20195
20189
|
return this._modeLayer.getCurrentMode();
|
package/src/mode-layer.js
CHANGED
|
@@ -72,6 +72,8 @@ define([
|
|
|
72
72
|
const segments = [];
|
|
73
73
|
const self = this;
|
|
74
74
|
|
|
75
|
+
this.deselectAll(true);
|
|
76
|
+
|
|
75
77
|
elements.forEach(function(element) {
|
|
76
78
|
self._selectedElements[element.id] = element;
|
|
77
79
|
element.setSelected(true);
|
|
@@ -84,6 +86,7 @@ define([
|
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
});
|
|
89
|
+
|
|
87
90
|
if (notify) {
|
|
88
91
|
if (sources.length) {
|
|
89
92
|
this._peaks.emit('sources.selected', sources);
|
|
@@ -114,6 +117,7 @@ define([
|
|
|
114
117
|
delete this._selectedElements[id];
|
|
115
118
|
}
|
|
116
119
|
}
|
|
120
|
+
|
|
117
121
|
if (notify) {
|
|
118
122
|
if (sources.length) {
|
|
119
123
|
this._peaks.emit('sources.deselected', sources);
|
|
@@ -180,12 +184,6 @@ define([
|
|
|
180
184
|
|
|
181
185
|
ModeLayer.prototype._onMouseClickInDefaultMode = function() {
|
|
182
186
|
const hoveredKonvaElement = this._view.getHoveredElement();
|
|
183
|
-
const currentLine = hoveredKonvaElement && hoveredKonvaElement.getLine();
|
|
184
|
-
|
|
185
|
-
if (currentLine !== this._currentLine) {
|
|
186
|
-
this.deselectAll(true);
|
|
187
|
-
this._currentLine = currentLine;
|
|
188
|
-
}
|
|
189
187
|
|
|
190
188
|
if (hoveredKonvaElement) {
|
|
191
189
|
if (hoveredKonvaElement instanceof SourceGroup) {
|
package/src/playhead-layer.js
CHANGED
package/src/source-group.js
CHANGED
|
@@ -57,14 +57,9 @@ define([
|
|
|
57
57
|
this._previewList = [];
|
|
58
58
|
|
|
59
59
|
this._group = new Konva.Group({
|
|
60
|
-
x: this._x
|
|
61
|
-
draggable: this._source.draggable,
|
|
62
|
-
dragBoundFunc: function() {
|
|
63
|
-
return self._onSourceGroupDrag(this);
|
|
64
|
-
}
|
|
60
|
+
x: this._x
|
|
65
61
|
});
|
|
66
62
|
|
|
67
|
-
this._group.on('dragstart', this._onSourceGroupDragStart.bind(this));
|
|
68
63
|
this._group.on('mouseover', function() {
|
|
69
64
|
self._view.setHoveredElement(self);
|
|
70
65
|
if (self._view.getCurrentMode() === 'cut') {
|
|
@@ -79,7 +74,6 @@ define([
|
|
|
79
74
|
self.toggleResizing(true);
|
|
80
75
|
}
|
|
81
76
|
});
|
|
82
|
-
this._group.on('dragend', this._onSourceGroupDragEnd.bind(this));
|
|
83
77
|
|
|
84
78
|
this._group.add(new Konva.Group());
|
|
85
79
|
|
|
@@ -122,6 +116,36 @@ define([
|
|
|
122
116
|
// });
|
|
123
117
|
// };
|
|
124
118
|
|
|
119
|
+
SourceGroup.prototype.setDraggingParent = function() {
|
|
120
|
+
if (this._source.draggable) {
|
|
121
|
+
const self = this;
|
|
122
|
+
|
|
123
|
+
// this._draggingParent = this._source._selected ?
|
|
124
|
+
// this._layer.getSelectedGroup() :
|
|
125
|
+
// null;
|
|
126
|
+
if (this._draggingParent) {
|
|
127
|
+
this._draggingParent.setAttrs({
|
|
128
|
+
draggable: this._source.draggable,
|
|
129
|
+
dragBoundFunc: function() {
|
|
130
|
+
return self._onSourceGroupDrag(this);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
this._draggingParent.on('dragstart', this._onSourceGroupDragStart.bind(this));
|
|
134
|
+
this._draggingParent.on('dragend', this._onSourceGroupDragEnd.bind(this));
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this._group.setAttrs({
|
|
138
|
+
draggable: this._source.draggable,
|
|
139
|
+
dragBoundFunc: function() {
|
|
140
|
+
return self._onSourceGroupDrag(this);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
this._group.on('dragstart', this._onSourceGroupDragStart.bind(this));
|
|
144
|
+
this._group.on('dragend', this._onSourceGroupDragEnd.bind(this));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
125
149
|
SourceGroup.prototype._onSourceGroupDragStart = function() {
|
|
126
150
|
this._dragged = true;
|
|
127
151
|
this._mouseDownX = this._view.getPointerPosition().x;
|
|
@@ -147,38 +171,35 @@ define([
|
|
|
147
171
|
this._peaks.emit('sources.updated', [this._source]);
|
|
148
172
|
};
|
|
149
173
|
|
|
150
|
-
SourceGroup.prototype.
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Math.max(
|
|
159
|
-
0,
|
|
160
|
-
self._view.getPointerPosition().x
|
|
161
|
-
)
|
|
162
|
-
);
|
|
174
|
+
SourceGroup.prototype._updateSourceGroup = function() {
|
|
175
|
+
var mousePos = Math.min(
|
|
176
|
+
this._view.getWidth() - this._peaks.options.autoScrollThreshold * this._view.getWidth(),
|
|
177
|
+
Math.max(
|
|
178
|
+
0,
|
|
179
|
+
this._view.getPointerPosition().x
|
|
180
|
+
)
|
|
181
|
+
);
|
|
163
182
|
|
|
164
|
-
|
|
183
|
+
var diff = mousePos - this._mouseDownX;
|
|
165
184
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
185
|
+
this._layer.updateSource(
|
|
186
|
+
this._source,
|
|
187
|
+
this._initialStartPixel + diff + (this._view.getFrameOffset() - this._initialFrameOffset),
|
|
188
|
+
this._initialEndPixel + diff + (this._view.getFrameOffset() - this._initialFrameOffset),
|
|
189
|
+
this._view.getPointerPosition().y
|
|
190
|
+
);
|
|
172
191
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
);
|
|
176
|
-
}
|
|
192
|
+
this._view.setTimelineLength(
|
|
193
|
+
this._view.timeToPixels(this._source.endTime) + this._view.getWidth()
|
|
177
194
|
);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
SourceGroup.prototype._onSourceGroupDrag = function(draggedElement) {
|
|
198
|
+
this._view.updateWithAutoScroll(this._updateSourceGroup.bind(this));
|
|
178
199
|
|
|
179
200
|
return {
|
|
180
|
-
x:
|
|
181
|
-
y:
|
|
201
|
+
x: draggedElement.absolutePosition().x,
|
|
202
|
+
y: draggedElement.absolutePosition().y
|
|
182
203
|
};
|
|
183
204
|
};
|
|
184
205
|
|
|
@@ -272,13 +293,6 @@ define([
|
|
|
272
293
|
});
|
|
273
294
|
|
|
274
295
|
if (this._source.resizable) {
|
|
275
|
-
this._leftHandle.on('dragend', function() {
|
|
276
|
-
if (this._scrollingInterval) {
|
|
277
|
-
clearInterval(this._scrollingInterval);
|
|
278
|
-
this._scrollingInterval = null;
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
|
|
282
296
|
this._leftHandle.on('mouseover', function() {
|
|
283
297
|
self._view.setCursor('ew-resize');
|
|
284
298
|
});
|
|
@@ -302,13 +316,6 @@ define([
|
|
|
302
316
|
});
|
|
303
317
|
|
|
304
318
|
if (this._source.resizable) {
|
|
305
|
-
this._rightHandle.on('dragend', function() {
|
|
306
|
-
if (this._scrollingInterval) {
|
|
307
|
-
clearInterval(this._scrollingInterval);
|
|
308
|
-
this._scrollingInterval = null;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
|
|
312
319
|
this._rightHandle.on('mouseover', function() {
|
|
313
320
|
self._view.setCursor('ew-resize');
|
|
314
321
|
});
|
|
@@ -430,17 +437,6 @@ define([
|
|
|
430
437
|
unwrap.on('mouseout', function() {
|
|
431
438
|
self._view.setCursor('default');
|
|
432
439
|
});
|
|
433
|
-
|
|
434
|
-
unwrap.on('dragstart', function() {
|
|
435
|
-
this._scrollInterval = null;
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
unwrap.on('dragend', function() {
|
|
439
|
-
if (this._scrollingInterval) {
|
|
440
|
-
clearInterval(this._scrollingInterval);
|
|
441
|
-
this._scrollingInterval = null;
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
440
|
}
|
|
445
441
|
|
|
446
442
|
var background = new Konva.Group();
|
|
@@ -499,17 +495,6 @@ define([
|
|
|
499
495
|
wrap.on('mouseout', function() {
|
|
500
496
|
self._view.setCursor('default');
|
|
501
497
|
});
|
|
502
|
-
|
|
503
|
-
wrap.on('dragstart', function() {
|
|
504
|
-
this._scrollInterval = null;
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
wrap.on('dragend', function() {
|
|
508
|
-
if (this._scrollingInterval) {
|
|
509
|
-
clearInterval(this._scrollingInterval);
|
|
510
|
-
this._scrollingInterval = null;
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
498
|
}
|
|
514
499
|
|
|
515
500
|
var background = new Konva.Group();
|
|
@@ -874,6 +859,7 @@ define([
|
|
|
874
859
|
}
|
|
875
860
|
}
|
|
876
861
|
}
|
|
862
|
+
this.setDraggingParent();
|
|
877
863
|
};
|
|
878
864
|
|
|
879
865
|
SourceGroup.prototype.updatePreviews = function() {
|
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,54 @@ 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._createElementGroup = function() {
|
|
306
|
+
this._selectedGroup = new Konva.Group({
|
|
307
|
+
listening: false
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
this._layer.add(this._selectedGroup);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
TimelineZoomView.prototype.updateWithAutoScroll = function(updateInInterval,
|
|
294
314
|
updateOutInterval) {
|
|
295
315
|
var self = this;
|
|
296
316
|
var posX = this.getPointerPosition().x;
|
|
297
317
|
var threshold = Math.round(this._peaks.options.autoScrollThreshold * this.getWidth());
|
|
298
318
|
|
|
299
|
-
|
|
319
|
+
this._limited = 0;
|
|
300
320
|
|
|
301
321
|
if (posX < threshold) {
|
|
302
|
-
|
|
322
|
+
this._limited = Math.round(-30 * Math.min(1, (threshold - posX) / threshold));
|
|
303
323
|
}
|
|
304
324
|
else if (posX > this.getWidth() - threshold) {
|
|
305
|
-
|
|
325
|
+
this._limited = Math.round(
|
|
306
326
|
30 * Math.min(1, (posX - (this.getWidth() - threshold)) / threshold)
|
|
307
327
|
);
|
|
308
328
|
}
|
|
309
329
|
|
|
310
|
-
if (
|
|
311
|
-
if (!
|
|
312
|
-
|
|
330
|
+
if (this._limited && self.getFrameOffset() > 0 || this._limited > 0) {
|
|
331
|
+
if (!this._scrollingInterval) {
|
|
332
|
+
this._scrollingInterval = setInterval(
|
|
313
333
|
function() {
|
|
314
|
-
var newOffset = self.getFrameOffset() +
|
|
334
|
+
var newOffset = self.getFrameOffset() + self._limited;
|
|
315
335
|
|
|
316
336
|
if (newOffset < 0) {
|
|
317
337
|
self.updateTimeline(0, null, false);
|
|
318
|
-
clearInterval(
|
|
319
|
-
|
|
338
|
+
clearInterval(self._scrollingInterval);
|
|
339
|
+
self._scrollingInterval = null;
|
|
320
340
|
}
|
|
321
341
|
else {
|
|
322
|
-
self.updateTimeline(self.getFrameOffset() +
|
|
342
|
+
self.updateTimeline(self.getFrameOffset() + self._limited, null, false);
|
|
323
343
|
}
|
|
324
344
|
|
|
325
345
|
updateInInterval();
|
|
@@ -329,10 +349,7 @@ define([
|
|
|
329
349
|
}
|
|
330
350
|
}
|
|
331
351
|
else {
|
|
332
|
-
|
|
333
|
-
clearInterval(obj._scrollingInterval);
|
|
334
|
-
obj._scrollingInterval = null;
|
|
335
|
-
}
|
|
352
|
+
this.clearScrollingInterval();
|
|
336
353
|
|
|
337
354
|
if (updateOutInterval) {
|
|
338
355
|
updateOutInterval();
|
|
@@ -341,11 +358,13 @@ define([
|
|
|
341
358
|
updateInInterval();
|
|
342
359
|
}
|
|
343
360
|
}
|
|
361
|
+
};
|
|
344
362
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
363
|
+
TimelineZoomView.prototype.clearScrollingInterval = function() {
|
|
364
|
+
if (this._scrollingInterval) {
|
|
365
|
+
clearInterval(this._scrollingInterval);
|
|
366
|
+
this._scrollingInterval = null;
|
|
367
|
+
}
|
|
349
368
|
};
|
|
350
369
|
|
|
351
370
|
TimelineZoomView.prototype.getCurrentMode = function() {
|