Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit f711194

Browse files
committed
Track mouse over margin as well as text view
1 parent 5e2cbfd commit f711194

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/GitHub.InlineReviews/InlineCommentMarginProvider.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,19 @@ IWpfTextViewMargin CreateMargin<TGlyphTag>(IGlyphFactory<TGlyphTag> glyphFactory
6161
var margin = new GlyphMargin<TGlyphTag>(wpfTextViewHost, glyphFactory, gridFactory, tagAggregator, editorFormatMap,
6262
IsMarginVisible, MarginPropertiesName, MarginName, true, 17.0);
6363

64-
TrackCommentGlyphOnDiffView(wpfTextViewHost.TextView, margin.VisualElement);
64+
TrackCommentGlyphOnDiffView(wpfTextViewHost, margin.VisualElement);
6565
return margin;
6666
}
6767

68-
void TrackCommentGlyphOnDiffView(IWpfTextView textView, FrameworkElement visualElement)
68+
void TrackCommentGlyphOnDiffView(IWpfTextViewHost host, FrameworkElement marginElement)
6969
{
70+
var textView = host.TextView;
7071
if (textView.Roles.Contains("DIFF"))
7172
{
73+
var hostControl = host.HostControl;
7274
var router = new MouseEnterAndLeaveEventRouter<AddInlineCommentGlyph>();
73-
textView.VisualElement.MouseMove += (t, e) => router.MouseMove(visualElement, e);
74-
textView.VisualElement.MouseLeave += (t, e) => router.MouseLeave(visualElement, e);
75+
hostControl.MouseMove += (t, e) => router.MouseMove(marginElement, e);
76+
hostControl.MouseLeave += (t, e) => router.MouseLeave(marginElement, e);
7577
}
7678
}
7779

0 commit comments

Comments
 (0)