MCPcopy Index your code
hub / github.com/g3n/engine / calcMaxFirst

Method calcMaxFirst

gui/table.go:1506–1526  ·  view source on GitHub ↗

calcMaxFirst calculates the maximum index of the first visible row such as the remaining rows fits completely inside the table It is used when scrolling the table vertically

()

Source from the content-addressed store, hash-verified

1504// such as the remaining rows fits completely inside the table
1505// It is used when scrolling the table vertically
1506func (t *Table) calcMaxFirst() int {
1507
1508 _, total := t.rowsHeight()
1509 ri := len(t.rows) - 1
1510 if ri < 0 {
1511 return 0
1512 }
1513 height := float32(0)
1514 for {
1515 trow := t.rows[ri]
1516 height += trow.height
1517 if height > total {
1518 break
1519 }
1520 ri--
1521 if ri < 0 {
1522 break
1523 }
1524 }
1525 return ri + 1
1526}
1527
1528// updateRowStyle applies the correct style for the specified row
1529func (t *Table) updateRowStyle(ri int) {

Callers 5

RemoveRowMethod · 0.95
scrollDownMethod · 0.95
lastPageMethod · 0.95
setVScrollBarMethod · 0.95
onVScrollBarMethod · 0.95

Calls 1

rowsHeightMethod · 0.95

Tested by

no test coverage detected