mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-01 23:21:59 +01:00
fix another performance issue -- when lines is hidden vismap was set to all true
This commit is contained in:
parent
31d79b8829
commit
874632939d
20
src/main.tsx
20
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<string, boolean>();
|
||||
@ -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<lines.length; i++) {
|
||||
let linenum = String(lines[i].linenum);
|
||||
if (visMap.get(linenum).get()) {
|
||||
visLines.push(linenum);
|
||||
}
|
||||
}
|
||||
console.log("vislines", visLines);
|
||||
}
|
||||
|
||||
restoreAnchorOffset(reason : string) : void {
|
||||
let {screen} = this.props;
|
||||
let linesElem = this.linesRef.current;
|
||||
|
Loading…
Reference in New Issue
Block a user