From 643500bbdf1a169db1bcdcb8e971334037274d38 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 15 Sep 2021 14:49:13 +0700 Subject: Use `Option` to encode empty text case in hit test methods --- graphics/src/backend.rs | 2 +- graphics/src/widget/text.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'graphics') diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs index 656949c5..7e0af2cc 100644 --- a/graphics/src/backend.rs +++ b/graphics/src/backend.rs @@ -60,7 +60,7 @@ pub trait Text { bounds: Size, point: Point, nearest_only: bool, - ) -> text::Hit; + ) -> Option; } /// A graphics backend that supports image rendering. diff --git a/graphics/src/widget/text.rs b/graphics/src/widget/text.rs index c235f254..645c8414 100644 --- a/graphics/src/widget/text.rs +++ b/graphics/src/widget/text.rs @@ -43,7 +43,7 @@ where bounds: Size, point: Point, nearest_only: bool, - ) -> text::Hit { + ) -> Option { self.backend().hit_test( content, size, -- cgit