Prevent a second tooltip from immediately hovering after pinning a tooltip.
This commit is contained in:
Родитель
ab3d3f9734
Коммит
326649b700
|
@ -340,6 +340,8 @@ Display.prototype.onClick = function (event, pos, item) {
|
|||
var tooltip = this.createToolTip(item, true);
|
||||
tooltip.drawFloating();
|
||||
|
||||
this.lastToolTip = tooltip;
|
||||
|
||||
// The color of the line will be the series color.
|
||||
var line = this.graph.info[item.seriesIndex];
|
||||
if (!line)
|
||||
|
@ -369,6 +371,11 @@ Display.prototype.onHover = function (event, pos, item) {
|
|||
this.hovering = null;
|
||||
}
|
||||
|
||||
// If we have a pinned tooltip that has not been moved yet, don't draw a
|
||||
// second tooltip on top of it.
|
||||
if (this.lastToolTip && !this.lastToolTip.dragged && !this.lastToolTip.closed)
|
||||
return;
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ ToolTip.prototype.remove = function () {
|
|||
if (this.svg)
|
||||
this.svg.remove();
|
||||
this.elt.remove();
|
||||
this.closed = true;
|
||||
}
|
||||
|
||||
ToolTip.prototype.midpoint = function () {
|
||||
|
@ -104,6 +105,7 @@ ToolTip.prototype.onDrag = function (event) {
|
|||
this.line.setAttribute('x2', this.midpoint().x);
|
||||
this.line.setAttribute('y2', this.midpoint().y);
|
||||
this.svg.height($('window').height());
|
||||
this.dragged = true;
|
||||
}
|
||||
|
||||
ToolTip.prototype.attachLine = function (color) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче