OSDN Git Service

スクロール中でもぐりっぱーを表示するようにした
[fooeditengine/FooEditEngine.git] / Core / EditView.cs
index d9dccc3..6defca0 100644 (file)
@@ -590,12 +590,20 @@ namespace FooEditEngine
 
         public Rectangle GetRectFromTextPoint(TextPoint tp, int width, int height)
         {
+            if (tp.row < this.Src.Row)
+                return Rectangle.Empty;
             double radius = width / 2;
             Point point = this.GetPostionFromTextPoint(tp);
             double lineHeight = this.LayoutLines.GetLayout(tp.row).Height;
             double srcOffsetY = this.Src.GetOffsetY(this.render.emSize.Height); //画面上ではずれているので引く必要がある
 
-            return new Rectangle(point.X - radius, point.Y + lineHeight - srcOffsetY, width, height);
+            Rectangle rect =  new Rectangle(point.X - radius, point.Y + lineHeight - srcOffsetY, width, height);
+
+            if (rect.BottomLeft.Y >= this.render.TextArea.BottomLeft.Y ||
+                rect.BottomRight.X < this.render.TextArea.BottomLeft.X ||
+                rect.BottomLeft.X > this.render.TextArea.BottomRight.X)
+                return Rectangle.Empty;
+            return rect;
         }
 
         /// <summary>