update method

void update(
  1. Vector2 delta,
  2. double dt
)

Implementation

void update(Vector2 delta, double dt) {
  parallaxRenderer.update(dt);
  // Scale the delta so that images that are larger don't scroll faster
  _delta
    ..setFrom(delta)
    ..divide(_imageSize);
  _scroll.add(_delta);
  switch (parallaxRenderer.repeat) {
    case ImageRepeat.repeat:
      _scroll.setValues(_scroll.x % 1, _scroll.y % 1);
    case ImageRepeat.repeatX:
      _scroll.setValues(_scroll.x % 1, _scroll.y);
    case ImageRepeat.repeatY:
      _scroll.setValues(_scroll.x, _scroll.y % 1);
    case ImageRepeat.noRepeat:
  }

  _paintArea = Rect.fromLTWH(
    -_scroll.x * _imageSize.x,
    -_scroll.y * _imageSize.y,
    _paintArea.width,
    _paintArea.height,
  );
}