File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,26 @@ const generateNeighborLines = (
9090 } ;
9191} ;
9292const generateDirectLines = ( nodes : Protobuf . Mesh . NodeInfo [ ] ) => {
93- const features = [ ] ;
93+ const selfNode = nodes . find ( ( n ) => n . isFavorite ) ;
94+ const features : {
95+ type : string ;
96+ geometry : {
97+ type : string ;
98+ coordinates : number [ ] [ ] ;
99+ } ;
100+ properties : {
101+ color : string ;
102+ } ;
103+ } [ ] = [ ] ;
104+
105+ if ( ! selfNode || ! selfNode . position )
106+ return { type : "FeatureCollection" , features } ;
107+
94108 for ( const node of nodes ) {
95109 if ( ! node . position ) continue ;
96110 if ( node . hopsAway > 0 ) continue ;
97111 if ( Date . now ( ) / 1000 - node . lastHeard > DIRECT_NODE_TIMEOUT ) continue ;
98112 const start = convertToLatLng ( node . position ) ;
99- const selfNode = nodes . find ( ( n ) => n . isFavorite ) ;
100113 const end = convertToLatLng ( selfNode . position ) ;
101114 features . push ( {
102115 type : "Feature" ,
You can’t perform that action at this time.
0 commit comments