mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
Add simple measure to prevent compression of the tooltip at the right edge of the screen (may be improved, not tested on mobile screens)
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -1088,12 +1088,17 @@ var customTooltips = function(tooltip) {
|
||||
|
||||
// Display, position, and set styles for font
|
||||
var position = this._chart.canvas.getBoundingClientRect();
|
||||
var width = tooltip.caretX;
|
||||
// Prevent compression of the tooltip at the right edge of the screen
|
||||
if($(document).width() - tooltip.caretX < 400)
|
||||
{
|
||||
width = $(document).width()-400;
|
||||
}
|
||||
tooltipEl.style.opacity = 1;
|
||||
tooltipEl.style.left = position.left + tooltip.caretX + "px";
|
||||
tooltipEl.style.left = position.left + width + "px";
|
||||
tooltipEl.style.top = position.top + tooltip.caretY + 'px';
|
||||
tooltipEl.style.fontFamily = tooltip._bodyFontFamily;
|
||||
tooltipEl.style.fontSize = tooltip.bodyFontSize + 'px';
|
||||
tooltipEl.style.fontStyle = tooltip._bodyFontStyle;
|
||||
tooltipEl.style.padding = tooltip.yPadding + 'px ' + tooltip.xPadding + 'px';
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user