File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -127,9 +127,11 @@ class GraphPlugin {
127127 // Apply background color to canvas
128128 this . applyCanvasBackground ( themeColors . background ) ;
129129
130- // Disable physics after stabilization (performance optimization)
130+ // Disable physics after stabilization and fit to view
131131 this . network . on ( 'stabilizationIterationsDone' , ( ) => {
132132 this . network . setOptions ( { physics : { enabled : true } } ) ;
133+ // Fit the graph to view after layout is complete
134+ this . network . fit ( { maxZoomLevel : 1000.0 } ) ;
133135 } ) ;
134136
135137 // Setup theme change observer
@@ -150,12 +152,10 @@ class GraphPlugin {
150152 fitButton . textContent = 'Zoom to Fit' ;
151153 fitButton . onclick = ( ) => {
152154 if ( this . network ) {
153- this . network . fit ( { animation : { duration : 300 , easingFunction : 'easeInOutQuad' } } ) ;
155+ this . network . fit ( { maxZoomLevel : 1000.0 , animation : { duration : 300 , easingFunction : 'easeInOutQuad' } } ) ;
154156 }
155157 } ;
156158 controls . appendChild ( fitButton ) ;
157-
158- this . network . fit ( ) ;
159159
160160 } catch ( error ) {
161161 console . error ( 'Error rendering graph:' , error ) ;
You can’t perform that action at this time.
0 commit comments