MCPcopy Create free account
hub / github.com/axmolengine/axmol / onSizeChanged

Method onSizeChanged

core/ui/UIScrollView.cpp:152–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void ScrollView::onSizeChanged()
153{
154 Layout::onSizeChanged();
155 _topBoundary = _contentSize.height;
156 _rightBoundary = _contentSize.width;
157 Vec2 innerSize = _innerContainer->getContentSize();
158 float orginInnerSizeWidth = innerSize.width;
159 float orginInnerSizeHeight = innerSize.height;
160 float innerSizeWidth = MAX(orginInnerSizeWidth, _contentSize.width);
161 float innerSizeHeight = MAX(orginInnerSizeHeight, _contentSize.height);
162 _innerContainer->setContentSize(Vec2(innerSizeWidth, innerSizeHeight));
163 setInnerContainerPosition(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height));
164
165 if (_verticalScrollBar != nullptr)
166 {
167 _verticalScrollBar->onScrolled(getHowMuchOutOfBoundary());
168 }
169 if (_horizontalScrollBar != nullptr)
170 {
171 _horizontalScrollBar->onScrolled(getHowMuchOutOfBoundary());
172 }
173}
174
175void ScrollView::setInnerContainerSize(const Vec2& size)
176{

Callers

nothing calls this directly

Calls 4

onScrolledMethod · 0.80
Vec2Function · 0.50
getContentSizeMethod · 0.45
setContentSizeMethod · 0.45

Tested by

no test coverage detected