getRotatedOffset method

Offset getRotatedOffset(
  1. Offset offset01,
  2. double straightWidth,
  3. double straightHeight
)

Returns the offset as rotated.

Implementation

Offset getRotatedOffset(
  final Offset offset01,
  final double straightWidth,
  final double straightHeight,
) {
  switch (this) {
    case CropRotation.up:
      return Offset(
        straightWidth * offset01.dx,
        straightHeight * offset01.dy,
      );
    case CropRotation.down:
      return Offset(
        straightWidth * (1 - offset01.dx),
        straightHeight * (1 - offset01.dy),
      );
    case CropRotation.right:
      return Offset(
        straightWidth * offset01.dy,
        straightHeight * (1 - offset01.dx),
      );
    case CropRotation.left:
      return Offset(
        straightWidth * (1 - offset01.dy),
        straightHeight * offset01.dx,
      );
  }
}