From 51399f6e893412b9dfcaef9c38869d4d43d771d3 Mon Sep 17 00:00:00 2001 From: zmtzawqlp Date: Mon, 10 May 2021 10:30:23 +0800 Subject: [PATCH] ## 6.0.6 * Fix overflow rect is not right if overflowSelection has no selection(may be empty text). --- CHANGELOG.md | 4 ++++ lib/src/text_overflow_render_mixin.dart | 12 ++++++++++++ pubspec.yaml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7b247c..e12891b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.0.6 + +* Fix overflow rect is not right if overflowSelection has no selection(may be empty text). + ## 6.0.5 * Remove unnecessary assert (assert(textPainter.width >= lastChild!.size.width)) diff --git a/lib/src/text_overflow_render_mixin.dart b/lib/src/text_overflow_render_mixin.dart index 5ee493b..821bc2a 100644 --- a/lib/src/text_overflow_render_mixin.dart +++ b/lib/src/text_overflow_render_mixin.dart @@ -387,6 +387,18 @@ mixin TextOverflowMixin on ExtendedTextSelectionRenderObject { overflowRect.width, _overflowRect!.height); } _overflowRect = _overflowRect!.expandToInclude(overflowRect); + } else { + // out _overflowRect and reach rect + if (rect.left >= _overflowRect!.left || + rect.right <= _overflowRect!.right) { + // see whether in the same line + overflowRect = Rect.fromLTRB(_overflowRect!.left, overflowRect.top, + _overflowRect!.right, overflowRect.bottom); + if (_overflowRect!.overlaps(overflowRect)) { + _overflowRect = _overflowRect!.expandToInclude(overflowRect); + } + go = false; + } } // final Rect temp = getTextRect( diff --git a/pubspec.yaml b/pubspec.yaml index d8a87f0..f67e392 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: extended_text description: Extended official text to build special text like inline image or @somebody quickly,it also support custom background,custom over flow and custom selection toolbar and handles. -version: 6.0.5 +version: 6.0.6 homepage: https://github.com/fluttercandies/extended_text environment: