OSDN Git Service

読み込み時に行分割を行わず、レタリング時に行分割を行うようにした
[fooeditengine/FooEditEngine.git] / WPF / FooEditEngine / WPF / TextLayout.cs
index a0e6c24..d7ed60a 100644 (file)
@@ -102,7 +102,12 @@ namespace FooEditEngine.WPF
                 }
             }
 
-            this.lines[0].Draw(dc, new System.Windows.Point(x, y), InvertAxes.None);
+            double posY = y;
+            foreach(var line in this.lines)
+            {
+                line.Draw(dc, new System.Windows.Point(x, posY), InvertAxes.None);
+                posY += line.Height;
+            }
         }
 
         public void Dispose()
@@ -145,14 +150,32 @@ namespace FooEditEngine.WPF
             }
         }
 
+        double _actualWidth = 0;
         public double Width
         {
-            get { return this.Lines[0].Width; }
+            get
+            {
+                if (_actualWidth != 0)
+                    return _actualWidth;
+                foreach (var line in this.Lines)
+                {
+                    if(line.Width > _actualWidth)
+                        _actualWidth = line.Width;
+                }
+                return _actualWidth;
+            }
         }
 
+        double _height = 0;
         public double Height
         {
-            get { return this.Lines[0].Height; }
+            get {
+                if (_height != 0)
+                    return _height;
+                foreach (var line in this.Lines)
+                    _height += line.Height;
+                return _height;
+            }
         }
 
         public int GetIndexFromColPostion(double x)
@@ -172,6 +195,16 @@ namespace FooEditEngine.WPF
             return this.Lines[0].GetDistanceFromCharacterHit(new CharacterHit(index, 0));
         }
 
+        public int GetIndexFromPostion(double x, double y)
+        {
+            return 0;
+        }
+
+        public Point GetPostionFromIndex(int index)
+        {
+            throw new NotImplementedException();
+        }
+
         public int AlignIndexToNearestCluster(int index, AlignDirection flow)
         {
             CharacterHit hit = this.Lines[0].GetNextCaretCharacterHit(new CharacterHit(index, 0));