No more black borders on the sides with different size (#24151)

This commit is contained in:
RomainzZ
2024-03-21 08:58:17 +08:00
committed by GitHub
parent 002363099d
commit a59829fae8
+17 -6
View File
@@ -269,14 +269,25 @@ GLOBAL_VAR_INIT(admin_ooc_colour, "#b82e00")
var/list/map_size = splittext(sizes["paramapwindow.size"], "x")
// Looks like we didn't expect paramapwindow.size to be "ixj" where i and j are numbers.
// If we don't get our expected 2 outputs, let's give some useful error info.
if(length(map_size) != 2)
CRASH("map_size of incorrect length --- map_size var: [map_size] --- map_size length: [length(map_size)]")
// Gets the type of zoom we're currently using
// If it's 0 we do our pixel calculations based off the size of the mapwindow
// If it's not, we already know how big we want our window to be, since zoom is the exact pixel ratio of the map
var/icon_size = params2list(winget(src, "mainwindow.mainvsplit;paramapwindow;map", "icon-size")) || 0
var/zoom_value = text2num(icon_size["map.icon-size"]) / 32
var/desired_width = 0
if(zoom_value)
desired_width = round(view_size[1] * zoom_value * world.icon_size)
else
// Looks like we didn't expect paramapwindow.size to be "ixj" where i and j are numbers.
// If we don't get our expected 2 outputs, let's give some useful error info.
if(length(map_size) != 2)
CRASH("map_size of incorrect length --- map_size var: [map_size] --- map_size length: [length(map_size)]")
var/height = text2num(map_size[2])
desired_width = round(height * aspect_ratio)
var/height = text2num(map_size[2])
var/desired_width = round(height * aspect_ratio)
if(text2num(map_size[1]) == desired_width)
// Nothing to do.
return