More frontend bugfixing

This commit is contained in:
Pax1601
2023-08-04 11:05:21 +02:00
parent 66f08e8fce
commit 2f839624a8
13 changed files with 263 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
import { getMouseInfoPanel } from "..";
import { Panel } from "./panel";
export class LogPanel extends Panel {
@@ -23,8 +24,21 @@ export class LogPanel extends Panel {
if (scrollEl) {
scrollEl.addEventListener("scroll", () => {
this.#scrolledDown = Math.abs(scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight) < 1
})
});
}
window.addEventListener("resize", () => {
this.#calculateHeight();
});
const mouseInfoPanel = getMouseInfoPanel();
new ResizeObserver(() => this.#calculateHeight()).observe(mouseInfoPanel.getElement())
}
show() {
super.show();
this.#calculateHeight();
}
appendLogs(logs: {[key: string]: string}) {
@@ -68,4 +82,9 @@ export class LogPanel extends Panel {
scrollEl.scrollTop = scrollEl.scrollHeight - scrollEl.clientHeight;
}
}
#calculateHeight() {
const mouseInfoPanel = getMouseInfoPanel();
this.getElement().style.height = `${mouseInfoPanel.getElement().offsetTop - this.getElement().offsetTop - 10}px`;
}
}