scale method

void scale(
  1. double width,
  2. double height
)

Implementation

void scale(double width, double height) {
  if (_extent.isEmpty) return;

  final extentWidth = (_extent[1].x - _extent[0].x).abs();
  final extentHeight = (_extent[1].y - _extent[0].y).abs();

  var fX = width / extentWidth;
  if (fX * extentHeight > height) {
    fX = height / extentHeight;
  }

  _canvasWidth = (extentWidth * fX).ceil();
  _canvasHeight = (extentHeight * fX).ceil();

  _isScaled = true;
}