@@ -221,7 +221,9 @@ export function GitVisualizer({
221221 width : 14 ,
222222 height : 14 ,
223223 "border-width" : 0 ,
224- "overlay-opacity" : 0 ,
224+ "overlay-opacity" : 0.001 ,
225+ "overlay-padding" : 3 ,
226+ "overlay-color" : "transparent" ,
225227 } ,
226228 } ,
227229 {
@@ -291,7 +293,7 @@ export function GitVisualizer({
291293
292294 // Configure static interaction settings
293295 cy . boxSelectionEnabled ( false ) ;
294- // cy.autoungrabify(true);
296+ cy . autoungrabify ( true ) ;
295297 cy . userZoomingEnabled ( true ) ;
296298 cy . userPanningEnabled ( true ) ;
297299
@@ -349,38 +351,29 @@ export function GitVisualizer({
349351 }
350352 } ;
351353 } ;
352- // Handle node click events in an effect
354+
353355 useEffect ( ( ) => {
354356 const cy = cyRef . current ;
355357 if ( ! cy ) return ;
356358
357359 const handleNodeTap = ( evt : cytoscape . EventObject ) => {
358360 const node = evt . target ;
359361 const id = node . id ( ) ;
360-
361- console . log ( evt . target ) ;
362-
363- setSelectedId ( id ) ;
364- evt . cy . elements ( ) . unselect ( ) ;
365- node . select ( ) ;
366-
367- // This `commits` is from the current render, so it is always up-to-date.
368362 const commit = commits . find ( ( c ) => c . id === id ) ;
369363 if ( commit ) {
370364 onCommitSelect ( commit ) ;
371365 }
372366 } ;
373367
374- // Register the event listener
375368 cy . on ( "tap" , "node" , handleNodeTap ) ;
376369
377- // Cleanup: remove the listener when the component unmounts or `commits` changes
378370 return ( ) => {
371+ // Cleanup function removes the old listener
379372 if ( cy && ! cy . destroyed ( ) ) {
380373 cy . off ( "tap" , "node" , handleNodeTap ) ;
381374 }
382375 } ;
383- } , [ commits , onCommitSelect ] ) ; // Dependency array is key!
376+ } , [ commits , onCommitSelect ] ) ;
384377
385378 // Cleanup cytoscape reference on unmount
386379 useEffect ( ( ) => {
@@ -400,15 +393,16 @@ export function GitVisualizer({
400393 if ( ! cy ) return ;
401394 try {
402395 cy . resize ( ) ;
403- const recentIds = commits . slice ( undefined , 10 ) . map ( ( c ) => c . id ) ;
404- const recentNodes =
405- recentIds . length > 0
406- ? cy . getElementById ( recentIds [ 0 ] )
407- : cy . collection ( ) ;
408- for ( let i = 1 ; i < recentIds . length ; i ++ ) {
409- recentNodes . merge ( cy . getElementById ( recentIds [ i ] ) ) ;
410- }
411- cy . fit ( recentNodes . nonempty ( ) ? recentNodes : undefined , 30 ) ;
396+ // const recentIds = commits.slice(undefined, 10).map((c) => c.id);
397+ // const recentNodes =
398+ // recentIds.length > 0
399+ // ? cy.getElementById(recentIds[0])
400+ // : cy.collection();
401+ // for (let i = 1; i < recentIds.length; i++) {
402+ // recentNodes.merge(cy.getElementById(recentIds[i]));
403+ // }
404+ // cy.fit(recentNodes.nonempty() ? recentNodes : undefined, 30);
405+ cy . fit ( undefined , 30 ) ;
412406 } catch ( error ) {
413407 console . warn ( "Resize error:" , error ) ;
414408 }
@@ -440,15 +434,16 @@ export function GitVisualizer({
440434 // Fit with padding if still mounted
441435 if ( cyRef . current === liveCy ) {
442436 // After layout, fit to last 10 commits for focused view
443- const recentIds = commits . slice ( undefined , 10 ) . map ( ( c ) => c . id ) ;
444- const recentNodes =
445- recentIds . length > 0
446- ? liveCy . getElementById ( recentIds [ 0 ] )
447- : liveCy . collection ( ) ;
448- for ( let i = 1 ; i < recentIds . length ; i ++ ) {
449- recentNodes . merge ( liveCy . getElementById ( recentIds [ i ] ) ) ;
450- }
451- liveCy . fit ( recentNodes . nonempty ( ) ? recentNodes : undefined , 30 ) ;
437+ // const recentIds = commits.slice(undefined, 10).map((c) => c.id);
438+ // const recentNodes =
439+ // recentIds.length > 0
440+ // ? liveCy.getElementById(recentIds[0])
441+ // : liveCy.collection();
442+ // for (let i = 1; i < recentIds.length; i++) {
443+ // recentNodes.merge(liveCy.getElementById(recentIds[i]));
444+ // }
445+ // liveCy.fit(recentNodes.nonempty() ? recentNodes : undefined, 30);
446+ liveCy . fit ( undefined , 30 ) ;
452447 }
453448 }
454449 } catch {
@@ -503,7 +498,6 @@ export function GitVisualizer({
503498 stylesheet = { stylesheet as any }
504499 layout = { layout as any }
505500 style = { { width : "100%" , height : "100%" } }
506- wheelSensitivity = { 0.2 }
507501 />
508502 { ( isLoading || loading ) && commits . length > 0 && (
509503 < div className = "absolute inset-0 flex items-center justify-center bg-background/60 backdrop-blur-sm text-sm text-muted-foreground" >
0 commit comments