Fix fit using correct dims on demo
This doesn't add the debounce suggested in the issue, but it does comment about it. Fixes #4114
This commit is contained in:
@@ -340,11 +340,17 @@ function createTerminal(): Terminal {
|
|||||||
|
|
||||||
const resizeObserver = new ResizeObserver(entries => {
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
if (optionsWindow.autoResize) {
|
if (optionsWindow.autoResize) {
|
||||||
|
// In general this should be debounced to avoid excessive work on the main
|
||||||
|
// thread by firing the expensive resize action repeatedly
|
||||||
addons.fit.instance.fit();
|
addons.fit.instance.fit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
resizeObserver.observe(terminalContainer);
|
resizeObserver.observe(terminalContainer);
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
terminalContainer.style.width = document.body.clientWidth + 'px';
|
||||||
|
});
|
||||||
|
|
||||||
// fit is called within a setTimeout, cols and rows need this.
|
// fit is called within a setTimeout, cols and rows need this.
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
optionsWindow.initOptions(addDomListener);
|
optionsWindow.initOptions(addDomListener);
|
||||||
|
|||||||
+1
-5
@@ -7,6 +7,7 @@ body {
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 24px 1fr;
|
grid-template-rows: 24px 1fr;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#banner {
|
#banner {
|
||||||
@@ -41,11 +42,6 @@ body {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#terminal-container {
|
|
||||||
height: 60%;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
font-style: italic
|
font-style: italic
|
||||||
|
|||||||
Reference in New Issue
Block a user