onViewportResize method
Override in order to perform a custom action upon resize.
A typical use-case would be to adjust the viewport's clip mask to match the new size.
Implementation
@override
void onViewportResize() {
final desiredWidth = size.y * aspectRatio;
if (desiredWidth > size.x) {
size.y = size.x / aspectRatio;
} else {
size.x = desiredWidth;
}
final x = size.x / 2;
final y = size.y / 2;
_clipRect = Rect.fromLTRB(-x, -y, x, y);
}