From f9888230afe7f1d5c6c6cb95a8aa8c4d53d84aff Mon Sep 17 00:00:00 2001 From: uramer Date: Thu, 26 Oct 2023 20:46:34 +0200 Subject: [PATCH] Fix Lua UI atlasing --- components/lua_ui/image.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/lua_ui/image.cpp b/components/lua_ui/image.cpp index 0454dd19b4..ffe93a8d2d 100644 --- a/components/lua_ui/image.cpp +++ b/components/lua_ui/image.cpp @@ -8,9 +8,7 @@ namespace LuaUi { void LuaTileRect::_setAlign(const MyGUI::IntSize& _oldsize) { - mCurrentCoord.set(0, 0, mCroppedParent->getWidth(), mCroppedParent->getHeight()); - mAlign = MyGUI::Align::Stretch; - MyGUI::TileRect::_setAlign(_oldsize); + mCoord.set(0, 0, mCroppedParent->getWidth(), mCroppedParent->getHeight()); mTileSize = mSetTileSize; // zero tilesize stands for not tiling @@ -25,6 +23,8 @@ namespace LuaUi mTileSize.width = 1e7; if (mTileSize.height <= 0) mTileSize.height = 1e7; + + MyGUI::TileRect::_updateView(); } void LuaImage::initialize() @@ -55,13 +55,13 @@ namespace LuaUi if (texture != nullptr) textureSize = MyGUI::IntSize(texture->getWidth(), texture->getHeight()); - mTileRect->updateSize(MyGUI::IntSize(tileH ? textureSize.width : 0, tileV ? textureSize.height : 0)); - setImageTile(textureSize); - if (atlasCoord.width == 0) atlasCoord.width = textureSize.width; if (atlasCoord.height == 0) atlasCoord.height = textureSize.height; + + mTileRect->updateSize(MyGUI::IntSize(tileH ? atlasCoord.width : 0, tileV ? atlasCoord.height : 0)); + setImageTile(atlasCoord.size()); setImageCoord(atlasCoord); setColour(propertyValue("color", MyGUI::Colour(1, 1, 1, 1)));