From a1fdd144bc3a23bb2e08b991da0e5a472fe65712 Mon Sep 17 00:00:00 2001 From: Kari Lavikka Date: Fri, 3 Jan 2025 16:17:04 +0200 Subject: [PATCH] feat: accept custom properties as parameters in `setupGui` --- src/gui/gui.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.ts b/src/gui/gui.ts index 57f982b..0f88bf0 100644 --- a/src/gui/gui.ts +++ b/src/gui/gui.ts @@ -20,12 +20,21 @@ const DEFAULT_GENERAL_PROPERTIES = { zoom: 1, } as GeneralProperties; -export function setupGui(container: HTMLElement, tables: DataTables) { +export function setupGui( + container: HTMLElement, + tables: DataTables, + customLayoutProps: Partial = {}, + customCostWeights: Partial = {} +) { container.innerHTML = HTML_TEMPLATE; const jellyfishGui = container.querySelector(".jellyfish-gui") as HTMLElement; const { generalProps, layoutProps, costWeights } = getSavedOrDefaultSettings(); + + Object.assign(layoutProps, customLayoutProps); + Object.assign(costWeights, customCostWeights); + const saveSettings = () => saveSettingsToSessionStorage(generalProps, layoutProps, costWeights);