Skip to content

Commit

Permalink
Fix population slider only going halfway (#453)
Browse files Browse the repository at this point in the history
This is a bug fix for
#449. I
unintentionally broke things by removing the
`filterManager.subscribe()`, meaning we didn't redraw the sliders every
time the slider values changed.

Also removes a double initialization of viewToggle.
  • Loading branch information
Eric-Arellano committed Aug 18, 2024
1 parent ec66095 commit 8939115
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/js/populationSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,10 @@ export function initPopulationSlider(
updateSlidersUI(filterManager.getState());
}
});

// Also update UI when values change, but only if the filter popup is open.
filterManager.subscribe((state) => {
if (!filterPopupIsVisible.getValue()) return;
updateSlidersUI(state);
});
}
1 change: 0 additions & 1 deletion src/js/viewToggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ export default function initViewToggle(table: Tabulator): ViewStateObservable {
const viewToggle = new Observable<ViewState>("map");
viewToggle.subscribe((state) => updateUI(table, state));
updateOnIconClick(viewToggle);
viewToggle.initialize();
return viewToggle;
}

0 comments on commit 8939115

Please sign in to comment.