Commit 5f72bfe6 by Marcus Andersson Committed by Torkel Ödegaard

GraphTooltip: added boundaries so we never render tooltip outside window. (#20874)

parent ad33d95d
......@@ -42,8 +42,11 @@ $.fn.place_tt = (() => {
width = $tooltip.outerWidth(true);
height = $tooltip.outerHeight(true);
$tooltip.css('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 left = x + opts.offset + width > $win.width() ? x - opts.offset - width : x + 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);
});
};
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment