addWithRawTransform method
- required Matrix4? transform,
- required Offset position,
- required BoxHitTest hitTest,
Transforms position
to the local coordinate system of a child for
hit-testing the child.
The actual hit testing of the child needs to be implemented in the
provided hitTest
callback, which is invoked with the transformed
position
as argument.
Unlike addWithPaintTransform, the provided transform
matrix is used
directly to transform position
without any pre-processing.
If transform
is null it will be treated as the identity transform ad
position
is provided to the hitTest
callback as-is.
The function returns the return value of the hitTest
callback.
See also:
- addWithPaintTransform, which accomplishes the same thing, but takes a paint transform matrix.
Implementation
bool addWithRawTransform({
required Matrix4? transform,
required Offset position,
required BoxHitTest hitTest,
}) {
final Offset transformedPosition = transform == null ?
position : MatrixUtils.transformPoint(transform, position);
if (transform != null) {
pushTransform(transform);
}
final bool isHit = hitTest(this, transformedPosition);
if (transform != null) {
popTransform();
}
return isHit;
}