Skip to content

Commit 93912ba

Browse files
committed
added missing util js scripts
1 parent 16afcdf commit 93912ba

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export function updateLabelClasses(dataId, label) {
2+
const labelMappings = {
3+
unsure: { remove: "unsure", add: "correct", newLabel: "correct" },
4+
incorrect: { remove: "incorrect", add: "unsure", newLabel: "unsure" },
5+
correct: { remove: "correct", add: "incorrect", newLabel: "incorrect" },
6+
};
7+
8+
if (labelMappings[label]) {
9+
const { remove, add, newLabel } = labelMappings[label];
10+
$(`#id${dataId}`).removeClass(remove).addClass(add);
11+
$(`#id-a-${dataId}`).attr("label", newLabel);
12+
}
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export function updateSynapseColors() {
2+
if ($("script[src*='viewer.js']").attr("data-neuron-ready") === "true") {
3+
$(".image-card-btn").each(function () {
4+
updateSynapseColor($(this).attr("data_id"), $(this).attr("label"));
5+
});
6+
sessionStorage.setItem("synapseColors", JSON.stringify(window.synapseColors));
7+
}
8+
}
9+
10+
11+
export function updateSynapseColor(dataId, label) {
12+
const labelColors = {
13+
correct: { color: 0x00ff00, name: "green" },
14+
unsure: { color: 0xffff00, name: "yellow" },
15+
incorrect: { color: 0xff0000, name: "red" },
16+
};
17+
18+
if (labelColors[label]) {
19+
const { color, name } = labelColors[label];
20+
window.updateSynapse(dataId, null, new THREE.Color(color), null, true);
21+
window.synapseColors[dataId] = name;
22+
}
23+
}

0 commit comments

Comments
 (0)