@checksub_team/peaks_timeline 1.6.1 → 1.6.2
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 +9 -4
- package/src/source-group.js +13 -6
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -17578,6 +17578,11 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17578
17578
|
this._initialFrameOffset = this._view.getFrameOffset();
|
|
17579
17579
|
};
|
|
17580
17580
|
SourceGroup.prototype._onSourceGroupDragEnd = function () {
|
|
17581
|
+
var handleWidth = Math.min(this._peaks.options.sourceHandleWidth, this._width / 2);
|
|
17582
|
+
this._leftHandle.width(handleWidth);
|
|
17583
|
+
this._rightHandle.width(handleWidth);
|
|
17584
|
+
this._rightHandle.x(this._width - handleWidth);
|
|
17585
|
+
this._view.drawSourcesLayer();
|
|
17581
17586
|
this._dragged = false;
|
|
17582
17587
|
this._view.updateTimelineLength();
|
|
17583
17588
|
this._peaks.emit('sources.updated', [this._source]);
|
|
@@ -17615,7 +17620,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17615
17620
|
var newWidth = endPixel - startPixel;
|
|
17616
17621
|
if (newWidth !== this._width) {
|
|
17617
17622
|
this._width = newWidth;
|
|
17618
|
-
this._rightHandle.x(newWidth - this._peaks.options.sourceHandleWidth);
|
|
17619
17623
|
this.updatePreviews();
|
|
17620
17624
|
}
|
|
17621
17625
|
};
|
|
@@ -17645,10 +17649,11 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17645
17649
|
};
|
|
17646
17650
|
SourceGroup.prototype._addHandles = function (forceCreate) {
|
|
17647
17651
|
var self = this;
|
|
17652
|
+
var handleWidth = Math.min(this._peaks.options.sourceHandleWidth, this._width / 2);
|
|
17648
17653
|
if (!this._leftHandle || forceCreate) {
|
|
17649
17654
|
this._leftHandle = new Konva.Rect({
|
|
17650
17655
|
x: 0,
|
|
17651
|
-
width:
|
|
17656
|
+
width: handleWidth,
|
|
17652
17657
|
height: this._unwrappedHeight,
|
|
17653
17658
|
visible: true,
|
|
17654
17659
|
draggable: this._source.resizable,
|
|
@@ -17673,8 +17678,8 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17673
17678
|
}
|
|
17674
17679
|
if (!this._rightHandle || forceCreate) {
|
|
17675
17680
|
this._rightHandle = new Konva.Rect({
|
|
17676
|
-
x: this._width -
|
|
17677
|
-
width:
|
|
17681
|
+
x: this._width - handleWidth,
|
|
17682
|
+
width: handleWidth,
|
|
17678
17683
|
height: this._unwrappedHeight,
|
|
17679
17684
|
visible: true,
|
|
17680
17685
|
draggable: this._source.resizable,
|
package/src/source-group.js
CHANGED
|
@@ -125,8 +125,17 @@ define([
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
SourceGroup.prototype._onSourceGroupDragEnd = function() {
|
|
128
|
+
var handleWidth = Math.min(this._peaks.options.sourceHandleWidth, this._width / 2);
|
|
129
|
+
|
|
130
|
+
this._leftHandle.width(handleWidth);
|
|
131
|
+
this._rightHandle.width(handleWidth);
|
|
132
|
+
this._rightHandle.x(this._width - handleWidth);
|
|
133
|
+
|
|
134
|
+
this._view.drawSourcesLayer();
|
|
135
|
+
|
|
128
136
|
this._dragged = false;
|
|
129
137
|
this._view.updateTimelineLength();
|
|
138
|
+
|
|
130
139
|
this._peaks.emit('sources.updated', [this._source]);
|
|
131
140
|
};
|
|
132
141
|
|
|
@@ -203,9 +212,6 @@ define([
|
|
|
203
212
|
if (newWidth !== this._width) {
|
|
204
213
|
this._width = newWidth;
|
|
205
214
|
|
|
206
|
-
// update handles
|
|
207
|
-
this._rightHandle.x(newWidth - this._peaks.options.sourceHandleWidth);
|
|
208
|
-
|
|
209
215
|
// update unwrap
|
|
210
216
|
this.updatePreviews();
|
|
211
217
|
}
|
|
@@ -243,11 +249,12 @@ define([
|
|
|
243
249
|
|
|
244
250
|
SourceGroup.prototype._addHandles = function(forceCreate) {
|
|
245
251
|
var self = this;
|
|
252
|
+
var handleWidth = Math.min(this._peaks.options.sourceHandleWidth, this._width / 2);
|
|
246
253
|
|
|
247
254
|
if (!this._leftHandle || forceCreate) {
|
|
248
255
|
this._leftHandle = new Konva.Rect({
|
|
249
256
|
x: 0,
|
|
250
|
-
width:
|
|
257
|
+
width: handleWidth,
|
|
251
258
|
height: this._unwrappedHeight,
|
|
252
259
|
visible: true,
|
|
253
260
|
draggable: this._source.resizable,
|
|
@@ -276,8 +283,8 @@ define([
|
|
|
276
283
|
|
|
277
284
|
if (!this._rightHandle || forceCreate) {
|
|
278
285
|
this._rightHandle = new Konva.Rect({
|
|
279
|
-
x: this._width -
|
|
280
|
-
width:
|
|
286
|
+
x: this._width - handleWidth,
|
|
287
|
+
width: handleWidth,
|
|
281
288
|
height: this._unwrappedHeight,
|
|
282
289
|
visible: true,
|
|
283
290
|
draggable: this._source.resizable,
|