Adriano0ad Posted November 26, 2025 Share Posted November 26, 2025 I don't know what I did wrong, but I can't find where to reduce the spacing between the icons. I've even replaced the folders, but the error persists. Link to comment Share on other sites More sharing options...
Atrik Posted November 26, 2025 Share Posted November 26, 2025 Hi @Adriano0ad, I'm guessing what you mean is that you resized the panel and now you want icons to fit better in the panel. The spacing is calculated dynamically so you should only have to increase the number of items per row. In the selection_panels.js for example : g_SelectionPanels.Construction = { "getMaxNumberOfItems": function() { return 40 - getNumberOfRightPanelButtons(); }, "rowLength": 10, // <<<< INCREASE THIS NUMBER to 12 for example "getItems": function() { ... 2 Link to comment Share on other sites More sharing options...
Mentula Posted November 26, 2025 Share Posted November 26, 2025 Hi @Adriano0ad, Here is a solution if you want to control the margin between buttons dynamically. No file replacement needed. If you want to change the margin for all panels: setPanelObjectPosition = new Proxy(setPanelObjectPosition, {apply: function(target, thisArg, args) { const vMargin = 3; // Vertical margin between buttons const hMargin = 3; // Horizontal margin between buttons target(args[0], args[1], args[2], vMargin, hMargin); }}); and place this code in a new file gui/session/unit_commands~MyMod.js. If instead, you want to change the margin for one/some panel(s) only (f.e. "Construction" panel): g_SelectionPanels.Construction.setupButton = new Proxy(g_SelectionPanels.Construction.setupButton, {apply: function(target, thisArg, args) { const ret = target(...args); // Run original function const vMargin = 3; // Vertical margin between buttons const hMargin = 3; // Horizontal margin between buttons const data = args[0]; setPanelObjectPosition(data.button, data.i + getNumberOfRightPanelButtons(), data.rowLength, vMargin, hMargin); return ret; }}); and place this code in a new file gui/session/selection_panels~MyMod.js. 1 Link to comment Share on other sites More sharing options...
Atrik Posted November 26, 2025 Share Posted November 26, 2025 Ah, I was wrong indeed, thanks @Mentula, the items margins aren't calculated dynamically relative to the containers size. Unlikely that you want to create proxies to re-overwrite them thoughts, if you changed them or if there is a issue with the icon size, better fix it. 1 Link to comment Share on other sites More sharing options...
Adriano0ad Posted November 26, 2025 Author Share Posted November 26, 2025 Thank you very much for the explanations. I ended up uninstalling and reinstalling the game to get it back to normal haha. Now you can try modifying the layout and adjusting a few things again. Thanks for the help, and I'll come back and share the results later =D 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now