This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -65,15 +65,13 @@ IWpfTextViewMargin CreateMargin<TGlyphTag>(IGlyphFactory<TGlyphTag> glyphFactory
6565 return margin ;
6666 }
6767
68- void TrackCommentGlyphOnDiffView ( IWpfTextViewHost host , FrameworkElement marginElement )
68+ void TrackCommentGlyphOnDiffView ( IWpfTextViewHost host , UIElement marginElement )
6969 {
7070 var textView = host . TextView ;
7171 if ( textView . Roles . Contains ( "DIFF" ) )
7272 {
73- var hostControl = host . HostControl ;
7473 var router = new MouseEnterAndLeaveEventRouter < AddInlineCommentGlyph > ( ) ;
75- hostControl . MouseMove += ( t , e ) => router . MouseMove ( marginElement , e ) ;
76- hostControl . MouseLeave += ( t , e ) => router . MouseLeave ( marginElement , e ) ;
74+ router . Add ( host . HostControl , marginElement ) ;
7775 }
7876 }
7977
Original file line number Diff line number Diff line change @@ -9,7 +9,13 @@ class MouseEnterAndLeaveEventRouter<T> where T : FrameworkElement
99 {
1010 T previousMouseOverElement ;
1111
12- public void MouseMove ( object target , MouseEventArgs e )
12+ public void Add ( UIElement sourceElement , UIElement targetElement )
13+ {
14+ sourceElement . MouseMove += ( t , e ) => MouseMove ( targetElement , e ) ;
15+ sourceElement . MouseLeave += ( t , e ) => MouseLeave ( targetElement , e ) ;
16+ }
17+
18+ void MouseMove ( object target , MouseEventArgs e )
1319 {
1420 T mouseOverElement = null ;
1521 Action < T > visitAction = element =>
@@ -27,7 +33,7 @@ public void MouseMove(object target, MouseEventArgs e)
2733 }
2834 }
2935
30- public void MouseLeave ( object target , MouseEventArgs e )
36+ void MouseLeave ( object target , MouseEventArgs e )
3137 {
3238 MouseLeave ( previousMouseOverElement , e ) ;
3339 }
You can’t perform that action at this time.
0 commit comments