scale method

void scale(
  1. Offset focalPoint,
  2. double scale
)

Implementation

void scale(ui.Offset focalPoint, double scale) {
  double diffX = _size.width / 2 - focalPoint.dx;
  double diffY = _size.height / 2 - focalPoint.dy;
  _uiCanvas.translate((-_size.width / 2 + diffX) * (scale - 1), (-_size.height / 2 + diffY) * (scale - 1));
  // This method scales starting from the top/left corner. That means that the top-left corner stays at its position and the rest is scaled.
  _uiCanvas.scale(scale);
}