Skip to content

Commit 0194024

Browse files
committed
displaying annotation tags in annotation list
1 parent 02e0a71 commit 0194024

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/ui/annotations.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
padding-right: 5px;
6262
}
6363

64-
.neuroglancer-annotation-description {
64+
.neuroglancer-annotation-description, .neuroglancer-annotation-tags {
6565
grid-column: dim / -1;
6666
text-overflow: ellipsis;
6767
overflow: hidden;

src/ui/annotations.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,26 @@ export class AnnotationLayerView extends Tab {
936936
description.textContent = annotation.description;
937937
element.appendChild(description);
938938
}
939+
const {
940+
properties: { value: properties },
941+
} = state.source;
942+
const activeTags: string[] = [];
943+
for (let i = 0, count = properties.length; i < count; ++i) {
944+
const property = properties[i];
945+
const value = annotation.properties[i];
946+
activeTags;
947+
if (isAnnotationTagPropertySpec(property) && property.tag) {
948+
if (value !== 0) {
949+
activeTags.push(property.tag);
950+
}
951+
}
952+
}
953+
if (activeTags.length) {
954+
const tags = document.createElement("div");
955+
tags.classList.add("neuroglancer-annotation-tags");
956+
tags.textContent = activeTags.map((x) => `#${x}`).join(" ");
957+
element.appendChild(tags);
958+
}
939959
icon.style.gridRow = `span ${numRows}`;
940960
if (deleteButton !== undefined) {
941961
deleteButton.style.gridRow = `span ${numRows}`;

0 commit comments

Comments
 (0)