Skip to content

Commit

Permalink
displaying annotation tags in annotation list
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Oct 2, 2024
1 parent ca457e5 commit 4e5ba2a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/annotations.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
padding-right: 5px;
}

.neuroglancer-annotation-description {
.neuroglancer-annotation-description, .neuroglancer-annotation-tags {
grid-column: dim / -1;
text-overflow: ellipsis;
overflow: hidden;
Expand Down
20 changes: 20 additions & 0 deletions src/ui/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,26 @@ export function makeAnnotationListElement(
description.textContent = annotation.description;
element.appendChild(description);
}
const {
properties: { value: properties },
} = state.source;
const activeTags: string[] = [];
for (let i = 0, count = properties.length; i < count; ++i) {
const property = properties[i];
const value = annotation.properties[i];
activeTags;
if (isAnnotationTagPropertySpec(property) && property.tag) {
if (value !== 0) {
activeTags.push(property.tag);
}
}
}
if (activeTags.length) {
const tags = document.createElement("div");
tags.classList.add("neuroglancer-annotation-tags");
tags.textContent = activeTags.map((x) => `#${x}`).join(" ");
element.appendChild(tags);
}
icon.style.gridRow = `span ${numRows}`;
if (deleteButton !== undefined) {
deleteButton.style.gridRow = `span ${numRows}`;
Expand Down

0 comments on commit 4e5ba2a

Please sign in to comment.