@@ -110,32 +110,33 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
110110
111111 const atom1 = findAtom ( m . atom1 . chain , m . atom1 . resNo , m . atom1 . atomName ) ;
112112 const atom2 = findAtom ( m . atom2 . chain , m . atom2 . resNo , m . atom2 . atomName ) ;
113- console . log ( "Found atom1:" , atom1 ) ;
114- console . log ( "Found atom2:" , atom2 ) ;
113+ console . log ( "Found atom1:" , atom1 , "index:" , atom1 ?. index ) ;
114+ console . log ( "Found atom2:" , atom2 , "index:" , atom2 ?. index ) ;
115115
116116 if ( atom1 && atom2 && componentRef . current ) {
117117 try {
118- // Use NGL's built-in distance representation
119- const atomPair = [
120- [ atom1 . index ] ,
121- [ atom2 . index ]
122- ] ;
118+ // NGL distance representation expects atomPair as [[index1, index2]]
119+ const atomPair = [ [ atom1 . index , atom2 . index ] ] ;
123120
124- console . log ( "Adding distance representation for atoms :" , atomPair ) ;
121+ console . log ( "Adding distance representation with atomPair :" , atomPair ) ;
125122 const distanceRepr = componentRef . current . addRepresentation ( "distance" , {
126123 atomPair : atomPair ,
127124 color : "yellow" ,
128125 labelColor : "white" ,
129- labelSize : 1.5 ,
126+ labelSize : 2.0 ,
130127 labelUnit : "angstrom" ,
128+ lineOpacity : 1.0 ,
129+ linewidth : 3 ,
131130 opacity : 1.0
132131 } ) ;
133132
134133 console . log ( "Distance representation added successfully:" , distanceRepr ) ;
134+ console . log ( "Distance representation parameters:" , distanceRepr . getParameters ( ) ) ;
135135 console . log ( "=== DRAW MEASUREMENT END ===" ) ;
136136 return distanceRepr ;
137137 } catch ( e ) {
138138 console . error ( "Failed to add distance representation:" , e ) ;
139+ console . error ( "Error stack:" , ( e as Error ) . stack ) ;
139140 }
140141 }
141142 console . log ( "WARNING: Atoms not found or component not ready" ) ;
0 commit comments