diff --git a/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.idx b/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.idx similarity index 98% rename from pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.idx rename to pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.idx index f0ad81a0..a115939c 100644 Binary files a/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.idx and b/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.idx differ diff --git a/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.pack b/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.pack similarity index 99% rename from pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.pack rename to pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.pack index d3aa6714..32e760c1 100644 Binary files a/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.pack and b/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.pack differ diff --git a/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.rev b/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.rev similarity index 91% rename from pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.rev rename to pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.rev index e75cea26..e8974c33 100644 Binary files a/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.rev and b/pr-preview/pr-76/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.rev differ diff --git a/pr-preview/pr-76/js/filters/collections/mcparticle.js b/pr-preview/pr-76/js/filters/collections/mcparticle.js index 98d867dd..5bdeac21 100644 --- a/pr-preview/pr-76/js/filters/collections/mcparticle.js +++ b/pr-preview/pr-76/js/filters/collections/mcparticle.js @@ -1,6 +1,5 @@ import { CheckboxComponent, - checkboxLogic, bitfieldCheckboxLogic, objectSatisfiesCheckbox, } from "../components/checkbox.js"; @@ -46,14 +45,18 @@ function renderMCParticleFilters(viewObjects) { simStatusContainer.appendChild(simStatusTitle); const simStatusCheckboxesContainer = createCheckboxContainer(); - Object.keys(SimStatusBitFieldDisplayValues).forEach((status) => { - const checkbox = new CheckboxComponent( - "simulatorStatus", - status, - SimStatusBitFieldDisplayValues[status] - ); + Object.entries(SimStatusBitFieldDisplayValues).forEach(([status, value]) => { + const checkbox = new CheckboxComponent("simulatorStatus", status, value); checkboxes.simStatus.push(checkbox); simStatusCheckboxesContainer.appendChild(checkbox.render()); + + viewObjects.datatypes["edm4hep::MCParticle"].collection.forEach( + (mcparticle) => { + if (bitfieldCheckboxLogic(value, mcparticle, "simulatorStatus")) { + checkbox.checked(true); + } + } + ); }); simStatusContainer.appendChild(simStatusCheckboxesContainer); @@ -76,6 +79,7 @@ function renderMCParticleFilters(viewObjects) { ); checkboxes.generatorStatus.push(checkbox); genStatusCheckboxesContainer.appendChild(checkbox.render()); + checkbox.checked(true); }); generatorStatusContainer.appendChild(genStatusCheckboxesContainer); diff --git a/pr-preview/pr-76/js/filters/components/checkbox.js b/pr-preview/pr-76/js/filters/components/checkbox.js index 8c6fee2d..fdb72b6a 100644 --- a/pr-preview/pr-76/js/filters/components/checkbox.js +++ b/pr-preview/pr-76/js/filters/components/checkbox.js @@ -8,6 +8,8 @@ const createCheckbox = () => { const checkbox = document.createElement("input"); checkbox.type = "checkbox"; checkbox.classList.add("filter-checkbox"); + checkbox.classList.add("filter-input-checkbox"); + return checkbox; }; diff --git a/pr-preview/pr-76/js/filters/components/common.js b/pr-preview/pr-76/js/filters/components/common.js index 7c565730..5b101e20 100644 --- a/pr-preview/pr-76/js/filters/components/common.js +++ b/pr-preview/pr-76/js/filters/components/common.js @@ -38,15 +38,22 @@ export function buildCollectionCheckboxes(collection) { ); checkboxes.push(checkbox); checkboxesContainer.appendChild(checkbox.render()); + checkbox.checked(true); }); container.appendChild(checkboxesContainer); selectAll.addEventListener("click", () => { - checkboxes.forEach((checkbox) => checkbox.checked(true)); + checkboxes.forEach((checkbox) => { + checkbox.checked(true); + checkbox.checkbox.dispatchEvent(new Event("change")); + }); }); clearAll.addEventListener("click", () => { - checkboxes.forEach((checkbox) => checkbox.checked(false)); + checkboxes.forEach((checkbox) => { + checkbox.checked(false); + checkbox.checkbox.dispatchEvent(new Event("change")); + }); }); return [container, checkboxes]; diff --git a/pr-preview/pr-76/js/filters/components/range.js b/pr-preview/pr-76/js/filters/components/range.js index 5fdd5e52..fe18aa09 100644 --- a/pr-preview/pr-76/js/filters/components/range.js +++ b/pr-preview/pr-76/js/filters/components/range.js @@ -3,6 +3,7 @@ const createInput = (placeholder) => { input.type = "number"; input.placeholder = placeholder; input.classList.add("range-input"); + input.classList.add("filter-input-range"); return input; }; diff --git a/pr-preview/pr-76/js/filters/filter.js b/pr-preview/pr-76/js/filters/filter.js index be963560..fa86fe75 100644 --- a/pr-preview/pr-76/js/filters/filter.js +++ b/pr-preview/pr-76/js/filters/filter.js @@ -47,6 +47,8 @@ export function initFilters( ) { const criteriaFunctions = {}; + let someInputChanged = false; + const resetFiltersContent = () => { const content = document.getElementById("filters-content"); content.replaceChildren(); @@ -69,11 +71,32 @@ export function initFilters( const filterOutCheckbox = document.getElementById("invert-filter"); filterOutCheckbox.checked = false; + + const allCheckboxes = document.getElementsByClassName( + "filter-input-checkbox" + ); + + for (const input of allCheckboxes) { + input.addEventListener("change", () => { + someInputChanged = true; + }); + } + + const allInputs = document.getElementsByClassName("filter-input-range"); + + for (const input of allInputs) { + input.addEventListener("input", () => { + someInputChanged = true; + }); + } }; resetFiltersContent(); filters.apply = async () => { + if (!someInputChanged) { + return; + } const filterOutValue = document.getElementById("invert-filter").checked; const ids = filterOut( viewObjects,