From e43858ffad18cecb1f29ff0c3e23f116688711d5 Mon Sep 17 00:00:00 2001 From: shenjingfs Date: Sat, 7 Oct 2023 11:39:37 +0800 Subject: [PATCH] Adjust isTemplateWithinBounds so that annotation can be fully displayed --- .../lib/src/common/utils/helper.dart | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/syncfusion_flutter_charts/lib/src/common/utils/helper.dart b/packages/syncfusion_flutter_charts/lib/src/common/utils/helper.dart index eab76760e..d117c7ec0 100644 --- a/packages/syncfusion_flutter_charts/lib/src/common/utils/helper.dart +++ b/packages/syncfusion_flutter_charts/lib/src/common/utils/helper.dart @@ -1193,8 +1193,9 @@ String addEllipse(String text, int maxLength, String ellipse, {bool? isRtl}) { } /// To check template is within bounds. -bool isTemplateWithinBounds(Rect bounds, Rect templateRect) => - templateRect.left >= bounds.left && - templateRect.left + templateRect.width <= bounds.left + bounds.width && - templateRect.top >= bounds.top && - templateRect.top + templateRect.height <= bounds.top + bounds.height; +/// +/// Latest Behavior – When a single pixel of the annotation exceeds the plot area, the annotation is hidden. +/// Modify: If two rectangles overlap, show and don't clip the annotation, otherwise hide it +/// https://github.com/syncfusion/flutter-widgets/issues/804 +/// https://www.syncfusion.com/feedback/37191/only-clip-the-portion-of-the-annotation-that-extends-beyond-the-plot-area +bool isTemplateWithinBounds(Rect bounds, Rect templateRect) => bounds.overlaps(templateRect);