matrixScale method

  1. @protected
Matrix4 matrixScale(
  1. Matrix4 matrix,
  2. double scale
)

Implementation

@protected
Matrix4 matrixScale(Matrix4 matrix, double scale) {
  if (scale == 1.0) {
    return matrix.clone();
  }
  assert(scale != 0.0);

  // Don't allow a scale that results in an overall scale beyond min/max
  // scale.
  final double currentScale =
      transformationController!.value.getScaleOnZAxis();
  final double totalScale = math.max(
    currentScale * scale,
    // Ensure that the scale cannot make the child so **small** that it can't fit //Korrigiert von der originalversion
    // inside the boundaries (in either direction).
    math.max(
      widget.allowNonCoveringScreenZoom
          ? widget.minScale
          : (widgetViewport.width / childBoundaryRect.width),
      widget.allowNonCoveringScreenZoom
          ? widget.minScale
          : (widgetViewport.height / childBoundaryRect.height),
    ),
  );
  final double clampedTotalScale = clampDouble(
    totalScale,
    widget.minScale,
    widget.maxScale,
  );
  Vector3 translation = matrix.getTranslation();
  // If smaller than the viewport, set translation to 0
  if (clampedTotalScale <
      (widgetViewport.height / childBoundaryRect.height)) {
    translation.y = 0;
  }
  final double clampedScale = clampedTotalScale / currentScale;
  return matrix.clone()
    ..setTranslation(translation)
    ..scale(clampedScale);
}