transformForRender property
The actual transform you should use for rendering
Implementation
@protected
Matrix4 get transformForRender {
if (!widget.allowNonCoveringScreenZoom || childKey.currentContext == null) {
inNonCoveringZoomHorizontal = false;
inNonCoveringZoomVertical = false;
return transformationController!.value;
}
Matrix4 transform = transformationController!.value;
Rect boundaryRect = childBoundaryRect;
Rect viewport = widgetViewport;
double scale = transform.getScaleOnZAxis();
inNonCoveringZoomHorizontal = boundaryRect.width * scale < viewport.width;
inNonCoveringZoomVertical = boundaryRect.height * scale < viewport.height;
if (inNonCoveringZoomHorizontal || inNonCoveringZoomVertical) {
transform = transform.clone(); //dont change the transformation controller
transform.scale(1 / scale);
Vector3 translation = transform.getTranslation();
if (inNonCoveringZoomHorizontal) {
translation.x = getNonCoveringZoomHorizontalTranslation(scale);
}
if (inNonCoveringZoomVertical) {
translation.y = getNonCoveringZoomVerticalTranslation(scale);
}
transform.setTranslation(translation);
transform.scale(scale);
}
return transform;
}