OSDN Git Service

UWP版で変換候補の位置がずれるバグを修正した
authorkonekoneko <test2214@hotmail.co.jp>
Sat, 12 Nov 2016 08:33:01 +0000 (14:03 +0530)
committerkonekoneko <test2214@hotmail.co.jp>
Sat, 12 Nov 2016 08:33:01 +0000 (14:03 +0530)
Core/Util.cs

index 987fe51..255de09 100644 (file)
@@ -40,7 +40,7 @@ namespace FooEditEngine
             Windows.Foundation.Rect win_rect = Windows.UI.Xaml.Window.Current.CoreWindow.Bounds;
             screen = screen.Offset(-win_rect.X, -win_rect.Y);
 
-            var gt = element.TransformToVisual(element);
+            var gt = Windows.UI.Xaml.Window.Current.Content.TransformToVisual(element);
             return gt.TransformPoint(screen);
         }
 
@@ -54,8 +54,7 @@ namespace FooEditEngine
         public static Point GetScreentPoint(Point client, Windows.UI.Xaml.UIElement element)
         {
             //ウィンドウ内での絶対座標を取得する
-            var gt = element.TransformToVisual(element);
-            Point screenPoint = gt.TransformPoint(client);
+            Point screenPoint = GetPointInWindow(client, element);
 
             //Windows10以降では補正する必要がある
             Windows.Foundation.Rect win_rect = Windows.UI.Xaml.Window.Current.CoreWindow.Bounds;
@@ -70,13 +69,13 @@ namespace FooEditEngine
             screen.X -= win_rect.X;
             screen.Y -= win_rect.Y;
 
-            var gt = element.TransformToVisual(element);
+            var gt = Windows.UI.Xaml.Window.Current.Content.TransformToVisual(element);
             return gt.TransformBounds(screen);
         }
         public static Windows.Foundation.Rect GetScreentRect(Windows.Foundation.Rect client, Windows.UI.Xaml.UIElement element)
         {
             //ウィンドウ内での絶対座標を取得する
-            var gt = element.TransformToVisual(element);
+            var gt = element.TransformToVisual(null);
             Windows.Foundation.Rect screenRect = gt.TransformBounds(client);
 
             //Windows10以降では補正する必要がある