Skip to content

Commit

Permalink
feat: accept custom properties as parameters in setupGui
Browse files Browse the repository at this point in the history
  • Loading branch information
tuner committed Jan 3, 2025
1 parent 49cfdc9 commit a1fdd14
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/gui/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<LayoutProperties> = {},
customCostWeights: Partial<CostWeights> = {}
) {
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);

Expand Down

0 comments on commit a1fdd14

Please sign in to comment.