Skip to content

Commit

Permalink
attemp to display calculated distance in selection panel
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhan committed Dec 5, 2023
1 parent 099c65e commit 021143a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ function observeSegmentSelect(targetNode: Element) {
const updateSelectionDetailsBody = function(item: HTMLElement) {
if (item.classList) {
let selectionList: Element|HTMLElement[] = [];
if (item.classList.contains("neuroglancer-annotation-list-entry")) {
if (item.classList.contains("neuroglancer-selection-details-layer")) { //neuroglancer-annotation-list-entry
selectionList = [item];
}
selectionList.forEach(item => {
const positionGrid = item.querySelector(".neuroglancer-annotation-position")
const isDataBounds = item.querySelector(".neuroglancer-annotation-description")?.textContent === "Data Bounds" ? true : false;
if (positionGrid && !isDataBounds) {
const coordElements = item.querySelectorAll(' .neuroglancer-annotation-coordinate');
// const positionGrid = item.querySelector(".neuroglancer-selected-annotation-details-position")//.neuroglancer-annotation-position
const isDataBounds = false // item.querySelector(".neuroglancer-annotation-details-description")?.textContent === "Data Bounds" ? true : false; //.neuroglancer-annotation-description
if (!isDataBounds) {
const coordElements = item.querySelectorAll('.neuroglancer-selected-annotation-details-position-coord'); //.neuroglancer-annotation-coordinate
console.log(coordElements)
let coordinates: Point3D[] = [];

for (let i = 0; i < coordElements?.length; i += 3){
Expand Down Expand Up @@ -245,7 +246,7 @@ function observeSegmentSelect(targetNode: Element) {

// Convert existing items
targetNode.querySelectorAll('.neuroglancer-segment-list-entry').forEach(updateSegmentSelectItem);
targetNode.querySelectorAll('.neuroglancer-annotation-list-entry').forEach(updateSelectionDetailsBody);
targetNode.querySelectorAll('.neuroglancer-selection-details-layer').forEach(updateSelectionDetailsBody);//neuroglancer-annotation-list-entry
}

function liveNeuroglancerInjection() {
Expand Down

0 comments on commit 021143a

Please sign in to comment.