From 6c1855b46c81746af7abe7b8f56e7da5fd684f0c Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Mon, 16 Dec 2024 17:34:24 +1300 Subject: [PATCH] Fix hit testing text inputs --- packages/blitz-dom/src/node.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/blitz-dom/src/node.rs b/packages/blitz-dom/src/node.rs index cc492e6f..bd611bd2 100644 --- a/packages/blitz-dom/src/node.rs +++ b/packages/blitz-dom/src/node.rs @@ -988,22 +988,22 @@ impl Node { let x = x - self.final_layout.location.x + self.scroll_offset.x as f32; let y = y - self.final_layout.location.y + self.scroll_offset.y as f32; + let size = self.final_layout.size; + let matches_self = !(x < 0.0 + || x > size.width + self.scroll_offset.x as f32 + || y < 0.0 + || y > size.height + self.scroll_offset.y as f32); + let content_size = self.final_layout.content_size; let matches_content = !(x < 0.0 || x > content_size.width + self.scroll_offset.x as f32 || y < 0.0 || y > content_size.height + self.scroll_offset.y as f32); - if !matches_content { + if !matches_self && !matches_content { return None; } - let size = self.final_layout.size; - let matches_self = !(x < 0.0 - || x > size.width + self.scroll_offset.x as f32 - || y < 0.0 - || y > size.height + self.scroll_offset.y as f32); - // Call `.hit()` on each child in turn. If any return `Some` then return that value. Else return `Some(self.id). self.paint_children .borrow()