@@ -460,7 +460,9 @@ import { SearchIndex } from "../scripts/Search.js";
460460import { mapState , mapStores } from ' pinia' ;
461461import { useMainStore } from " @/store/index" ;
462462import { getNerveMaps } from " ../scripts/MappedNerves.js" ;
463+ import { getOrganMaps } from ' ../scripts/MappedOrgans.js' ;
463464const nervesMap = getNerveMaps ();
465+ const organsMap = getOrganMaps ();
464466let totalNerves = 0 , foundNerves = 0 ;
465467
466468const haveSameElements = (arr1 , arr2 ) => {
@@ -1063,7 +1065,7 @@ export default {
10631065 },
10641066 */
10651067 /**
1066- *
1068+ *
10671069 * @param nerves array of nerve names, show all nerves if empty
10681070 * @param processed boolean, whether unselect all checkboxes
10691071 */
@@ -1119,6 +1121,10 @@ export default {
11191121 if (this .timeVarying === false && zincObject .isTimeVarying ()) {
11201122 this .timeVarying = true ;
11211123 }
1124+ const groupName = zincObject .groupName .toLowerCase ();
1125+ if (groupName in organsMap) {
1126+ zincObject .setAnatomicalId (organsMap[groupName]);
1127+ }
11221128 // Temporary way to mark an object as nerves
11231129 const regions = this .isNerves ? .regions ;
11241130 if (regions) {
@@ -1128,17 +1134,14 @@ export default {
11281134 zincObject .userData .isNerves = true ;
11291135 zincObject .userData .defaultColour = ` #${ zincObject .getColourHex ()} ` ;
11301136 zincObject .userData .isGreyScale = false ;
1131- const groupName = zincObject .groupName .toLowerCase ();
11321137 if (groupName in nervesMap) {
11331138 foundNerves++ ;
11341139 zincObject .setAnatomicalId (nervesMap[groupName]);
1135- // console.log(groupName, zincObject.anatomicalId, zincObject.uuid)
11361140 }
11371141 } else {
11381142 zincObject .userData .isNerves = false ;
11391143 }
11401144 }
1141-
11421145 }
11431146 /**
11441147 * Emit when a new object is added to the scene
@@ -1746,6 +1749,7 @@ export default {
17461749 this .$refs .scaffoldTreeControls .removeActive (false );
17471750 }
17481751 }
1752+
17491753 // Store the following for state saving. Search will handle the case with more than 1
17501754 // identifiers.
17511755 if (event .identifiers .length === 1 ) {
@@ -2195,7 +2199,7 @@ export default {
21952199 * Optional, can be used to update the view mode.
21962200 */
21972201 changeViewingMode : function (modeName ) {
2198- let nonNervesIsPickable = true ;
2202+ let objectIsPickable = true ;
21992203 if (this .$module ) {
22002204 if (modeName) {
22012205 this .viewingMode = modeName;
@@ -2220,7 +2224,8 @@ export default {
22202224 this .activeDrawMode = undefined ;
22212225 this .createData .shape = " " ;
22222226 } else if (this .viewingMode === " Neuron Connection" ) {
2223- nonNervesIsPickable = false ;
2227+ // enable to make organs and nerves clickable and searchable for neuron connection mode
2228+ objectIsPickable = false ;
22242229 }
22252230 if ((this .viewingMode === " Exploration" ) ||
22262231 (this .viewingMode === " Neuron Connection" ) ||
@@ -2232,7 +2237,7 @@ export default {
22322237 }
22332238 this .cancelCreate ();
22342239 if (modeName) {
2235- this .setNonNervesIsPickable (nonNervesIsPickable );
2240+ this .setObjectIsPickable (objectIsPickable );
22362241 }
22372242 }
22382243 },
@@ -2259,13 +2264,15 @@ export default {
22592264 this .tData .region = undefined ;
22602265 },
22612266 /**
2262- * Currently will only apply to non-nerve object
2267+ * Currently will apply to non-nerve object and object without anatomical id
22632268 * @param flag boolean to control whether objects pickable
22642269 */
2265- setNonNervesIsPickable : function (flag ) {
2270+ setObjectIsPickable : function (flag ) {
22662271 const objects = this .$module .scene .getRootRegion ().getAllObjects (true );
22672272 objects .forEach ((zincObject ) => {
2268- if (! zincObject .userData .isNerves ) zincObject .setIsPickable (flag);
2273+ if (! zincObject .userData ? .isNerves && ! zincObject .anatomicalId ) {
2274+ zincObject .setIsPickable (flag);
2275+ }
22692276 });
22702277 },
22712278 /**
@@ -2299,7 +2306,7 @@ export default {
22992306 */
23002307 setColour: function (flag , forced = false ) {
23012308 if (this .isReady && this .$module .scene &&
2302- typeof flag === " boolean" &&
2309+ typeof flag === " boolean" &&
23032310 (forced || flag !== this .colourRadio )) {
23042311 this .loading = true ;
23052312 // This can take sometime to finish , nextTick does not bring out
@@ -2310,7 +2317,7 @@ export default {
23102317 this .colourRadio = flag;
23112318 }, 100 );
23122319 }
2313- },
2320+ },
23142321 /**
23152322 * @public
23162323 * Function to toggle lines graphics.
@@ -2319,7 +2326,7 @@ export default {
23192326 */
23202327 setOutlines : function (flag , forced = false ) {
23212328 if (this .isReady && this .$module .scene &&
2322- typeof flag === " boolean" &&
2329+ typeof flag === " boolean" &&
23232330 (forced || flag !== this .outlinesRadio )) {
23242331 this .outlinesRadio = flag;
23252332 this .$nextTick (() => this .$refs .scaffoldTreeControls .setOutlines (flag));
@@ -2495,7 +2502,7 @@ export default {
24952502 if (options .offlineAnnotations ) {
24962503 sessionStorage .setItem (' anonymous-annotation' , options .offlineAnnotations );
24972504 }
2498- if (" outlines" in options) {
2505+ if (" outlines" in options) {
24992506 this .setOutlines (options .outlines );
25002507 }
25012508 if (options .viewingMode ) {
0 commit comments