drawCross method

void drawCross(
  1. Canvas canvas
)

绘制交叉线

Implementation

void drawCross(Canvas canvas) {
  if (pressOffset == null) {
    return;
  }
  double bw = _width / 2;

  /// 二分法查找当前选中索引
  double dx = dxToTransformX(pressOffset!.dx) - bw;
  int index = transformXToIndex(dx);

  dx = indexToX(index) + bw;
  drawCrossLine(
    canvas: canvas,
    canvasWidth: canvasWidth,
    canvasHeight: canvasHeight,
    scrollX: scrollX,
    scale: scale,
    dx: dx,
    dy: -10,
    strokeWidth: crossLineWidth,
    color: crossLineColor,
  );
}