MCPcopy Index your code
hub / github.com/bvaughn/react-virtualized / getSections

Method getSections

source/Collection/SectionManager.js:52–78  ·  view source on GitHub ↗

Get all Sections overlapping the specified region.

({height, width, x, y}: SizeAndPositionInfo)

Source from the content-addressed store, hash-verified

50
51 /** Get all Sections overlapping the specified region. */
52 getSections({height, width, x, y}: SizeAndPositionInfo): Array<Section> {
53 const sectionXStart = Math.floor(x / this._sectionSize);
54 const sectionXStop = Math.floor((x + width - 1) / this._sectionSize);
55 const sectionYStart = Math.floor(y / this._sectionSize);
56 const sectionYStop = Math.floor((y + height - 1) / this._sectionSize);
57
58 const sections = [];
59
60 for (let sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) {
61 for (let sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) {
62 const key = `${sectionX}.${sectionY}`;
63
64 if (!this._sections[key]) {
65 this._sections[key] = new Section({
66 height: this._sectionSize,
67 width: this._sectionSize,
68 x: sectionX * this._sectionSize,
69 y: sectionY * this._sectionSize,
70 });
71 }
72
73 sections.push(this._sections[key]);
74 }
75 }
76
77 return sections;
78 }
79
80 /** Total number of Sections based on the currently registered cells. */
81 getTotalSectionCount() {

Callers 3

getCellIndicesMethod · 0.95
registerCellMethod · 0.95
verifySectionsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected