From 5d817616064ca272fa23fe08fe6c3a587212b717 Mon Sep 17 00:00:00 2001 From: AnturK Date: Fri, 8 Dec 2017 18:48:26 +0100 Subject: [PATCH] Fixes tooltip offsets (partially) --- code/modules/tooltip/tooltip.dm | 3 ++- code/modules/tooltip/tooltip.html | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/code/modules/tooltip/tooltip.dm b/code/modules/tooltip/tooltip.dm index afafbbdf668..64c586a9145 100644 --- a/code/modules/tooltip/tooltip.dm +++ b/code/modules/tooltip/tooltip.dm @@ -73,7 +73,8 @@ Notes: params = {"{ "cursor": "[params]", "screenLoc": "[thing.screen_loc]" }"} //Send stuff to the tooltip - src.owner << output(list2params(list(params, src.owner.view, "[title][content]", theme, special)), "[src.control]:tooltip.update") + var/view_size = getviewsize(owner.view) + owner << output(list2params(list(params, view_size[1] , view_size[2], "[title][content]", theme, special)), "[src.control]:tooltip.update") //If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips src.showing = 0 diff --git a/code/modules/tooltip/tooltip.html b/code/modules/tooltip/tooltip.html index 859ee3134d3..67fb8a77f10 100644 --- a/code/modules/tooltip/tooltip.html +++ b/code/modules/tooltip/tooltip.html @@ -99,7 +99,8 @@ 'tileSize': 32, 'control': '', 'params': {}, - 'clientView': 0, + 'client_view_w': 0, + 'client_view_h': 0, 'text': '', 'theme': '', 'padding': 2, @@ -121,7 +122,7 @@ //Get the real icon size according to the client view var mapWidth = map['view-size'].x, mapHeight = map['view-size'].y, - tilesShown = (tooltip.clientView * 2) + 1, + tilesShown = tooltip.client_view_w realIconSize = mapWidth / tilesShown, resizeRatio = realIconSize / tooltip.tileSize, //Calculate letterboxing offsets @@ -230,10 +231,11 @@ tooltip.hide(); }); }, - update: function(params, clientView, text, theme, special) { + update: function(params, client_vw , clien_vh , text, theme, special) { //Assign our global object tooltip.params = $.parseJSON(params); - tooltip.clientView = parseInt(clientView); + tooltip.client_view_w = parseInt(client_vw); + tooltip.client_view_h = parseInt(clien_vh); tooltip.text = text; tooltip.theme = theme; tooltip.special = special;