fix button state warning

This commit is contained in:
E44
2025-11-09 18:58:14 +01:00
parent a9a28eb1fb
commit 3b47f463d1
@@ -26,13 +26,13 @@
click_function?: (e: MouseEvent) => void; click_function?: (e: MouseEvent) => void;
menu_options?: MenuOption[] | null; menu_options?: MenuOption[] | null;
menu_class?: string; menu_class?: string;
div_class?: string, div_class?: string;
children?: any; children?: any;
}>(); }>();
let menu_shown = $state(false); let menu_shown = $state(false);
let button_element: HTMLButtonElement; let button_element: HTMLButtonElement;
let menu_element: HTMLDivElement; let menu_element: HTMLDivElement | null = $state(null);
let position_bottom = $state(true); let position_bottom = $state(true);
function onclick(e: MouseEvent) { function onclick(e: MouseEvent) {
@@ -47,7 +47,7 @@
} }
function getPolygon(): [number, number][] | null { function getPolygon(): [number, number][] | null {
if (!button_element || !button_element) return null; if (!button_element || !menu_element) return null;
const b = button_element.getBoundingClientRect(); const b = button_element.getBoundingClientRect();
const m = menu_element.getBoundingClientRect(); const m = menu_element.getBoundingClientRect();