@@ -2406,6 +2406,13 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
24062406
24072407
24082408 let repType = representation || 'cartoon' ;
2409+
2410+ // Fix: 'backbone' representation in NGL can sometimes render as disconnected dots if backbone atoms are incomplete.
2411+ // 'trace' is a robust C-alpha trace that guarantees a continuous tubular visualization.
2412+ if ( repType === 'backbone' ) {
2413+ repType = 'trace' ;
2414+ }
2415+
24092416 let finalColor : any = coloring || 'chainid' ;
24102417
24112418 // --- 1. RESOLVE ALIASES & DEFAULTS ---
@@ -2424,12 +2431,22 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
24242431 finalColor = 'element' ;
24252432 }
24262433
2434+ // Note: Since we are using replace_file_content, I need to match the ENTIRE block or use multi-replace.
2435+ // To avoid replacing massive chunks, I will split this into two edits if needed, but let's try to target the top part first
2436+ // and the params part second?
2437+ // Actually, replace_file_content works on a contiguous block.
2438+ // The StartLine/EndLine must be precise.
2439+
2440+ // Let's rewrite the `repType` initialization logic at the top.
2441+ // And then the param logic at the bottom is separate.
2442+
2443+ // ERROR: I cannot easily edit two separated parts in one replace_file_content.
2444+ // I should use `multi_replace_file_content` instead.
2445+
2446+
24272447 // --- 2. REGISTER DYNAMIC SCHEMES (Charge & Custom) ---
24282448 const NGL = window . NGL ;
24292449
2430- // Custom Scheme Logic using Native NGL SelectionColormaker
2431- // This is robust because it uses NGL's internal selection handling and fallback logic.
2432-
24332450 // Helper: Register Charge Scheme (Dynamic)
24342451 if ( finalColor === 'charge' ) {
24352452 finalColor = NGL . ColormakerRegistry . addScheme ( function ( this : any , params : any ) {
@@ -2521,7 +2538,7 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
25212538 delete globalParams . quality ;
25222539 Object . assign ( globalParams , cartoonParams ) ;
25232540 // try { component.structure.eachModel((m: any) => m.calculateSecondaryStructure?.()); } catch (e) { }
2524- } else if ( repType === 'backbone ' ) {
2541+ } else if ( repType === 'trace ' ) {
25252542 Object . assign ( globalParams , backboneParams ) ;
25262543 }
25272544
0 commit comments