@checksub_team/peaks_timeline 1.5.9 → 1.5.10
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 +5 -3
- package/src/line-indicator.js +6 -4
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -14306,6 +14306,7 @@ module.exports = function (Konva, Utils, SVGs) {
|
|
|
14306
14306
|
noVisibility: this._peaks.options.lineIndicatorNoVisibilityIconSize
|
|
14307
14307
|
}
|
|
14308
14308
|
};
|
|
14309
|
+
this._yPadding = 30;
|
|
14309
14310
|
this._defaultPadding = 5;
|
|
14310
14311
|
this._types = ['default'].concat(Object.keys(SVGs));
|
|
14311
14312
|
this._stage = new Konva.Stage({
|
|
@@ -14449,6 +14450,7 @@ module.exports = function (Konva, Utils, SVGs) {
|
|
|
14449
14450
|
LineIndicator.prototype.removeIndicator = function (lineId, keepInList) {
|
|
14450
14451
|
if (this._indicators[lineId]) {
|
|
14451
14452
|
if (this._indicators[lineId].indicator) {
|
|
14453
|
+
console.log('remove', lineId);
|
|
14452
14454
|
this._indicators[lineId].indicator.destroy();
|
|
14453
14455
|
}
|
|
14454
14456
|
if (!keepInList) {
|
|
@@ -14460,13 +14462,13 @@ module.exports = function (Konva, Utils, SVGs) {
|
|
|
14460
14462
|
};
|
|
14461
14463
|
LineIndicator.prototype.updateIndicator = function (lineId) {
|
|
14462
14464
|
if (this._indicators[lineId]) {
|
|
14463
|
-
var y = this._indicators[lineId].line.getY()
|
|
14464
|
-
if (y + this._indicators[lineId].line.lineHeight() > 0 && y < this._height) {
|
|
14465
|
+
var y = this._indicators[lineId].line.getY();
|
|
14466
|
+
if (y + this._indicators[lineId].line.lineHeight() + this._yPadding > 0 && y - this._yPadding < this._height) {
|
|
14465
14467
|
if (!this._indicators[lineId].indicator) {
|
|
14466
14468
|
this._indicators[lineId].indicator = this._createIndicator(this._indicators[lineId].line, this._indicators[lineId].type, this._indicators[lineId].text);
|
|
14467
14469
|
this._layer.add(this._indicators[lineId].indicator);
|
|
14468
14470
|
} else {
|
|
14469
|
-
this._indicators[lineId].indicator.y(y - this._indicators[lineId].indicator.getAttr('trueHeight') / 2);
|
|
14471
|
+
this._indicators[lineId].indicator.y(y + this._indicators[lineId].line.lineHeight() / 2 - this._indicators[lineId].indicator.getAttr('trueHeight') / 2);
|
|
14470
14472
|
}
|
|
14471
14473
|
} else {
|
|
14472
14474
|
this.removeIndicator(lineId, true);
|
package/src/line-indicator.js
CHANGED
|
@@ -45,6 +45,7 @@ define([
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
this._yPadding = 30;
|
|
48
49
|
this._defaultPadding = 5;
|
|
49
50
|
this._types = ['default'].concat(Object.keys(SVGs));
|
|
50
51
|
|
|
@@ -234,6 +235,7 @@ define([
|
|
|
234
235
|
LineIndicator.prototype.removeIndicator = function(lineId, keepInList) {
|
|
235
236
|
if (this._indicators[lineId]) {
|
|
236
237
|
if (this._indicators[lineId].indicator) {
|
|
238
|
+
console.log('remove', lineId);
|
|
237
239
|
this._indicators[lineId].indicator.destroy();
|
|
238
240
|
}
|
|
239
241
|
if (!keepInList) {
|
|
@@ -247,10 +249,9 @@ define([
|
|
|
247
249
|
|
|
248
250
|
LineIndicator.prototype.updateIndicator = function(lineId) {
|
|
249
251
|
if (this._indicators[lineId]) {
|
|
250
|
-
var y = this._indicators[lineId].line.getY()
|
|
251
|
-
+ (this._indicators[lineId].line.lineHeight() / 2);
|
|
252
|
+
var y = this._indicators[lineId].line.getY();
|
|
252
253
|
|
|
253
|
-
if (y + this._indicators[lineId].line.lineHeight() > 0 && y < this._height) {
|
|
254
|
+
if (y + this._indicators[lineId].line.lineHeight() + this._yPadding > 0 && y - this._yPadding < this._height) {
|
|
254
255
|
// The indicator is visible
|
|
255
256
|
if (!this._indicators[lineId].indicator) {
|
|
256
257
|
this._indicators[lineId].indicator = this._createIndicator(
|
|
@@ -262,7 +263,8 @@ define([
|
|
|
262
263
|
}
|
|
263
264
|
else {
|
|
264
265
|
this._indicators[lineId].indicator.y(
|
|
265
|
-
y
|
|
266
|
+
y + this._indicators[lineId].line.lineHeight() / 2
|
|
267
|
+
- this._indicators[lineId].indicator.getAttr('trueHeight') / 2
|
|
266
268
|
);
|
|
267
269
|
}
|
|
268
270
|
}
|