getScaled method
Implementation
@protected
Matrix4 getScaled(
{double? scale,
Offset? position,
Matrix4? matrixZoomedNeedToApplyFocalPointTracking}) {
Matrix4 newM;
if (scale != null) {
newM = matrixScale(
transformationController!.value,
scale,
);
} else {
newM = matrixZoomedNeedToApplyFocalPointTracking!;
}
if (position != null) {
Offset referenceFocalPoint = transformationController!.toScene(
position,
);
// While scaling, translate such that the user's two fingers stay on
// the same places in the scene. That means that the focal point of
// the scale should be on the same place in the scene before and after
// the scale.
// BUT when the user zooms out of his controllable area, the focal
// point should always be in the middle of the screen so that the
// child stays centered.
final Offset focalPointSceneScaled = newM.toScene(
position,
);
newM = matrixTranslate(
newM,
focalPointSceneScaled - referenceFocalPoint,
);
}
return newM;
}