22
22
.status .success { background : # d4edda ; color : # 155724 ; }
23
23
.comparison-controls { background : white; padding : 20px ; border-radius : 8px ; margin-bottom : 20px ; box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.1 ); }
24
24
.file-selector { display : flex; gap : 20px ; align-items : center; }
25
- .file-list { flex : 1 ; max-height : 400px ; overflow-y : auto; border : 1px solid # ddd ; border-radius : 4px ; }
25
+ .file-list {
26
+ flex : 1 ;
27
+ max-height : 400px ;
28
+ overflow-y : auto;
29
+ overflow-x : hidden;
30
+ border : 1px solid # ddd ;
31
+ border-radius : 4px ;
32
+ -webkit-overflow-scrolling : touch;
33
+ scroll-behavior : smooth;
34
+ outline : none;
35
+ /* Custom scrollbar styling */
36
+ scrollbar-width : thin;
37
+ scrollbar-color : # ccc # f5f5f5 ;
38
+ }
26
39
.file-item { padding : 8px 12px ; cursor : pointer; border-bottom : 1px solid # eee ; }
27
40
.file-item : hover { background : # f8f9fa ; }
28
41
.file-item .selected {
@@ -435,11 +448,11 @@ <h3 id="sha2-title">SHA 2</h3>
435
448
436
449
updateFileList ( ) {
437
450
const fileList = document . getElementById ( 'file-list' ) ;
438
-
451
+
439
452
fileList . innerHTML = this . fileComparisons . map ( file => {
440
453
let backgroundColor = '#51cf66' ; // Default: identical (green)
441
454
let borderColor = '#51cf66' ;
442
-
455
+
443
456
if ( file . hasDiff ) {
444
457
if ( file . onlyInSha1 ) {
445
458
backgroundColor = '#ffd43b' ; // Only in SHA1 (yellow)
@@ -452,14 +465,45 @@ <h3 id="sha2-title">SHA 2</h3>
452
465
borderColor = '#ff6b6b' ;
453
466
}
454
467
}
455
-
468
+
456
469
return `
457
470
<div class="file-item" onclick="viewer.selectFile('${ file . path } ')" data-path="${ file . path } "
458
471
style="border-left: 4px solid ${ borderColor } ; background: linear-gradient(90deg, ${ backgroundColor } 20 0%, white 15%);">
459
472
${ file . name }
460
473
</div>
461
474
` ;
462
475
} ) . join ( '' ) ;
476
+
477
+ // Add mouse wheel scrolling support
478
+ this . setupFileListScrolling ( ) ;
479
+ }
480
+
481
+ setupFileListScrolling ( ) {
482
+ const fileList = document . getElementById ( 'file-list' ) ;
483
+ if ( ! fileList ) return ;
484
+
485
+ // Remove existing listeners to prevent duplicates
486
+ fileList . removeEventListener ( 'wheel' , this . handleFileListScroll ) ;
487
+
488
+ // Add wheel event listener for custom scrolling
489
+ this . handleFileListScroll = ( e ) => {
490
+ // Prevent default page scrolling
491
+ e . preventDefault ( ) ;
492
+ e . stopPropagation ( ) ;
493
+
494
+ // Calculate scroll amount with smoother, less laggy scrolling
495
+ const scrollAmount = e . deltaY * 1.5 ;
496
+
497
+ // Use requestAnimationFrame for smoother scrolling
498
+ requestAnimationFrame ( ( ) => {
499
+ fileList . scrollTop += scrollAmount ;
500
+ } ) ;
501
+ } ;
502
+
503
+ fileList . addEventListener ( 'wheel' , this . handleFileListScroll , { passive : false } ) ;
504
+
505
+ // Also ensure the element is focusable for better interaction
506
+ fileList . setAttribute ( 'tabindex' , '0' ) ;
463
507
}
464
508
465
509
async selectFile ( filePath ) {
0 commit comments