size property

Vector2 get size

Size of the viewport, i.e. the width and the height.

This property represents the bounding box of the viewport. If the viewport is rectangular in shape, then size describes the dimensions of that rectangle. If the viewport has any other shape (for example, circular), then size describes the dimensions of the bounding box of the viewport.

Changing the size at runtime triggers the handleResize event. The size cannot be negative.

Implementation

Vector2 get size => _size;
set size (Vector2 value)

Implementation

set size(Vector2 value) {
  assert(
    value.x >= 0 && value.y >= 0,
    "Viewport's size cannot be negative: $value",
  );
  _size.setFrom(value);
  if (isMounted) {
    camera.viewfinder.onViewportResize();
  }
  onViewportResize();
}