@checksub_team/peaks_timeline 1.6.3 → 1.6.4
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 +10 -5
- package/src/line-indicator.js +4 -4
- package/src/line.js +3 -1
- package/src/segments-group.js +7 -3
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -14464,7 +14464,9 @@ module.exports = function (Konva, Utils, SVGs) {
|
|
|
14464
14464
|
LineIndicator.prototype.updateIndicator = function (lineId) {
|
|
14465
14465
|
if (this._indicators[lineId]) {
|
|
14466
14466
|
var y = this._indicators[lineId].line.getY();
|
|
14467
|
-
|
|
14467
|
+
var isVisible = y + this._indicators[lineId].line.lineHeight() + this._yPadding > 0 && y - this._yPadding < this._height;
|
|
14468
|
+
var isLineNotEmpty = !this._indicators[lineId].line.isEmpty();
|
|
14469
|
+
if (isLineNotEmpty && isVisible) {
|
|
14468
14470
|
if (!this._indicators[lineId].indicator) {
|
|
14469
14471
|
this._indicators[lineId].indicator = this._createIndicator(this._indicators[lineId].line, this._indicators[lineId].type, this._indicators[lineId].text);
|
|
14470
14472
|
this._layer.add(this._indicators[lineId].indicator);
|
|
@@ -14635,7 +14637,7 @@ module.exports = function (Konva, Utils) {
|
|
|
14635
14637
|
return this._id;
|
|
14636
14638
|
};
|
|
14637
14639
|
Line.prototype.isEmpty = function () {
|
|
14638
|
-
return Object.keys(this._sources).length === 0;
|
|
14640
|
+
return this.isSegmentsLine() ? this._segmentsGroup.isEmpty() : Object.keys(this._sources).length === 0;
|
|
14639
14641
|
};
|
|
14640
14642
|
Line.prototype.isSegmentsLine = function () {
|
|
14641
14643
|
return Boolean(this._segmentsGroup);
|
|
@@ -17023,6 +17025,9 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
17023
17025
|
}
|
|
17024
17026
|
}
|
|
17025
17027
|
};
|
|
17028
|
+
SegmentsGroup.prototype.isEmpty = function () {
|
|
17029
|
+
return Object.keys(this._segments).length === 0;
|
|
17030
|
+
};
|
|
17026
17031
|
SegmentsGroup.prototype.addToGroup = function (group) {
|
|
17027
17032
|
group.add(this._group);
|
|
17028
17033
|
};
|
|
@@ -17237,10 +17242,10 @@ module.exports = function (SegmentShape, Utils, Konva) {
|
|
|
17237
17242
|
}
|
|
17238
17243
|
}
|
|
17239
17244
|
if (!currentHeight) {
|
|
17240
|
-
if (
|
|
17241
|
-
currentHeight = this._peaks.options.segmentHeight;
|
|
17242
|
-
} else {
|
|
17245
|
+
if (this.isEmpty()) {
|
|
17243
17246
|
currentHeight = this._peaks.options.emptyLineHeight;
|
|
17247
|
+
} else {
|
|
17248
|
+
currentHeight = this._peaks.options.segmentHeight;
|
|
17244
17249
|
}
|
|
17245
17250
|
}
|
|
17246
17251
|
return currentHeight;
|
package/src/line-indicator.js
CHANGED
|
@@ -251,10 +251,11 @@ define([
|
|
|
251
251
|
LineIndicator.prototype.updateIndicator = function(lineId) {
|
|
252
252
|
if (this._indicators[lineId]) {
|
|
253
253
|
var y = this._indicators[lineId].line.getY();
|
|
254
|
+
var isVisible = y + this._indicators[lineId].line.lineHeight() + this._yPadding > 0
|
|
255
|
+
&& y - this._yPadding < this._height;
|
|
256
|
+
var isLineNotEmpty = !this._indicators[lineId].line.isEmpty();
|
|
254
257
|
|
|
255
|
-
if (
|
|
256
|
-
&& y - this._yPadding < this._height) {
|
|
257
|
-
// The indicator is visible
|
|
258
|
+
if (isLineNotEmpty && isVisible) {
|
|
258
259
|
if (!this._indicators[lineId].indicator) {
|
|
259
260
|
this._indicators[lineId].indicator = this._createIndicator(
|
|
260
261
|
this._indicators[lineId].line,
|
|
@@ -271,7 +272,6 @@ define([
|
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
274
|
else {
|
|
274
|
-
// The indicator is out of the view, we remove it
|
|
275
275
|
this.removeIndicator(lineId, true);
|
|
276
276
|
}
|
|
277
277
|
}
|
package/src/line.js
CHANGED
|
@@ -52,7 +52,9 @@ define([
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
Line.prototype.isEmpty = function() {
|
|
55
|
-
return
|
|
55
|
+
return this.isSegmentsLine() ?
|
|
56
|
+
this._segmentsGroup.isEmpty() :
|
|
57
|
+
Object.keys(this._sources).length === 0;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
Line.prototype.isSegmentsLine = function() {
|
package/src/segments-group.js
CHANGED
|
@@ -68,6 +68,10 @@ define([
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
SegmentsGroup.prototype.isEmpty = function() {
|
|
72
|
+
return Object.keys(this._segments).length === 0;
|
|
73
|
+
};
|
|
74
|
+
|
|
71
75
|
/**
|
|
72
76
|
* Adds the group to the given {Konva.Group}.
|
|
73
77
|
*
|
|
@@ -394,11 +398,11 @@ define([
|
|
|
394
398
|
}
|
|
395
399
|
|
|
396
400
|
if (!currentHeight) {
|
|
397
|
-
if (
|
|
398
|
-
currentHeight = this._peaks.options.
|
|
401
|
+
if (this.isEmpty()) {
|
|
402
|
+
currentHeight = this._peaks.options.emptyLineHeight;
|
|
399
403
|
}
|
|
400
404
|
else {
|
|
401
|
-
currentHeight = this._peaks.options.
|
|
405
|
+
currentHeight = this._peaks.options.segmentHeight;
|
|
402
406
|
}
|
|
403
407
|
}
|
|
404
408
|
|