Limit the size of controller-focused inventory windows on large screens

This commit is contained in:
Andrew Lanzone 2025-05-24 20:08:45 -07:00
parent f1c34ea7b1
commit 3eec24b2a6
4 changed files with 31 additions and 4 deletions

View File

@ -1010,9 +1010,15 @@ namespace MWGui
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
{
// Fill the screen, or limit to a certain size on large screens.
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
int width = std::min(viewSize.width, 2200);
int height = std::min(viewSize.height - 48 - 48, 1200);
int x = (viewSize.width - width) / 2;
int y = (viewSize.height - height) / 2;
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48);
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
adjustPanes();
updatePreviewSize();

View File

@ -1415,9 +1415,16 @@ namespace MWGui
void MapWindow::setActiveControllerWindow(bool active)
{
// Fill the screen, or limit to a certain size on large screens. Size chosen to
// show the entire local map without scrolling.
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
int width = std::min(viewSize.width, 1552);
int height = std::min(viewSize.height - 48 - 48, 1572);
int x = (viewSize.width - width) / 2;
int y = (viewSize.height - height) / 2;
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48);
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
WindowBase::setActiveControllerWindow(active);
}

View File

@ -281,9 +281,16 @@ namespace MWGui
void SpellWindow::setActiveControllerWindow(bool active)
{
// Fill the screen, or limit to a certain size on large screens. Size chosen to
// match the size of the stats window.
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
int width = std::min(viewSize.width, 600);
int height = std::min(viewSize.height - 48 - 48, 750);
int x = (viewSize.width - width) / 2;
int y = (viewSize.height - height) / 2;
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48);
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
WindowBase::setActiveControllerWindow(active);
}

View File

@ -740,9 +740,16 @@ namespace MWGui
void StatsWindow::setActiveControllerWindow(bool active)
{
// Fill the screen, or limit to a certain size on large screens. Size chosen to
// show all stats.
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
int width = std::min(viewSize.width, 600);
int height = std::min(viewSize.height - 48 - 48, 750);
int x = (viewSize.width - width) / 2;
int y = (viewSize.height - height) / 2;
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48);
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
onWindowResize(window);