@@ -565,7 +565,6 @@ public void GotoFirstChange()
565
565
ScrollToLine ( prev . Start ) ;
566
566
}
567
567
}
568
- // NOTE: Not implemented (button hidden) for non-block navigation.
569
568
}
570
569
571
570
public void GotoPrevChange ( )
@@ -678,7 +677,6 @@ public void GotoLastChange()
678
677
ScrollToLine ( next . Start ) ;
679
678
}
680
679
}
681
- // NOTE: Not implemented (button hidden) for non-block navigation.
682
680
}
683
681
684
682
public override void Render ( DrawingContext context )
@@ -1229,15 +1227,15 @@ protected override void OnLoaded(RoutedEventArgs e)
1229
1227
if ( scroller != null )
1230
1228
{
1231
1229
scroller . Bind ( ScrollViewer . OffsetProperty , new Binding ( "ScrollOffset" , BindingMode . TwoWay ) ) ;
1232
- scroller . GotFocus += OnTextViewScrollGotFocus ;
1230
+ scroller . ScrollChanged += OnTextViewScrollChanged ;
1233
1231
}
1234
1232
}
1235
1233
1236
1234
protected override void OnUnloaded ( RoutedEventArgs e )
1237
1235
{
1238
1236
var scroller = this . FindDescendantOfType < ScrollViewer > ( ) ;
1239
1237
if ( scroller != null )
1240
- scroller . GotFocus -= OnTextViewScrollGotFocus ;
1238
+ scroller . ScrollChanged -= OnTextViewScrollChanged ;
1241
1239
1242
1240
base . OnUnloaded ( e ) ;
1243
1241
}
@@ -1274,9 +1272,9 @@ protected override void OnDataContextChanged(EventArgs e)
1274
1272
GC . Collect ( ) ;
1275
1273
}
1276
1274
1277
- private void OnTextViewScrollGotFocus ( object sender , GotFocusEventArgs e )
1275
+ private void OnTextViewScrollChanged ( object sender , ScrollChangedEventArgs e )
1278
1276
{
1279
- if ( EnableChunkSelection && ! TextArea . IsPointerOver )
1277
+ if ( sender is ScrollViewer { IsExpanded : true , IsPointerOver : true } scroller )
1280
1278
TrySetChunk ( null ) ;
1281
1279
}
1282
1280
}
@@ -1446,25 +1444,19 @@ protected override void OnLoaded(RoutedEventArgs e)
1446
1444
_scrollViewer = this . FindDescendantOfType < ScrollViewer > ( ) ;
1447
1445
if ( _scrollViewer != null )
1448
1446
{
1449
- _scrollViewer . GotFocus += OnTextViewScrollGotFocus ;
1450
1447
_scrollViewer . ScrollChanged += OnTextViewScrollChanged ;
1451
1448
_scrollViewer . Bind ( ScrollViewer . OffsetProperty , new Binding ( "SyncScrollOffset" , BindingMode . OneWay ) ) ;
1452
1449
}
1453
-
1454
- TextArea . PointerWheelChanged += OnTextAreaPointerWheelChanged ;
1455
1450
}
1456
1451
1457
1452
protected override void OnUnloaded ( RoutedEventArgs e )
1458
1453
{
1459
1454
if ( _scrollViewer != null )
1460
1455
{
1461
1456
_scrollViewer . ScrollChanged -= OnTextViewScrollChanged ;
1462
- _scrollViewer . GotFocus -= OnTextViewScrollGotFocus ;
1463
1457
_scrollViewer = null ;
1464
1458
}
1465
1459
1466
- TextArea . PointerWheelChanged -= OnTextAreaPointerWheelChanged ;
1467
-
1468
1460
base . OnUnloaded ( e ) ;
1469
1461
GC . Collect ( ) ;
1470
1462
}
@@ -1499,22 +1491,15 @@ protected override void OnDataContextChanged(EventArgs e)
1499
1491
}
1500
1492
}
1501
1493
1502
- private void OnTextViewScrollGotFocus ( object sender , GotFocusEventArgs e )
1503
- {
1504
- if ( EnableChunkSelection && ! TextArea . IsPointerOver )
1505
- TrySetChunk ( null ) ;
1506
- }
1507
-
1508
1494
private void OnTextViewScrollChanged ( object sender , ScrollChangedEventArgs e )
1509
1495
{
1510
- if ( TextArea . IsFocused && DataContext is ViewModels . TwoSideTextDiff diff )
1496
+ if ( IsPointerOver && DataContext is ViewModels . TwoSideTextDiff diff )
1497
+ {
1511
1498
diff . SyncScrollOffset = _scrollViewer ? . Offset ?? Vector . Zero ;
1512
- }
1513
1499
1514
- private void OnTextAreaPointerWheelChanged ( object sender , PointerWheelEventArgs e )
1515
- {
1516
- if ( ! TextArea . IsFocused )
1517
- Focus ( ) ;
1500
+ if ( sender is ScrollViewer { IsExpanded : true , IsPointerOver : true } scroller )
1501
+ TrySetChunk ( null ) ;
1502
+ }
1518
1503
}
1519
1504
1520
1505
private ScrollViewer _scrollViewer = null ;
0 commit comments