computeVisibleRect method

  1. @protected
Rect computeVisibleRect()

Implementation

@protected
Rect computeVisibleRect() {
  final viewportSize = camera.viewport.virtualSize;
  final currentTransform = transform;
  currentTransform.globalToLocal(_zeroVector, output: _topLeft);
  currentTransform.globalToLocal(viewportSize, output: _bottomRight);
  var minX = min(_topLeft.x, _bottomRight.x);
  var minY = min(_topLeft.y, _bottomRight.y);
  var maxX = max(_topLeft.x, _bottomRight.x);
  var maxY = max(_topLeft.y, _bottomRight.y);
  if (angle != 0) {
    _topRight.setValues(viewportSize.x, 0);
    _bottomLeft.setValues(0, viewportSize.y);
    currentTransform.globalToLocal(_topRight, output: _topRight);
    currentTransform.globalToLocal(_bottomLeft, output: _bottomLeft);
    minX = min(minX, min(_topRight.x, _bottomLeft.x));
    minY = min(minY, min(_topRight.y, _bottomLeft.y));
    maxX = max(maxX, max(_topRight.x, _bottomLeft.x));
    maxY = max(maxY, max(_topRight.y, _bottomLeft.y));
  }
  return Rect.fromLTRB(minX, minY, maxX, maxY);
}