MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / getElementIndexAt

Method getElementIndexAt

src/main/java/ui/VirtualList.java:334–352  ·  view source on GitHub ↗
(int yPos)

Source from the content-addressed store, hash-verified

332 }
333
334 protected int getElementIndexAt(int yPos) {
335 int end = getItemCount() - 1;
336 if (end < 0) {
337 return -1;
338 }
339 int begin = 0;
340 while (end - begin > 1) {
341 int index = (end + begin) >> 1;
342 if (itemLayoutY.length <= index) {
343 index = itemLayoutY.length - 1;
344 }
345 if (yPos < itemLayoutY[index]) {
346 end = index;
347 } else {
348 begin = index;
349 }
350 }
351 return (yPos < itemLayoutY[end]) ? begin : end;
352 }
353
354 public int win_top; // верхняя граница окна относительно списка
355 public int winHeight; // отображаемый размер списка

Callers 4

paintMethod · 0.95
pointerPressedMethod · 0.95
pageLeftMethod · 0.95
pageRightMethod · 0.95

Calls 1

getItemCountMethod · 0.95

Tested by

no test coverage detected