Skip to content

Commit

Permalink
auto-check for valid checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Aug 13, 2024
1 parent 53c9f82 commit 6953f08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions js/filters/collections/mcparticle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
CheckboxComponent,
checkboxLogic,
bitfieldCheckboxLogic,
objectSatisfiesCheckbox,
} from "../components/checkbox.js";
Expand Down Expand Up @@ -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);

Expand All @@ -76,6 +79,7 @@ function renderMCParticleFilters(viewObjects) {
);
checkboxes.generatorStatus.push(checkbox);
genStatusCheckboxesContainer.appendChild(checkbox.render());
checkbox.checked(true);
});
generatorStatusContainer.appendChild(genStatusCheckboxesContainer);

Expand Down
1 change: 1 addition & 0 deletions js/filters/components/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function buildCollectionCheckboxes(collection) {
);
checkboxes.push(checkbox);
checkboxesContainer.appendChild(checkbox.render());
checkbox.checked(true);
});
container.appendChild(checkboxesContainer);

Expand Down

0 comments on commit 6953f08

Please sign in to comment.