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

Method _updateCellPositions

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

Source from the content-addressed store, hash-verified

442}
443
444void TableView::_updateCellPositions()
445{
446 ssize_t cellsCount = _dataSource->numberOfCellsInTableView(this);
447 _vCellsPositions.resize(cellsCount + 1, 0.0);
448
449 if (cellsCount > 0)
450 {
451 float currentPos = 0;
452 Size cellSize;
453 for (int i = 0; i < cellsCount; i++)
454 {
455 _vCellsPositions[i] = currentPos;
456 cellSize = _dataSource->tableCellSizeForIndex(this, i);
457 switch (this->getDirection())
458 {
459 case Direction::HORIZONTAL:
460 currentPos += cellSize.width;
461 break;
462 default:
463 currentPos += cellSize.height;
464 break;
465 }
466 }
467 _vCellsPositions[cellsCount] = currentPos; // 1 extra value allows us to get right/bottom of the last cell
468 }
469}
470
471void TableView::scrollViewDidScroll(ScrollView* /*view*/)
472{

Callers 5

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

Calls 4

resizeMethod · 0.45
tableCellSizeForIndexMethod · 0.45
getDirectionMethod · 0.45

Tested by 1

createMethod · 0.64