public void DeactivateCaret()
 {
     StopCoroutine(_blinkCoroutine);
     _blinkCoroutine = null;
     _isVisible      = false;
     InputFieldController.MarkGeometryAsDirty();
 }
        private IEnumerator CaretBlink()
        {
            int timer = 0;

            while (true)
            {
                if (!HasSelection())
                {
                    _isVisible = Mathf.Sin(timer++ *0.1f) < 0;
                    InputFieldController.MarkGeometryAsDirty();
                }
                else
                {
                    _isVisible = true;
                }
                yield return(null);
            }
        }
        public override void OnDrag(PointerEventData eventData)
        {
            Vector2 localMousePos = EditableText.MousePositionInTextRect(eventData);

            if (localMousePos.y < EditableText.DisplayRect.yMin)
            {
                Caret.MoveTo(EditableText.LineDownIndex(true, Caret.GetIndex()), true);
                UpdateText();
            }
            else if (localMousePos.y > EditableText.DisplayRect.yMax)
            {
                Caret.MoveTo(EditableText.LineUpIndex(true, Caret.GetIndex()), true);
                UpdateText();
            }
            else
            {
                Caret.MoveTo(EditableText.RelativeIndexFromPosition(localMousePos) + _drawStart, true);
                InputFieldController.MarkGeometryAsDirty();
            }

            eventData.Use();
        }
        public override void OnDrag(PointerEventData eventData)
        {
            Vector2 localMousePos = EditableText.MousePositionInTextRect(eventData);

            if (localMousePos.x < EditableText.DisplayRect.xMin)
            {
                MoveCaretWithinBounds(Caret.GetIndex() - 1, true);
                UpdateText();
            }
            else if (localMousePos.x > EditableText.DisplayRect.xMax)
            {
                MoveCaretWithinBounds(Caret.GetIndex() + 1, true);
                UpdateText();
            }
            else
            {
                MoveCaretWithinBounds(EditableText.RelativeIndexFromPosition(localMousePos) + _drawStart, true);
                InputFieldController.MarkGeometryAsDirty();
            }

            eventData.Use();
        }