mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
More frontend bugfixing
This commit is contained in:
@@ -205,11 +205,13 @@ function setupEvents() {
|
||||
|
||||
document.querySelectorAll("[inject-svg]").forEach((el: Element) => {
|
||||
var img = el as HTMLImageElement;
|
||||
var isLoaded = img.complete && img.naturalHeight !== 0;
|
||||
var isLoaded = img.complete;
|
||||
if (isLoaded)
|
||||
SVGInjector(img);
|
||||
else
|
||||
img.onload = () => SVGInjector(img);
|
||||
img.addEventListener("load", () => {
|
||||
SVGInjector(img);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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`;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,8 @@ export class UnitsManager {
|
||||
document.addEventListener('importFromFile', () => this.importFromFile());
|
||||
document.addEventListener('contactsUpdated', (e: CustomEvent) => {this.#requestDetectionUpdate = true});
|
||||
document.addEventListener('commandModeOptionsChanged', () => {Object.values(this.#units).forEach((unit: Unit) => unit.updateVisibility())});
|
||||
document.addEventListener('selectedUnitsChangeSpeed', (e: any) => {this.selectedUnitsChangeSpeed(e.detail.type)});
|
||||
document.addEventListener('selectedUnitsChangeAltitude', (e: any) => {this.selectedUnitsChangeAltitude(e.detail.type)});
|
||||
}
|
||||
|
||||
getSelectableAircraft() {
|
||||
|
||||
Reference in New Issue
Block a user