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

Method _indexFromOffset

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

Source from the content-addressed store, hash-verified

350}
351
352ssize_t TableView::_indexFromOffset(Vec2 offset)
353{
354 ssize_t index = 0;
355 const auto maxIdx = _dataSource->numberOfCellsInTableView(this) - 1;
356
357 if (_vordering == VerticalFillOrder::TOP_DOWN)
358 {
359 offset.y = this->getContainer()->getContentSize().height - offset.y;
360 }
361 index = this->__indexFromOffset(offset);
362 if (index != -1)
363 {
364 index = MAX(0, index);
365 if (index > maxIdx)
366 {
367 index = AX_INVALID_INDEX;
368 }
369 }
370
371 return index;
372}
373
374ssize_t TableView::__indexFromOffset(Vec2 offset)
375{

Callers 2

scrollViewDidScrollMethod · 0.95
onTouchBeganMethod · 0.95

Calls 4

__indexFromOffsetMethod · 0.95
getContainerMethod · 0.80
getContentSizeMethod · 0.45

Tested by

no test coverage detected