public override void OnPointerDown(PointerEventData eventData)
        {
            Caret.MoveTo(
                EditableText.RelativeIndexFromPosition(
                    EditableText.MousePositionInTextRect(eventData)) + _drawStart,
                false);

            eventData.Use();
        }
        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();
        }
Exemplo n.º 3
0
        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();
        }