void UIComponentTreeView::updateItemPositions() { float offset_y = 0.f; for(size_t i = 0; i < mParent->getChildCount(); ++i) { UIView* child = mParent->getChild(i); child->setPosition(child->getPosition().x, mParent->getPosition().y + offset_y); offset_y += child->getSize().y + 2.f; if(mSubTreeView) { Log("Child %d sizeY %f stays at %f", i, child->getSize().y, child->getPosition().y); } } }
void UIView::setLocalPosition(float x, float y) { UIView* parent = getParent(); if(parent) { setPosition(parent->getPosition() + vec2(x,y)); } }
vec2 UIView::getLocalPosition() { UIView* parent = getParent(); if(!parent) return vec2(0.f, 0.f); return getPosition() - parent->getPosition(); }