updateFloatingCursor method

void updateFloatingCursor(
  1. RawFloatingCursorPoint point,
  2. RenderEditor renderEditor
)

Implementation

void updateFloatingCursor(
    RawFloatingCursorPoint point, RenderEditor renderEditor) {
//    switch (point.state) {
//      case FloatingCursorDragState.Start:
//        if (_floatingCursorResetController.isAnimating) {
//          _floatingCursorResetController.stop();
//          _onFloatingCursorResetTick();
//        }
//        final TextPosition currentTextPosition =
//            TextPosition(offset: renderEditor.selection.baseOffset);
//        _startCaretRect =
//            renderEditor.getLocalRectForCaret(currentTextPosition);
//        renderEditor.setFloatingCursor(
//            point.state,
//            _startCaretRect.center - _floatingCursorOffset,
//            currentTextPosition);
//        break;
//      case FloatingCursorDragState.Update:
//        // We want to send in points that are centered around a (0,0) origin, so we cache the
//        // position on the first update call.
//        if (_pointOffsetOrigin != null) {
//          final Offset centeredPoint = point.offset - _pointOffsetOrigin;
//          final Offset rawCursorOffset =
//              _startCaretRect.center + centeredPoint - _floatingCursorOffset;
//          _lastBoundedOffset = renderEditor
//              .calculateBoundedFloatingCursorOffset(rawCursorOffset);
//          _lastTextPosition = renderEditor.getPositionForPoint(renderEditor
//              .localToGlobal(_lastBoundedOffset + _floatingCursorOffset));
//          renderEditor.setFloatingCursor(
//              point.state, _lastBoundedOffset, _lastTextPosition);
//        } else {
//          _pointOffsetOrigin = point.offset;
//        }
//        break;
//      case FloatingCursorDragState.End:
//        // We skip animation if no update has happened.
//        if (_lastTextPosition != null && _lastBoundedOffset != null) {
//          _floatingCursorResetController.value = 0.0;
//          _floatingCursorResetController.animateTo(1.0,
//              duration: _floatingCursorResetTime, curve: Curves.decelerate);
//        }
//        break;
//    }
}