modified CaretNative
This commit is contained in:
@@ -65,12 +65,21 @@ internal static class CaretNative
|
||||
return caret;
|
||||
}
|
||||
|
||||
return Validate(caret, window, GetDpiForWindow(hwndFocus) / 96.0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The same check over plain numbers: the input window bounds and the scale of
|
||||
/// its monitor are already known.
|
||||
/// </summary>
|
||||
internal static PopupWindowNative.Rect? Validate(
|
||||
PopupWindowNative.Rect caret, PopupWindowNative.Rect window, double scale)
|
||||
{
|
||||
if (IsInside(caret, window))
|
||||
{
|
||||
return caret;
|
||||
}
|
||||
|
||||
double scale = GetDpiForWindow(hwndFocus) / 96.0;
|
||||
var scaled = new PopupWindowNative.Rect
|
||||
{
|
||||
Left = (int)(caret.Left * scale),
|
||||
@@ -82,7 +91,7 @@ internal static class CaretNative
|
||||
return IsInside(scaled, window) ? scaled : null;
|
||||
}
|
||||
|
||||
private static bool IsInside(PopupWindowNative.Rect inner, PopupWindowNative.Rect outer) =>
|
||||
internal static bool IsInside(PopupWindowNative.Rect inner, PopupWindowNative.Rect outer) =>
|
||||
inner.Left >= outer.Left && inner.Right <= outer.Right &&
|
||||
inner.Top >= outer.Top && inner.Bottom <= outer.Bottom;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user