Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Commit ed5219f

Browse files
committed
calculate and output currently visible blocks
1 parent ac7998a commit ed5219f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/traces/table/plot.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ function rowFromTo(d) {
384384
return [rowFrom, rowTo];
385385
}
386386

387+
function overlap(a, b) {
388+
return a[0] < b[1] && a[1] > b[0];
389+
}
390+
387391
function makeDragRow(cellsColumnBlock) {
388392
return function dragRow (d) {
389393
var calcdata = d.calcdata;
@@ -400,6 +404,15 @@ function makeDragRow(cellsColumnBlock) {
400404
var bottom = firstRowAnchor(blocks, blocks.length);
401405
var scrollY = calcdata.scrollY = Math.max(0, Math.min(bottom - scrollHeight, calcdata.scrollY));
402406
var dAnchor = firstRowAnchor(blocks, d.page);
407+
var pages = [];
408+
for(var p = 0; p < blocks.length; p++) {
409+
var pTop = firstRowAnchor(blocks, p);
410+
var pBottom = pTop + rowsHeight(blocks[p], Infinity);
411+
if(overlap([scrollY, scrollY + scrollHeight], [pTop, pBottom])) {
412+
pages.push(p);
413+
}
414+
}
415+
console.log('pages:', pages);
403416
if(d.page < 0 || direction === 'down' && scrollY - dAnchor > rowsHeight(currentBlock, Infinity)) {
404417
if(d.page + 2 < blocks.length) {
405418
d.page += 2;

0 commit comments

Comments
 (0)