OSDN Git Service

UWP版で読み取りリーダー使用時に正しい位置にキャレットが表示されないバグを修正した
authortest <test@yahoo.co.jp>
Sat, 2 Jan 2021 05:40:11 +0000 (14:40 +0900)
committertest <test@yahoo.co.jp>
Sat, 2 Jan 2021 05:40:11 +0000 (14:40 +0900)
Core/Automaion/FooTextBoxAutomationPeer.cs
Core/Util.cs

index e16d9a5..7ff5095 100644 (file)
@@ -433,8 +433,8 @@ namespace FooEditEngine
             double scale = dpi / 96;
             Point topLeftPos = this.textbox.GetPostionFromTextPoint(topLeft);
             Point bottomRightPos = this.textbox.GetPostionFromTextPoint(bottomRight);
-            topLeftPos = topLeftPos.Scale(scale);
-            bottomRightPos = bottomRightPos.Scale(scale);
+            topLeftPos = Util.GetPointInWindow(topLeftPos.Scale(scale),textbox);
+            bottomRightPos = Util.GetPointInWindow(bottomRightPos.Scale(scale),textbox);
 #endif
 #if WPF
             Point topLeftPos = this.textbox.GetPostionFromTextPoint(topLeft);
index 63fd4e2..1d4d86a 100644 (file)
@@ -47,19 +47,18 @@ namespace FooEditEngine
         public static Point GetPointInWindow(Point client, Windows.UI.Xaml.UIElement element)
         {
             //ウィンドウ内での絶対座標を取得する
-            var gt = element.TransformToVisual(null);
+            var gt = element.TransformToVisual(Windows.UI.Xaml.Window.Current.Content);
             return gt.TransformPoint(client);
         }
 
         public static Point GetScreentPoint(Point client, Windows.UI.Xaml.UIElement element)
         {
-            //ウィンドウ内での絶対座標を取得する
-            Point screenPoint = GetPointInWindow(client, element);
+            var gt = element.TransformToVisual(Windows.UI.Xaml.Window.Current.Content);
+            Point p = gt.TransformPoint(client);
 
             //Windows10以降では補正する必要がある
             Windows.Foundation.Rect win_rect = Windows.UI.Xaml.Window.Current.CoreWindow.Bounds;
-            screenPoint = screenPoint.Offset(win_rect.X, win_rect.Y);
-
+            var screenPoint = p.Offset(win_rect.X, win_rect.Y);
             return screenPoint;
         }
         public static Windows.Foundation.Rect GetClientRect(Windows.Foundation.Rect screen, Windows.UI.Xaml.UIElement element)
@@ -75,7 +74,7 @@ namespace FooEditEngine
         public static Windows.Foundation.Rect GetScreentRect(Windows.Foundation.Rect client, Windows.UI.Xaml.UIElement element)
         {
             //ウィンドウ内での絶対座標を取得する
-            var gt = element.TransformToVisual(null);
+            var gt = element.TransformToVisual(Windows.UI.Xaml.Window.Current.Content);
             Windows.Foundation.Rect screenRect = gt.TransformBounds(client);
 
             //Windows10以降では補正する必要がある