find<S> method

  1. @override
S find <S>(Offset regionOffset)
override

Returns the value of S that corresponds to the point described by regionOffset.

Returns null if no matching region is found.

The main way for a value to be assigned here is by pushing an AnnotatedRegionLayer into the layer tree.

See also:

Implementation

@override
S find<S>(Offset regionOffset) {
  if (link.leader == null) {
    return showWhenUnlinked ? super.find<S>(regionOffset - unlinkedOffset) : null;
  }
  if (_inverseDirty) {
    _invertedTransform = Matrix4.tryInvert(getLastTransform());
    _inverseDirty = false;
  }
  if (_invertedTransform == null)
    return null;
  final Vector4 vector = Vector4(regionOffset.dx, regionOffset.dy, 0.0, 1.0);
  final Vector4 result = _invertedTransform.transform(vector);
  return super.find<S>(Offset(result[0] - linkedOffset.dx, result[1] - linkedOffset.dy));
}