Fix a bug when changing themes (some properties where not updated due to cached properties).

Fix a bug when displaying sub-menus, it was sometimes incorrectly positioned.
This commit is contained in:
Martín Lucas Golini
2025-04-20 12:41:36 -03:00
parent 53aba9d887
commit 5f9d2bd5ea
13 changed files with 77 additions and 28 deletions

View File

@@ -35,7 +35,8 @@ class EE_API StyleSheetProperty {
StyleSheetProperty();
explicit StyleSheetProperty( const PropertyDefinition* definition, const std::string& value,
const Uint32& index = 0, bool trimValue = true );
const Uint32& index = 0, bool trimValue = true,
bool cachedProperty = false );
explicit StyleSheetProperty( const std::string& name, const std::string& value,
const bool& trimValue = true, const Uint32& specificity = 0,
@@ -177,6 +178,10 @@ class EE_API StyleSheetProperty {
const std::vector<VariableFunctionCache>& getVarCache() const;
StyleSheetProperty& setCachedProperty( bool cached );
bool isCachedProperty() const;
protected:
std::string mName;
String::HashType mNameHash;
@@ -187,6 +192,7 @@ class EE_API StyleSheetProperty {
bool mVolatile;
bool mImportant;
bool mIsVarValue;
bool mCachedProperty{ false };
const PropertyDefinition* mPropertyDefinition;
const ShorthandDefinition* mShorthandDefinition;
std::vector<StyleSheetProperty> mIndexedProperty;

View File

@@ -39,6 +39,8 @@ class EE_API StyleSheetStyle {
void clearProperties();
void clearCachedProperties();
bool hasProperties() const;
bool hasProperty( PropertyId id ) const;

View File

@@ -157,7 +157,8 @@ class EE_API UISceneNode : public SceneNode {
void nodeToWorldTranslation( Vector2f& Pos ) const;
void reloadStyle( bool disableAnimations = false, bool forceReApplyProperties = false );
void reloadStyle( bool disableAnimations = false, bool forceReApplyProperties = false,
bool resetPropertiesCache = false );
bool hasThreadPool() const;

View File

@@ -77,6 +77,8 @@ class EE_API UIStyle : public UIState {
void resetGlobalDefinition();
void resetCachedProperties();
protected:
UIWidget* mWidget;
std::shared_ptr<CSS::StyleSheetStyle> mElementStyle;

View File

@@ -197,9 +197,9 @@ class EE_API UIWidget : public UINode {
UIStyle* getUIStyle() const;
void reloadStyle( const bool& reloadChilds = true, const bool& disableAnimations = false,
const bool& reportStateChange = true,
const bool& forceReApplyProperties = false );
void reloadStyle( bool reloadChilds = true, bool disableAnimations = false,
bool reportStateChange = true, bool forceReApplyProperties = false,
bool resetPropertyCache = false );
void beginAttributesTransaction();