|
1 |
| -use crate::{ui_transform::UiGlobalTransform, ComputedNode, ComputedNodeTarget, Node, UiStack}; |
| 1 | +use crate::{ |
| 2 | + ui_transform::UiGlobalTransform, ComputedNode, ComputedNodeTarget, Node, OverrideClip, UiStack, |
| 3 | +}; |
2 | 4 | use bevy_ecs::{
|
3 | 5 | change_detection::DetectChangesMut,
|
4 | 6 | entity::{ContainsEntity, Entity},
|
5 | 7 | hierarchy::ChildOf,
|
6 | 8 | prelude::{Component, With},
|
7 |
| - query::QueryData, |
| 9 | + query::{QueryData, Without}, |
8 | 10 | reflect::ReflectComponent,
|
9 | 11 | system::{Local, Query, Res},
|
10 | 12 | };
|
@@ -157,7 +159,7 @@ pub fn ui_focus_system(
|
157 | 159 | ui_stack: Res<UiStack>,
|
158 | 160 | mut node_query: Query<NodeQuery>,
|
159 | 161 | clipping_query: Query<(&ComputedNode, &UiGlobalTransform, &Node)>,
|
160 |
| - child_of_query: Query<&ChildOf>, |
| 162 | + child_of_query: Query<&ChildOf, Without<OverrideClip>>, |
161 | 163 | ) {
|
162 | 164 | let primary_window = primary_window.iter().next();
|
163 | 165 |
|
@@ -325,11 +327,12 @@ pub fn ui_focus_system(
|
325 | 327 | }
|
326 | 328 |
|
327 | 329 | /// Walk up the tree child-to-parent checking that `point` is not clipped by any ancestor node.
|
| 330 | +/// If `entity` has an [`OverrideClip`] component it ignores any inherited clipping and returns true. |
328 | 331 | pub fn clip_check_recursive(
|
329 | 332 | point: Vec2,
|
330 | 333 | entity: Entity,
|
331 | 334 | clipping_query: &Query<'_, '_, (&ComputedNode, &UiGlobalTransform, &Node)>,
|
332 |
| - child_of_query: &Query<&ChildOf>, |
| 335 | + child_of_query: &Query<&ChildOf, Without<OverrideClip>>, |
333 | 336 | ) -> bool {
|
334 | 337 | if let Ok(child_of) = child_of_query.get(entity) {
|
335 | 338 | let parent = child_of.0;
|
|
0 commit comments