mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
allow resize observer to fire conditional scroll to bottom (info panel updates)
This commit is contained in:
parent
d5a5a9ce70
commit
291d1dc704
15
src/main.tsx
15
src/main.tsx
@ -405,6 +405,7 @@ class ScreenWindowView extends React.Component<{sw : ScreenWindow}, {}> {
|
||||
rszObs : any
|
||||
randomId : string;
|
||||
width : mobx.IObservableValue<number> = mobx.observable.box(0);
|
||||
lastHeight : number = null;
|
||||
|
||||
scrollToBottom(reason : string) {
|
||||
let elem = document.getElementById(this.getLinesDOMId());
|
||||
@ -467,12 +468,24 @@ class ScreenWindowView extends React.Component<{sw : ScreenWindow}, {}> {
|
||||
let entry = entries[0];
|
||||
let width = entry.target.offsetWidth;
|
||||
this.updateWidth(width);
|
||||
if (this.lastHeight == null) {
|
||||
this.lastHeight = entry.target.offsetHeight;
|
||||
return;
|
||||
}
|
||||
if (this.lastHeight != entry.target.offsetHeight) {
|
||||
this.lastHeight = entry.target.offsetHeight;
|
||||
this.doConditionalScrollToBottom("resize-height");
|
||||
}
|
||||
}
|
||||
|
||||
handleDomMutation(mutations, mutObs) {
|
||||
this.doConditionalScrollToBottom("mut");
|
||||
}
|
||||
|
||||
doConditionalScrollToBottom(reason : string) {
|
||||
let {sw} = this.props;
|
||||
if (sw && sw.shouldFollow.get()) {
|
||||
setTimeout(() => this.scrollToBottom("mut"), 0);
|
||||
setTimeout(() => this.scrollToBottom(reason), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user