MZ [SOLVED] Centering the Command Window in Main Menu

Good evening! 👋

For context, the plugins I am using for my main menu is Visustella's Core Engine and Main Menu Core. I am also using MachPen's Simplest Menu plugin. Offhand, the particles are from MogHunter's Menu Particles.

My menu is close to being what I want except for the command panel not being centered. The amount of buttons could change in the future so I don't want to do picture-eventing for the menu either. Is there a way to adjust the command window to be always centered? My window is also 1280 x 720. My UI area width is 630 and my UI area height is set to 700.

I am no programmer but I figured that the possibility of adjusting it in the Javascript would be in Visustella's Core Engine plugin.

VS Main Menu Core -> Menu Layout Settings -> Scene_Menu
JavaScript:
const width = this.mainCommandWidth();
const height = this.mainAreaHeight() - this.goldWindowRect().height;
const x = this.isRightInputMode() ? Graphics.boxWidth - width : 0;
const y = this.mainAreaTop();
return new Rectangle(x, y, width, height);

Would it be a simple edit in the JS code above? Or is this something that requires a new plugin? My non gamedev friends are saying I'd need to go and adjust the CSS but I'm unsure if that's the route to take for RPGM. Thank you for reading!

GBWY_Screenshot_Menu_WIP.png
Hi there!

In theory, you could do this:
JavaScript:
const width = this.mainCommandWidth();
const height = this.mainAreaHeight() - this.goldWindowRect().height;
const x = Graphics.boxWidth/2 - width/2
const y = Graphics.boxHeight/2 - height/2
return new Rectangle(x, y, width, height);

The thing is I don't know exactly, since you have some plugins that mess with the menus, how the height and width are being calculated. Assuming they are doing right, the calculations to the X and Y properties are right.

Otherwise, you may need to find a way to know the height and width size, in case the amount of columns or rows(more or less commands on the window) can be dynamically changed.
Hi there!

In theory, you could do this:
JavaScript:
const width = this.mainCommandWidth();
const height = this.mainAreaHeight() - this.goldWindowRect().height;
const x = Graphics.boxWidth/2 - width/2
const y = Graphics.boxHeight/2 - height/2
return new Rectangle(x, y, width, height);

The thing is I don't know exactly, since you have some plugins that mess with the menus, how the height and width are being calculated. Assuming they are doing right, the calculations to the X and Y properties are right.

Otherwise, you may need to find a way to know the height and width size, in case the amount of columns or rows(more or less commands on the window) can be dynamically changed.
Hello!

I actually posted this question in the Visustella Discord Server and received help from Archeia to move the panel based on the Y Axis. However, I was actually wrong in my assumption about editing from the Visustella Core!

For this specific menu, the placement of the command panel is actually controlled by MachPen's plugin. I have already tried their adjustment which was using
JavaScript:
return new Rectangle(x, y + 150, width, height);
but I'm going to try your script as well. Results in 10-20 minutes!

GBWY_Screenshot_Menu_WIP2_Archeia.PNG
Hi there!

In theory, you could do this:
JavaScript:
const width = this.mainCommandWidth();
const height = this.mainAreaHeight() - this.goldWindowRect().height;
const x = Graphics.boxWidth/2 - width/2
const y = Graphics.boxHeight/2 - height/2
return new Rectangle(x, y, width, height);

The thing is I don't know exactly, since you have some plugins that mess with the menus, how the height and width are being calculated. Assuming they are doing right, the calculations to the X and Y properties are right.

Otherwise, you may need to find a way to know the height and width size, in case the amount of columns or rows(more or less commands on the window) can be dynamically changed.
So an update:

Unfortunately copy pasting directly did not work, and even after adjustments, the control panel did not move like it did with Archeia's suggestion. I wonder if it's due to it being a combo of plugins? Or maybe my adjustments were flawed.

Here's the original code in MachPen's plugin ->

JavaScript:
const ww = this.mainCommandWidth();
    const wh = this.mainAreaHeight() - this.goldWindowRect().height;
    const wx = Math.floor((Graphics.boxWidth - ww)/2);
    const wy = this.mainAreaTop();
    return new Rectangle(wx, wy, ww, wh);

And here's my adjustments referencing your code after copy-pasting didn't work ->

JavaScript:
    const ww = this.mainCommandWidth();
    const wh = this.mainAreaHeight() - this.goldWindowRect().height;
    const wx = Math.floor((Graphics.boxWidth/2 - ww/2));
    const wy = Math.floor((Graphics.boxHeight/2 - wh/2));
    return new Rectangle(wx, wy, ww, wh);
};

In the attached pictures I'm going to show a side by side of the menu with the original code and the adjustment based on yours. There is some movement of the buttons, but not much. As I'm not a programmer, I'm not sure why it won't move down on the Y Axis when the graphics are divided by 2.

GBWY_Screenshot_Menu_WIP3_Eliaquim.png
It's hard to know getting so much menu plugins involved. Like I said, on theory, that are the calculations for it to center a window, sprite, anything that has width, height, x, and y properties.
So, don't know how to go from here. Maybe something related to the UI size not the same as your resolution size, or maybe another thing is dynamically changing the Y position of the window based on some other thing.
It's hard to know getting so much menu plugins involved. Like I said, on theory, that are the calculations for it to center a window, sprite, anything that has width, height, x, and y properties.
So, don't know how to go from here. Maybe something related to the UI size not the same as your resolution size, or maybe another thing is dynamically changing the Y position of the window based on some other thing.
Yeah! I plan to just edit based on the Y-axis instead of actually centering it since there is all the plugins involved. Thank you so much for helping me though! 👋

Original thread: https://forums.rpgmakerweb.com/threads/solved-centering-the-command-window-in-main-menu.168789/