findAllAnnotations<S extends Object> method
- Offset localPosition
Search this layer and its subtree for all annotations of type S
under
the point described by localPosition
.
Returns a result with empty entries if no matching annotations are found.
By default this method calls findAnnotations with onlyFirst: false
and returns the annotations of its result. Prefer overriding
findAnnotations instead of this method, because during an annotation
search, only findAnnotations is recursively called, while custom
behavior in this method is ignored.
About layer annotations
An annotation is an optional object of any type that can be carried with a layer. An annotation can be found at a location as long as the owner layer contains the location and is walked to.
The annotations are searched by first visiting each child recursively, then this layer, resulting in an order from visually front to back. Annotations must meet the given restrictions, such as type and position.
The common way for a value to be found here is by pushing an AnnotatedRegionLayer into the layer tree, or by adding the desired annotation by overriding findAnnotations.
See also:
- find, which is similar but returns the first annotation found at the given position.
- AnnotatedRegionLayer, for placing values in the layer tree.
Implementation
AnnotationResult<S> findAllAnnotations<S extends Object>(Offset localPosition) {
final AnnotationResult<S> result = AnnotationResult<S>();
findAnnotations<S>(result, localPosition, onlyFirst: false);
return result;
}