From 9c643f22935a05701e046dcc8b28f3aa61797f87 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Sat, 1 Jun 2024 13:47:48 -0500 Subject: [PATCH] apply same technique for filters --- js/menu/filter/filter.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/menu/filter/filter.js b/js/menu/filter/filter.js index a7bb6007..0253ca57 100644 --- a/js/menu/filter/filter.js +++ b/js/menu/filter/filter.js @@ -44,7 +44,7 @@ let bits = { render: () => bits.checkBoxes.forEach((checkbox) => checkbox.render(filters)), }; -apply.addEventListener("click", () => { +function applyFilter(particlesHandler) { const rangeFunctions = Range.buildFilter(parametersRange); const checkboxFunctions = Checkbox.buildFilter(bits.checkBoxes); @@ -67,9 +67,9 @@ apply.addEventListener("click", () => { childrenLinks: newChildrenLinks, infoBoxes: filteredParticles, }); -}); +} -reset.addEventListener("click", () => { +function removeFilter(particlesHandler) { drawAll(ctx, particlesHandler); filters.innerHTML = ""; @@ -84,6 +84,9 @@ reset.addEventListener("click", () => { checkbox.checked = false; checkbox.render(filters); }); -}); +} + +apply.addEventListener("click", () => applyFilter(particlesHandler)); +reset.addEventListener("click", () => removeFilter(particlesHandler)); export { bits };