public void AddChildren(IEnumerable <IBlock> inputCharactors, Point caretPoint, string parentId) { Rect moleculeRect; Rect denominatorRect; if (null == Molecule) { moleculeRect = new Rect(Location.X - 2, Location.Y - 4, FontManager.Instance.FontSize + 4, FontManager.Instance.FontSize + 4); } else { moleculeRect = new Rect(Location.X - 2, Location.Y - 4, Molecule.GetSize().Width + 4, Molecule.GetSize().Height + 4); } if (null == Denominator) { denominatorRect = new Rect(Location.X - 2, Location.Y + FontManager.Instance.FontSize * 1.2 - 2, FontManager.Instance.FontSize + 4, FontManager.Instance.FontSize + 4); } else { denominatorRect = new Rect(Location.X - 2, Location.Y + moleculeRect.Height + FontManager.Instance.FontSize * 0.2 - 2, Denominator.GetSize().Width + 4, Denominator.GetSize().Height + 4); } if (moleculeRect.Contains(caretPoint)) { if (null == Molecule) { Molecule = new BlockNode(); Molecule.ParentId = ID; } Molecule.AddChildren(inputCharactors, caretPoint, parentId); } else { if (null == Denominator) { Denominator = new BlockNode(); Denominator.ParentId = ID; } Denominator.AddChildren(inputCharactors, caretPoint, parentId); } }