TGUI & Tooltip browser windows now properly support DPI scaling (#65686)

This commit is contained in:
William Wallace
2022-03-26 14:15:25 -07:00
committed by GitHub
parent 39520ba4b1
commit 39defc2f37
3 changed files with 63 additions and 47 deletions
+7 -2
View File
@@ -216,8 +216,13 @@
$wrap.width($wrap.width() + 2); //Dumb hack to fix a bizarre sizing bug
var docWidth = $wrap.outerWidth(),
docHeight = $wrap.outerHeight();
var pixelRatio = 1;
if (window.devicePixelRatio) {
pixelRatio = window.devicePixelRatio;
}
var docWidth = Math.floor($wrap.outerWidth() * pixelRatio),
docHeight = Math.floor($wrap.outerHeight() * pixelRatio);
if (posY + docHeight > map.size.y) { //Is the bottom edge below the window? Snap it up if so
posY = (posY - docHeight) - realIconSizeY - tooltip.padding;