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

Method _updateContentSize

extensions/GUI/src/GUI/ScrollView/TableView.cpp:286–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void TableView::_updateContentSize()
287{
288 Size size = Size::ZERO;
289 ssize_t cellsCount = _dataSource->numberOfCellsInTableView(this);
290
291 if (cellsCount > 0)
292 {
293 float maxPosition = _vCellsPositions[cellsCount];
294
295 switch (this->getDirection())
296 {
297 case Direction::HORIZONTAL:
298 size = Size(maxPosition, _viewSize.height);
299 break;
300 default:
301 size = Size(_viewSize.width, maxPosition);
302 break;
303 }
304 }
305
306 this->setContentSize(size);
307
308 if (_oldDirection != _direction)
309 {
310 if (_direction == Direction::HORIZONTAL)
311 {
312 this->setContentOffset(Vec2(0.0f, 0.0f));
313 }
314 else
315 {
316 this->setContentOffset(Vec2(0.0f, this->minContainerOffset().y));
317 }
318 _oldDirection = _direction;
319 }
320}
321
322Vec2 TableView::_offsetFromIndex(ssize_t index)
323{

Callers 5

reloadDataMethod · 0.95
insertCellAtIndexMethod · 0.95
createMethod · 0.80
createMethod · 0.80

Calls 7

setContentOffsetMethod · 0.80
minContainerOffsetMethod · 0.80
SizeClass · 0.50
Vec2Function · 0.50
getDirectionMethod · 0.45
setContentSizeMethod · 0.45

Tested by 1

createMethod · 0.64