moveViewTo method

void moveViewTo(
  1. double xValue,
  2. double yValue,
  3. AxisDependency axis
)

Scrolls so the left edge sits at xValue and yValue is vertically centered. Runs as a viewport job and redraws (see addViewportJob).

xValue is the value shown at the left edge of the content area, yValue the value shown at the vertical center, in values of axis.

Implementation

void moveViewTo(double xValue, double yValue, AxisDependency axis) {
  if (!_allFinite([xValue, yValue])) return;
  final yInView = getAxisRange(axis) / viewPortHandler.scaleY;

  final job = MoveViewJob.getInstance(
    viewPortHandler,
    xValue,
    yValue + yInView / 2,
    getTransformer(axis),
    this,
  );
  addViewportJob(job.run);
}