From b97a9e976e7fc10fb16abf82bf3e11e14b8ae388 Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Sat, 23 Nov 2024 00:48:31 +0100 Subject: [PATCH] Remove unused code --- masonry/src/testing/helper_widgets.rs | 2 +- masonry/src/widget/widget.rs | 32 --------------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/masonry/src/testing/helper_widgets.rs b/masonry/src/testing/helper_widgets.rs index 0a8aabaf9..29040e817 100644 --- a/masonry/src/testing/helper_widgets.rs +++ b/masonry/src/testing/helper_widgets.rs @@ -16,7 +16,7 @@ use accesskit::{Node, Role}; use smallvec::SmallVec; use tracing::trace_span; use vello::Scene; -use widget::widget::{get_child_at_pos, AsDynWidget as _}; +use widget::widget::AsDynWidget as _; use widget::WidgetRef; use crate::event::{PointerEvent, TextEvent}; diff --git a/masonry/src/widget/widget.rs b/masonry/src/widget/widget.rs index ac758983b..2e19c07c6 100644 --- a/masonry/src/widget/widget.rs +++ b/masonry/src/widget/widget.rs @@ -327,38 +327,6 @@ pub trait Widget: AsAny + AsDynWidget { } } -pub(crate) fn get_child_at_pos<'c>( - widget: &(impl Widget + ?Sized), - ctx: QueryCtx<'c>, - pos: Point, -) -> Option> { - let local_pos = ctx.widget_state.window_transform.inverse() * pos; - if !ctx - .clip_path() - .map_or(true, |clip| clip.contains(local_pos)) - { - return None; - } - - // Assumes `Self::children_ids` is in increasing "z-order", picking the last child in case - // of overlapping children. - for child_id in widget.children_ids().iter().rev() { - let child = ctx.get(*child_id); - let local_pos = child.ctx().widget_state.window_transform.inverse() * pos; - - // The position must be inside the child's layout and inside the child's clip path (if - // any). - if !child.ctx().is_stashed() - && child.ctx().accepts_pointer_interaction() - && child.ctx().size().to_rect().contains(local_pos) - { - return Some(child); - } - } - - None -} - /// Marker trait for Widgets whose parents can get a raw mutable reference to them. /// /// "Raw mut" means using a mutable reference (eg `&mut MyWidget`) to the data