@checksub_team/peaks_timeline 1.6.1 → 1.6.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 +12 -5
- package/src/line-indicator.js +3 -1
- package/src/source-group.js +13 -6
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -14419,17 +14419,19 @@ module.exports = function (Konva, Utils, SVGs) {
|
|
|
14419
14419
|
indicator.setAttr('trueHeight', indicatorHeight);
|
|
14420
14420
|
indicator.y(line.getY() + (line.lineHeight() - indicatorHeight) / 2);
|
|
14421
14421
|
var self = this;
|
|
14422
|
-
indicator.on('
|
|
14422
|
+
indicator.on('mouseenter', function () {
|
|
14423
14423
|
indicator.getChildren().forEach(function (child) {
|
|
14424
14424
|
child.fill(child.getAttr('selectedColor'));
|
|
14425
14425
|
});
|
|
14426
14426
|
self.draw();
|
|
14427
|
+
self._stage.container().style.cursor = 'pointer';
|
|
14427
14428
|
});
|
|
14428
14429
|
indicator.on('mouseout', function () {
|
|
14429
14430
|
indicator.getChildren().forEach(function (child) {
|
|
14430
14431
|
child.fill(child.getAttr('defaultColor'));
|
|
14431
14432
|
});
|
|
14432
14433
|
self.draw();
|
|
14434
|
+
self._stage.container().style.cursor = 'default';
|
|
14433
14435
|
});
|
|
14434
14436
|
indicator.on('click', function (e) {
|
|
14435
14437
|
self._peaks.emit('lineIndicator.click', self._indicators[line.getId()], e.evt);
|
|
@@ -17578,6 +17580,11 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17578
17580
|
this._initialFrameOffset = this._view.getFrameOffset();
|
|
17579
17581
|
};
|
|
17580
17582
|
SourceGroup.prototype._onSourceGroupDragEnd = function () {
|
|
17583
|
+
var handleWidth = Math.min(this._peaks.options.sourceHandleWidth, this._width / 2);
|
|
17584
|
+
this._leftHandle.width(handleWidth);
|
|
17585
|
+
this._rightHandle.width(handleWidth);
|
|
17586
|
+
this._rightHandle.x(this._width - handleWidth);
|
|
17587
|
+
this._view.drawSourcesLayer();
|
|
17581
17588
|
this._dragged = false;
|
|
17582
17589
|
this._view.updateTimelineLength();
|
|
17583
17590
|
this._peaks.emit('sources.updated', [this._source]);
|
|
@@ -17615,7 +17622,6 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17615
17622
|
var newWidth = endPixel - startPixel;
|
|
17616
17623
|
if (newWidth !== this._width) {
|
|
17617
17624
|
this._width = newWidth;
|
|
17618
|
-
this._rightHandle.x(newWidth - this._peaks.options.sourceHandleWidth);
|
|
17619
17625
|
this.updatePreviews();
|
|
17620
17626
|
}
|
|
17621
17627
|
};
|
|
@@ -17645,10 +17651,11 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17645
17651
|
};
|
|
17646
17652
|
SourceGroup.prototype._addHandles = function (forceCreate) {
|
|
17647
17653
|
var self = this;
|
|
17654
|
+
var handleWidth = Math.min(this._peaks.options.sourceHandleWidth, this._width / 2);
|
|
17648
17655
|
if (!this._leftHandle || forceCreate) {
|
|
17649
17656
|
this._leftHandle = new Konva.Rect({
|
|
17650
17657
|
x: 0,
|
|
17651
|
-
width:
|
|
17658
|
+
width: handleWidth,
|
|
17652
17659
|
height: this._unwrappedHeight,
|
|
17653
17660
|
visible: true,
|
|
17654
17661
|
draggable: this._source.resizable,
|
|
@@ -17673,8 +17680,8 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
|
|
|
17673
17680
|
}
|
|
17674
17681
|
if (!this._rightHandle || forceCreate) {
|
|
17675
17682
|
this._rightHandle = new Konva.Rect({
|
|
17676
|
-
x: this._width -
|
|
17677
|
-
width:
|
|
17683
|
+
x: this._width - handleWidth,
|
|
17684
|
+
width: handleWidth,
|
|
17678
17685
|
height: this._unwrappedHeight,
|
|
17679
17686
|
visible: true,
|
|
17680
17687
|
draggable: this._source.resizable,
|
package/src/line-indicator.js
CHANGED
|
@@ -197,11 +197,12 @@ define([
|
|
|
197
197
|
|
|
198
198
|
var self = this;
|
|
199
199
|
|
|
200
|
-
indicator.on('
|
|
200
|
+
indicator.on('mouseenter', function() {
|
|
201
201
|
indicator.getChildren().forEach(function(child) {
|
|
202
202
|
child.fill(child.getAttr('selectedColor'));
|
|
203
203
|
});
|
|
204
204
|
self.draw();
|
|
205
|
+
self._stage.container().style.cursor = 'pointer';
|
|
205
206
|
});
|
|
206
207
|
|
|
207
208
|
indicator.on('mouseout', function() {
|
|
@@ -209,6 +210,7 @@ define([
|
|
|
209
210
|
child.fill(child.getAttr('defaultColor'));
|
|
210
211
|
});
|
|
211
212
|
self.draw();
|
|
213
|
+
self._stage.container().style.cursor = 'default';
|
|
212
214
|
});
|
|
213
215
|
|
|
214
216
|
indicator.on('click', function(e) {
|
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,
|