-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
665 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#filter { | ||
width: 16%; | ||
position: fixed; | ||
flex-direction: column; | ||
background-color: #f5f5f5; | ||
border-radius: 5px; | ||
padding: 10px; | ||
top: 10px; | ||
right: 10px; | ||
z-index: 1; | ||
} | ||
|
||
#filter-header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
#filter-button { | ||
cursor: pointer; | ||
} | ||
|
||
#close-filter { | ||
display: none; | ||
} | ||
|
||
#filter-content { | ||
display: none; | ||
flex-direction: column; | ||
margin-top: 10px; | ||
} | ||
|
||
#filters { | ||
display: flex; | ||
flex-direction: column; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ body { | |
margin: 0; | ||
padding: 0; | ||
/* overflow: hidden; */ | ||
font-family: sans-serif; | ||
} | ||
|
||
.manipulation-tool { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export function drawAll(ctx, parentLinks, childrenLinks, infoBoxes) { | ||
ctx.clearRect(0, 0, canvas.width, canvas.height); | ||
// console.time("drawParentLinks"); | ||
for (const link of parentLinks) { | ||
link.draw(ctx, infoBoxes); | ||
} | ||
// console.timeEnd("drawParentLinks"); | ||
// console.time("drawChildrenLinks"); | ||
for (const link of childrenLinks) { | ||
link.draw(ctx, infoBoxes); | ||
} | ||
// console.timeEnd("drawChildrenLinks"); | ||
// console.time("drawBoxes"); | ||
for (const infoBox of infoBoxes) { | ||
if (infoBox !== null) infoBox.draw(ctx); | ||
} | ||
// console.timeEnd("drawBoxes"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Link } from "../../objects.js"; | ||
import { drawAll } from "../../draw.js"; | ||
import { parentLinks, childrenLinks, infoBoxes, ctx } from "../../main.js"; | ||
import { Range, Checkbox, buildCriteriaFunction } from "./parameters.js"; | ||
import { reconnect } from "./reconnect.js"; | ||
|
||
const filterButton = document.getElementById("filter-button"); | ||
const openFilter = document.getElementById("open-filter"); | ||
const closeFilter = document.getElementById("close-filter"); | ||
const filterContent = document.getElementById("filter-content"); | ||
|
||
let active = false; | ||
|
||
filterButton.addEventListener("click", () => { | ||
active = !active; | ||
|
||
if (active) { | ||
openFilter.style.display = "none"; | ||
closeFilter.style.display = "block"; | ||
filterContent.style.display = "flex"; | ||
} else { | ||
openFilter.style.display = "block"; | ||
closeFilter.style.display = "none"; | ||
filterContent.style.display = "none"; | ||
} | ||
}); | ||
|
||
const filters = document.getElementById("filters"); | ||
const apply = document.getElementById("filter-apply"); | ||
const reset = document.getElementById("filter-reset"); | ||
|
||
let parametersRange = ["momentum", "vertex", "time", "mass", "charge"]; | ||
|
||
parametersRange = parametersRange.map((parameter) => new Range(parameter)); | ||
|
||
parametersRange.forEach((parameter) => parameter.render(filters)); | ||
|
||
let bitsCheckbox = [23, 24, 25, 26, 27, 28, 29, 30]; | ||
|
||
bitsCheckbox = bitsCheckbox.map((bit) => new Checkbox("simStatus", bit)); | ||
|
||
bitsCheckbox.forEach((checkbox) => checkbox.render(filters)); | ||
|
||
apply.addEventListener("click", () => { | ||
const rangeFunctions = Range.buildFilter(parametersRange); | ||
const checkboxFunctions = Checkbox.buildFilter(bitsCheckbox); | ||
|
||
const criteriaFunction = buildCriteriaFunction( | ||
rangeFunctions, | ||
checkboxFunctions | ||
); | ||
|
||
const [newParentLinks, newChildrenLinks, filteredParticles] = reconnect( | ||
criteriaFunction, | ||
parentLinks, | ||
childrenLinks, | ||
infoBoxes | ||
); | ||
|
||
drawAll(ctx, newParentLinks, newChildrenLinks, filteredParticles); | ||
}); | ||
|
||
reset.addEventListener("click", () => { | ||
drawAll(ctx, parentLinks, childrenLinks, infoBoxes); | ||
|
||
filters.innerHTML = ""; | ||
|
||
parametersRange.forEach((parameter) => { | ||
parameter.min = undefined; | ||
parameter.max = undefined; | ||
parameter.render(filters); | ||
}); | ||
|
||
bitsCheckbox.forEach((checkbox) => { | ||
checkbox.checked = false; | ||
checkbox.render(filters); | ||
}); | ||
}); |
Oops, something went wrong.