Browse Source

fix #496: ContextActionBulbControl: it should always be displayed inside the editor's view port bounds

pull/516/head
Siegfried Pammer 11 years ago
parent
commit
3b9b2ac588
  1. 6
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditEditorUIService.cs
  2. 2
      src/Main/Base/Project/Editor/IEditorUIService.cs

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

@ -67,8 +67,10 @@ namespace ICSharpCode.AvalonEdit.AddIn
/// <inheritdoc /> /// <inheritdoc />
public Point GetScreenPosition(int line, int column) public Point GetScreenPosition(int line, int column)
{ {
var positionInPixels = textView.PointToScreen( var visualPosition = textView.GetVisualPosition(
textView.GetVisualPosition(new TextViewPosition(line, column), VisualYPosition.LineBottom) - textView.ScrollOffset); new TextViewPosition(line, column), VisualYPosition.LineBottom) - textView.ScrollOffset;
var positionInPixels = textView.PointToScreen(new Point(visualPosition.X.CoerceValue(0, textView.ActualWidth),
visualPosition.Y.CoerceValue(0, textView.ActualHeight)));
return positionInPixels.TransformFromDevice(textView); return positionInPixels.TransformFromDevice(textView);
} }

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

@ -37,6 +37,8 @@ namespace ICSharpCode.SharpDevelop.Editor
/// <summary> /// <summary>
/// Gets the absolute screen position of given position in the document. /// Gets the absolute screen position of given position in the document.
/// If the position is outside of the currently visible portion of the document,
/// the value is forced into the viewport bounds.
/// </summary> /// </summary>
Point GetScreenPosition(int line, int column); Point GetScreenPosition(int line, int column);

Loading…
Cancel
Save