OSDN Git Service

メトロ版で予測候補の位置がずれることがあった
authorkonekoneko <test2214@hotmail.co.jp>
Sat, 20 Aug 2016 19:59:37 +0000 (01:29 +0530)
committerkonekoneko <test2214@hotmail.co.jp>
Sat, 20 Aug 2016 19:59:37 +0000 (01:29 +0530)
Core/TextServiceFramework/TextStoreHelper.cs
Metro/FooEditEngine/FooTextBox.cs

index 10be1d2..13cabf5 100644 (file)
@@ -58,7 +58,7 @@ namespace FooEditEngine
             endTextPoint = view.GetLayoutLineFromIndex(endIndex);
             endPos = view.GetPostionFromTextPoint(endTextPoint);
             //変換候補リストに隙間があるので、ユーザーが見えるように少し移動させる
-            endPos.Y += view.LayoutLines.GetLayout(endTextPoint.row).Height + 15;
+            endPos.Y += view.LayoutLines.GetLayout(endTextPoint.row).Height;
         }
 
         public static void GetSelection(Controller controller, SelectCollection selectons, out DotNetTextStore.TextSelection[] sels)
index 8e10ca6..8d422ab 100644 (file)
@@ -708,13 +708,13 @@ namespace FooEditEngine.Metro
             float dpi;
             this.Render.GetDpi(out dpi, out dpi);
             double scale = dpi / 96.0;
-
+            
             var gt = this.TransformToVisual(Window.Current.Content);
-            startPos = gt.TransformPoint(startPos.Scale(scale));
-            endPos = gt.TransformPoint(endPos.Scale(scale));
-
-            o_topLeft = new POINT((int)startPos.X, (int)startPos.Y);
-            o_bottomRight = new POINT((int)endPos.X, (int)endPos.Y);
+            var screenStartPos = gt.TransformPoint(startPos.Scale(scale));
+            var screenEndPos = gt.TransformPoint(endPos.Scale(scale));
+            Rect win_rect = Window.Current.CoreWindow.Bounds;
+            o_topLeft = new POINT((int)(screenStartPos.X + win_rect.X), (int)(screenStartPos.Y + win_rect.Y));
+            o_bottomRight = new POINT((int)(screenEndPos.X + win_rect.X), (int)(screenEndPos.Y + win_rect.Y));
         }
 
         void _textStore_GetScreenExtent(out POINT o_topLeft, out POINT o_bottomRight)