Page 1 of 1

[boskid][2.0.41] Incorrect minimap zoom

Posted: Wed Mar 19, 2025 2:16 am
by Hadron
Hi when playing around with the minimap zoom when modding I found that the zoom level is different when initializing vs setting it via the element.
For example this:

Code: Select all

local minimap = map_frame.add{
        type = "minimap",
        name = "minimap"
        zoom = 1.0
    }
vs this will yield two different zoom levels

Code: Select all

local minimap = map_frame.add{
        type = "minimap",
        name = "minimap"
    }
minimap.zoom = 1.0
You can also refer to this post 123269 for someone else experiencing the same

Re: [boskid][2.0.41] Incorrect minimap zoom

Posted: Fri Mar 21, 2025 2:47 pm
by boskid
Thanks for the report. Issue should be now fixed for 2.0.43.

There were couple of issues that i was able to observe: zoom given during creation was ignored because at the time when custom minimap widget was created, its gui counterpart was not yet created and when the gui counterpart was finally created it was not populated with the zoom value. This also affected minimap widgets when save-loading because even if you would set the zoom value, the zoom would be lost as the gui counterpart was recreated while the custom minimap widget which is part of game state was still the same one. As for the zoom values themselves, i noticed that the default value of 0.75 was not respected as reading this value and writing it back would change zoom of the minimap which is against all expectations. Code that was affected seems to be changed during one of the zoom refactorings and the issue creeped in as previously the zoom value had to be divided by 32 and it was producing a "scale" however after the changes, division by 32 was still there however it was no longer setting "scale" but a "zoom" value.