mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
GraphTooltip: added boundaries so we never render tooltip outside window. (#20874)
This commit is contained in:
parent
ad33d95dd3
commit
5f72bfe6e7
@ -42,8 +42,11 @@ $.fn.place_tt = (() => {
|
|||||||
width = $tooltip.outerWidth(true);
|
width = $tooltip.outerWidth(true);
|
||||||
height = $tooltip.outerHeight(true);
|
height = $tooltip.outerHeight(true);
|
||||||
|
|
||||||
$tooltip.css('left', x + opts.offset + width > $win.width() ? x - opts.offset - width : x + opts.offset);
|
const left = x + opts.offset + width > $win.width() ? x - opts.offset - width : x + opts.offset;
|
||||||
$tooltip.css('top', y + opts.offset + height > $win.height() ? y - opts.offset - height : y + opts.offset);
|
const top = y + opts.offset + height > $win.height() ? y - opts.offset - height : y + opts.offset;
|
||||||
|
|
||||||
|
$tooltip.css('left', left > 0 ? left : 0);
|
||||||
|
$tooltip.css('top', top > 0 ? top : 0);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user