diff --git a/code/modules/tooltip/tooltip.dm b/code/modules/tooltip/tooltip.dm
index afafbbdf66..5110b98e8e 100644
--- a/code/modules/tooltip/tooltip.dm
+++ b/code/modules/tooltip/tooltip.dm
@@ -41,21 +41,21 @@ Notes:
/datum/tooltip/New(client/C)
if (C)
- src.owner = C
- src.owner << browse(file2text('code/modules/tooltip/tooltip.html'), "window=[src.control]")
+ owner = C
+ owner << browse(file2text('code/modules/tooltip/tooltip.html'), "window=[control]")
..()
/datum/tooltip/proc/show(atom/movable/thing, params = null, title = null, content = null, theme = "default", special = "none")
- if (!thing || !params || (!title && !content) || !src.owner || !isnum(world.icon_size))
+ if (!thing || !params || (!title && !content) || !owner || !isnum(world.icon_size))
return 0
- if (!src.init)
+ if (!init)
//Initialize some vars
- src.init = 1
- src.owner << output(list2params(list(world.icon_size, src.control)), "[src.control]:tooltip.init")
+ init = 1
+ owner << output(list2params(list(world.icon_size, control)), "[control]:tooltip.init")
- src.showing = 1
+ showing = 1
if (title && content)
title = "
[title]
"
@@ -73,18 +73,19 @@ 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)), "[control]:tooltip.update")
//If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips
- src.showing = 0
- if (src.queueHide)
- src.hide()
+ showing = 0
+ if (queueHide)
+ hide()
return 1
/datum/tooltip/proc/hide()
- if (src.queueHide)
+ if (queueHide)
addtimer(CALLBACK(src, .proc/do_hide), 1)
else
do_hide()
diff --git a/code/modules/tooltip/tooltip.html b/code/modules/tooltip/tooltip.html
index 859ee3134d..67fb8a77f1 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;