garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
427 stars 102 forks source link

TreeControl - Nested Nodes Incorrect Positions. #89

Open skln131313 opened 10 years ago

skln131313 commented 10 years ago

When a nested node with children is toggled it does not invalidate the parent node which causes the node to remain the same size. This can be fixed by adding InvalidateParent() into TreeNode::Open/Close.

But this reveals another error in that the parent node's total height is calculated before the children are given a chance to recalculate their layout size. This means the layout will always be behind one step.

Temporary fix would be to remove the if statement in Base::RecursiveLayout():

if ( NeedsLayout() )
{
    m_bNeedsLayout = false;
    Layout( skin );
}

Though this obviously comes with a performance hit, as every layout will be recalculated every render and may cause flicker.