diff --git a/src/main.tsx b/src/main.tsx index 35f398ad..c1d397bb 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1711,10 +1711,16 @@ class LinesView extends React.Component<{screen : Screen, width : number, lines if (linesElem == null) { return; } + if (linesElem.offsetParent == null) { + return; // handles when parent is set to display:none (is-hidden) + } let lineElemArr = linesElem.querySelectorAll(".line"); if (lineElemArr == null) { return; } + if (linesElem.clientHeight == 0) { + return; // when linesElem is collapsed (or display:none) + } let containerTop = linesElem.scrollTop - LinesVisiblePadding; let containerBot = linesElem.scrollTop + linesElem.clientHeight + LinesVisiblePadding; let newMap = new Map(); @@ -1730,6 +1736,7 @@ class LinesView extends React.Component<{screen : Screen, width : number, lines if (lineBot >= containerTop && lineBot <= containerBot) { isVis = true } + // console.log("line", lineElem.dataset.linenum, "top=" + lineTop, "bot=" + lineTop, isVis); newMap.set(lineElem.dataset.linenum, isVis); // console.log("setvis", sprintf("%4d %4d-%4d (%4d) %s", lineElem.dataset.linenum, lineTop, lineBot, lineElem.offsetHeight, isVis)); } @@ -1752,6 +1759,19 @@ class LinesView extends React.Component<{screen : Screen, width : number, lines })(); } + printVisMap() : void { + let visMap = this.visibleMap; + let lines = this.props.lines; + let visLines : string[] = []; + for (let i=0; i