Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion GitDiffMargin/View/EditorDiffMarginControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@
<Popup AllowsTransparency="True"
HorizontalOffset="8"
IsOpen="{Binding ShowPopup, Mode=TwoWay}"
Placement="MousePoint"
Placement="Custom"
PlacementTarget="{Binding ElementName=diffControl}"
CustomPopupPlacementCallback="HandleCustomPopupPlacement"
StaysOpen="False">
<Border Background="Transparent">
<StackPanel Orientation="Vertical">
Expand Down
12 changes: 12 additions & 0 deletions GitDiffMargin/View/EditorDiffMarginControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace GitDiffMargin.View
{
using System.Windows;
using System.Windows.Controls.Primitives;

/// <summary>
/// Interaction logic for EditorDiffMarginControl.xaml
/// </summary>
Expand All @@ -9,5 +12,14 @@ public EditorDiffMarginControl()
{
InitializeComponent();
}

private CustomPopupPlacement[] HandleCustomPopupPlacement(Size popupSize, Size targetSize, Point offset)
{
// TODO: Change vertical placement to be relative to mouse position IFF the mouse is vertically within the
// target diff glyph.
CustomPopupPlacement verticalPlacement = new CustomPopupPlacement(offset, PopupPrimaryAxis.Vertical);
CustomPopupPlacement horizontalPlacement = new CustomPopupPlacement(offset, PopupPrimaryAxis.Horizontal);
return new[] { verticalPlacement, horizontalPlacement };
}
}
}
1 change: 1 addition & 0 deletions GitDiffMargin/ViewModel/EditorDiffMarginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private void MoveToChange(DiffViewModel currentDiffViewModel, int indexModifier)
MarginCore.MoveToChange(diffViewModel.LineNumber);

((EditorDiffViewModel)currentDiffViewModel).ShowPopup = false;
((EditorDiffViewModel)diffViewModel).ShowPopUpCommand.Execute(this);
}

protected override void HandleHunksChanged(object sender, HunksChangedEventArgs e)
Expand Down