onFloatingCursorResetTick method

void onFloatingCursorResetTick()

Specifies the floating cursor dimensions and position based the animation controller value. The floating cursor is resized (see RenderAbstractEditor.setFloatingCursor) and repositioned (linear interpolation between position of floating cursor and current position of background cursor)

Implementation

void onFloatingCursorResetTick() {
  final finalPosition =
      renderEditor.getLocalRectForCaret(_lastTextPosition!).centerLeft - _floatingCursorOffset(_lastTextPosition!);
  if (floatingCursorResetController.isCompleted) {
    renderEditor.setFloatingCursor(FloatingCursorDragState.End, finalPosition, _lastTextPosition!);
    _startCaretRect = null;
    _lastTextPosition = null;
    _pointOffsetOrigin = null;
    _lastBoundedOffset = null;
  } else {
    final lerpValue = floatingCursorResetController.value;
    final lerpX = lerpDouble(_lastBoundedOffset!.dx, finalPosition.dx, lerpValue)!;
    final lerpY = lerpDouble(_lastBoundedOffset!.dy, finalPosition.dy, lerpValue)!;

    renderEditor.setFloatingCursor(FloatingCursorDragState.Update, Offset(lerpX, lerpY), _lastTextPosition!,
        resetLerpValue: lerpValue);
  }
}