Unverified Commit 324a2168 authored by Tong Mu's avatar Tong Mu Committed by GitHub

Change definition of offset to object (#50157)

parent 26271223
...@@ -30,8 +30,8 @@ class AnnotationEntry<T> { ...@@ -30,8 +30,8 @@ class AnnotationEntry<T> {
/// The annotation object that is found. /// The annotation object that is found.
final T annotation; final T annotation;
/// The target location described by the local coordinate space of the layer /// The target location described by the local coordinate space of the
/// that contains the annotation. /// annotation object.
final Offset localPosition; final Offset localPosition;
@override @override
...@@ -2470,16 +2470,15 @@ class AnnotatedRegionLayer<T> extends ContainerLayer { ...@@ -2470,16 +2470,15 @@ class AnnotatedRegionLayer<T> extends ContainerLayer {
/// met. /// met.
final T value; final T value;
/// The size of an optional clipping rectangle, used to control whether a /// The size of the annotated object.
/// position is contained by the annotation.
/// ///
/// If [size] is provided, then the annotation is only added if the target /// If [size] is provided, then the annotation is found only if the target
/// position is contained by the rectangle formed by [size] and [offset]. /// position is contained by the rectangle formed by [size] and [offset].
/// Otherwise no such restriction is applied, and clipping can only be done by /// Otherwise no such restriction is applied, and clipping can only be done by
/// the ancestor layers. /// the ancestor layers.
final Size size; final Size size;
/// The offset of the optional clipping rectangle that is indicated by [size]. /// The position of the annotated object.
/// ///
/// The [offset] defaults to [Offset.zero] if not provided, and is ignored if /// The [offset] defaults to [Offset.zero] if not provided, and is ignored if
/// [size] is not set. /// [size] is not set.
...@@ -2549,7 +2548,7 @@ class AnnotatedRegionLayer<T> extends ContainerLayer { ...@@ -2549,7 +2548,7 @@ class AnnotatedRegionLayer<T> extends ContainerLayer {
final S typedValue = untypedValue as S; final S typedValue = untypedValue as S;
result.add(AnnotationEntry<S>( result.add(AnnotationEntry<S>(
annotation: typedValue, annotation: typedValue,
localPosition: localPosition, localPosition: localPosition - offset,
)); ));
} }
return isAbsorbed; return isAbsorbed;
......
...@@ -690,7 +690,7 @@ void main() { ...@@ -690,7 +690,7 @@ void main() {
root.findAllAnnotations<int>(position).entries.toList(), root.findAllAnnotations<int>(position).entries.toList(),
_equalToAnnotationResult<int>(<AnnotationEntry<int>>[ _equalToAnnotationResult<int>(<AnnotationEntry<int>>[
const AnnotationEntry<int>(annotation: 2, localPosition: position), const AnnotationEntry<int>(annotation: 2, localPosition: position),
const AnnotationEntry<int>(annotation: 1, localPosition: position), const AnnotationEntry<int>(annotation: 1, localPosition: Offset(10, 10)),
const AnnotationEntry<int>(annotation: 1000, localPosition: position), const AnnotationEntry<int>(annotation: 1000, localPosition: position),
]), ]),
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment