Minor optimization.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-12-17 02:28:00 -03:00
parent 7caa7e8b55
commit 346bda45f2
2 changed files with 9 additions and 2 deletions

View File

@@ -33,7 +33,8 @@ enum UIFlag {
UI_ANCHOR_LEFT = (1 << 16),
UI_ANCHOR_RIGHT = (1 << 17),
UI_TOUCH_DRAG_ENABLED = (1 << 18),
UI_TEXT_SELECTION_ENABLED = (1 << 19)
UI_TEXT_SELECTION_ENABLED = (1 << 19),
UI_ATTRIBUTE_CHANGED = (1 << 20)
};
enum UINodeType {

View File

@@ -406,6 +406,8 @@ void UIWidget::notifyLayoutAttrChange() {
if ( 0 == mAttributesTransactionCount ) {
NodeMessage msg( this, NodeMessage::LayoutAttributeChange );
messagePost( &msg );
} else {
mFlags |= UI_ATTRIBUTE_CHANGED;
}
}
@@ -756,7 +758,11 @@ void UIWidget::endAttributesTransaction() {
mAttributesTransactionCount--;
if ( 0 == mAttributesTransactionCount ) {
notifyLayoutAttrChange();
if ( mFlags & UI_ATTRIBUTE_CHANGED ) {
notifyLayoutAttrChange();
mFlags &= ~UI_ATTRIBUTE_CHANGED;
}
}
}