1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Fix visibility breaking after multiple updates

This commit is contained in:
uramer 2023-11-17 18:15:07 +01:00
parent d214f6f6ef
commit 9403f06618
2 changed files with 7 additions and 5 deletions

View File

@ -9,6 +9,7 @@ namespace LuaUi
: mForcePosition(false)
, mForceSize(false)
, mPropagateEvents(true)
, mVisible(true)
, mLua(nullptr)
, mWidget(nullptr)
, mSlot(this)
@ -92,10 +93,9 @@ namespace LuaUi
{
// workaround for MyGUI bug
// parent visibility doesn't affect added children
MyGUI::Widget* widget = this->widget();
MyGUI::Widget* parent = widget->getParent();
bool inheritedVisible = widget->getVisible() && (parent == nullptr || parent->getInheritedVisible());
widget->setVisible(inheritedVisible);
MyGUI::Widget* parent = widget()->getParent();
bool inheritedVisible = mVisible && (parent == nullptr || parent->getInheritedVisible());
widget()->setVisible(inheritedVisible);
}
void WidgetExtension::attach(WidgetExtension* ext)
@ -278,7 +278,8 @@ namespace LuaUi
mRelativeCoord = propertyValue("relativePosition", MyGUI::FloatPoint());
mRelativeCoord = propertyValue("relativeSize", MyGUI::FloatSize());
mAnchor = propertyValue("anchor", MyGUI::FloatSize());
mWidget->setVisible(propertyValue("visible", true));
mVisible = propertyValue("visible", true);
mWidget->setVisible(mVisible);
mWidget->setPointer(propertyValue("pointer", std::string("arrow")));
mWidget->setAlpha(propertyValue("alpha", 1.f));
mWidget->setInheritsAlpha(propertyValue("inheritAlpha", true));

View File

@ -135,6 +135,7 @@ namespace LuaUi
MyGUI::FloatSize mAnchor;
bool mPropagateEvents;
bool mVisible; // used to implement updateVisible
private:
// use lua_State* instead of sol::state_view because MyGUI requires a default constructor