matrix property

Matrix4 get matrix

The scale for a Transform aligned to Alignment.center; apply offsetX with a FractionalTranslation.

Never returns an exact identity: a sub-pixel translation keeps the TransformLayer mounted, matching DraggableIndicatorPhysics.

Implementation

Matrix4 get matrix {
  if ((scaleX - 1).abs() < 1e-4 && (scaleY - 1).abs() < 1e-4) {
    return Matrix4.identity()..translateByDouble(0.0001, 0.0, 0.0, 1.0);
  }
  return Matrix4.diagonal3Values(scaleX, scaleY, 1.0);
}