Skip to content

Commit

Permalink
apply same technique for filters
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Jun 1, 2024
1 parent 4f6fd31 commit 9c643f2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions js/menu/filter/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -67,9 +67,9 @@ apply.addEventListener("click", () => {
childrenLinks: newChildrenLinks,
infoBoxes: filteredParticles,
});
});
}

reset.addEventListener("click", () => {
function removeFilter(particlesHandler) {
drawAll(ctx, particlesHandler);

filters.innerHTML = "";
Expand All @@ -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 };

0 comments on commit 9c643f2

Please sign in to comment.