Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 3b9b2ac

Browse files
fix #496: ContextActionBulbControl: it should always be displayed inside the editor's view port bounds
1 parent 4ac976c commit 3b9b2ac

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditEditorUIService.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ public IOverlayUIElement CreateOverlayUIElement(UIElement element)
6767
/// <inheritdoc />
6868
public Point GetScreenPosition(int line, int column)
6969
{
70-
var positionInPixels = textView.PointToScreen(
71-
textView.GetVisualPosition(new TextViewPosition(line, column), VisualYPosition.LineBottom) - textView.ScrollOffset);
70+
var visualPosition = textView.GetVisualPosition(
71+
new TextViewPosition(line, column), VisualYPosition.LineBottom) - textView.ScrollOffset;
72+
var positionInPixels = textView.PointToScreen(new Point(visualPosition.X.CoerceValue(0, textView.ActualWidth),
73+
visualPosition.Y.CoerceValue(0, textView.ActualHeight)));
7274
return positionInPixels.TransformFromDevice(textView);
7375
}
7476

src/Main/Base/Project/Editor/IEditorUIService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public interface IEditorUIService
3737

3838
/// <summary>
3939
/// Gets the absolute screen position of given position in the document.
40+
/// If the position is outside of the currently visible portion of the document,
41+
/// the value is forced into the viewport bounds.
4042
/// </summary>
4143
Point GetScreenPosition(int line, int column);
4244

0 commit comments

Comments
 (0)