|
1 | 1 | using System; |
| 2 | +using System.Windows; |
2 | 3 | using System.Windows.Controls; |
3 | 4 | using System.ComponentModel.Composition; |
4 | 5 | using Microsoft.VisualStudio.Utilities; |
|
10 | 11 | using GitHub.InlineReviews.Glyph; |
11 | 12 | using GitHub.InlineReviews.Services; |
12 | 13 | using GitHub.InlineReviews.Views; |
13 | | -using GitHub.Models; |
14 | 14 | using GitHub.Services; |
15 | 15 |
|
16 | 16 | namespace GitHub.InlineReviews |
@@ -61,13 +61,20 @@ IWpfTextViewMargin CreateMargin<TGlyphTag>(IGlyphFactory<TGlyphTag> glyphFactory |
61 | 61 | var margin = new GlyphMargin<TGlyphTag>(wpfTextViewHost, glyphFactory, gridFactory, tagAggregator, editorFormatMap, |
62 | 62 | IsMarginVisible, MarginPropertiesName, MarginName, true, 17.0); |
63 | 63 |
|
64 | | - var router = new MouseEnterAndLeaveEventRouter<AddInlineCommentGlyph>(); |
65 | | - wpfTextViewHost.TextView.VisualElement.MouseMove += (t, e) => router.MouseMove(margin.VisualElement, e); |
66 | | - wpfTextViewHost.TextView.VisualElement.MouseLeave += (t, e) => router.MouseLeave(margin.VisualElement, e); |
67 | | - |
| 64 | + TrackCommentGlyphOnDiffView(wpfTextViewHost.TextView, margin.VisualElement); |
68 | 65 | return margin; |
69 | 66 | } |
70 | 67 |
|
| 68 | + void TrackCommentGlyphOnDiffView(IWpfTextView textView, FrameworkElement visualElement) |
| 69 | + { |
| 70 | + if (textView.Roles.Contains("DIFF")) |
| 71 | + { |
| 72 | + 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 | + } |
| 76 | + } |
| 77 | + |
71 | 78 | bool IsMarginVisible(ITextBuffer buffer) |
72 | 79 | { |
73 | 80 | if (sessionManager.GetTextBufferInfo(buffer) != null) |
|
0 commit comments