private bool IsInView(ILineText curLine, ILineText preLine, Vector2 actualSize) { bool changedPosition = false; if (Overlap(curLine, preLine)) { curLine.ChangePosition(); changedPosition = true; } for (int i = 0; i < 2; i++) { Vector2 topLeft = curLine.TopLeftPoint, bottomRight = curLine.BottomRightPoint; if (topLeft.X > 0 && topLeft.Y > 0 && bottomRight.X < actualSize.X && bottomRight.Y < actualSize.Y) { return(true); } if (!changedPosition) { curLine.ChangePosition(); } else { break; } } for (int i = 0; i < 2; i++) { Vector2 topLeft = curLine.TopLeftPoint, bottomRight = curLine.BottomRightPoint; if ((topLeft.X > 0 && topLeft.Y > 0 && topLeft.X < actualSize.X && topLeft.Y < actualSize.Y) || (bottomRight.X > 0 && bottomRight.Y > 0 && bottomRight.X < actualSize.X && bottomRight.Y < actualSize.Y)) { return(true); } if (!changedPosition) { curLine.ChangePosition(); } else { break; } } return(false); }