Skip to content

Commit

Permalink
add units to range parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Jun 3, 2024
1 parent 67bfb6d commit 5c6833a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
27 changes: 26 additions & 1 deletion js/menu/filter/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,32 @@ const filters = document.getElementById("filters");
const apply = document.getElementById("filter-apply");
const reset = document.getElementById("filter-reset");

let parametersRange = ["momentum", "vertex", "time", "mass", "charge"];
let parametersRange = [
{
property: "momentum",
unit: "GeV",
},
{
property: "mass",
unit: "GeV",
},
{
property: "charge",
unit: "e",
},
{
property: "vertex",
unit: "mm",
},
{
property: "time",
unit: "ns",
},
];

parametersRange = parametersRange.sort((a, b) =>
a.property.localeCompare(b.property)
);

parametersRange = parametersRange.map((parameter) => new Range(parameter));

Expand Down
5 changes: 3 additions & 2 deletions js/menu/filter/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ export class Range extends FilterParameter {
min;
max;

constructor(property) {
constructor({ property, unit }) {
super(property);
this.unit = unit;
}

render(container) {
const title = document.createElement("div");
const label = document.createElement("label");
label.textContent = this.property;
label.textContent = `${this.property} (${this.unit})`;
title.appendChild(label);

const content = document.createElement("div");
Expand Down

0 comments on commit 5c6833a

Please sign in to comment.