Clip outlines using the local clipping rect. (#17385)
UI node Outlines are clipped using their parent's clipping rect instead of their own. Clip outlines using the UI node's own clipping rect.
This commit is contained in:
parent
9afa86ec9a
commit
85054bb468
@ -5,9 +5,8 @@ mod ui_material_pipeline;
|
|||||||
pub mod ui_texture_slice_pipeline;
|
pub mod ui_texture_slice_pipeline;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
experimental::UiChildren, BackgroundColor, BorderColor, CalculatedClip, ComputedNode,
|
BackgroundColor, BorderColor, CalculatedClip, ComputedNode, DefaultUiCamera, ImageNode,
|
||||||
DefaultUiCamera, ImageNode, Outline, ResolvedBorderRadius, TargetCamera, UiAntiAlias,
|
Outline, ResolvedBorderRadius, TargetCamera, UiAntiAlias, UiBoxShadowSamples,
|
||||||
UiBoxShadowSamples,
|
|
||||||
};
|
};
|
||||||
use bevy_app::prelude::*;
|
use bevy_app::prelude::*;
|
||||||
use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle};
|
use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle};
|
||||||
@ -408,9 +407,7 @@ pub fn extract_uinode_borders(
|
|||||||
AnyOf<(&BorderColor, &Outline)>,
|
AnyOf<(&BorderColor, &Outline)>,
|
||||||
)>,
|
)>,
|
||||||
>,
|
>,
|
||||||
parent_clip_query: Extract<Query<&CalculatedClip>>,
|
|
||||||
mapping: Extract<Query<RenderEntity>>,
|
mapping: Extract<Query<RenderEntity>>,
|
||||||
ui_children: UiChildren,
|
|
||||||
) {
|
) {
|
||||||
let image = AssetId::<Image>::default();
|
let image = AssetId::<Image>::default();
|
||||||
|
|
||||||
@ -479,10 +476,6 @@ pub fn extract_uinode_borders(
|
|||||||
if let Some(outline) = maybe_outline.filter(|outline| !outline.color.is_fully_transparent())
|
if let Some(outline) = maybe_outline.filter(|outline| !outline.color.is_fully_transparent())
|
||||||
{
|
{
|
||||||
let outline_size = computed_node.outlined_node_size();
|
let outline_size = computed_node.outlined_node_size();
|
||||||
let parent_clip = ui_children
|
|
||||||
.get_parent(entity)
|
|
||||||
.and_then(|parent| parent_clip_query.get(parent).ok());
|
|
||||||
|
|
||||||
extracted_uinodes.uinodes.insert(
|
extracted_uinodes.uinodes.insert(
|
||||||
commands.spawn(TemporaryRenderEntity).id(),
|
commands.spawn(TemporaryRenderEntity).id(),
|
||||||
ExtractedUiNode {
|
ExtractedUiNode {
|
||||||
@ -493,7 +486,7 @@ pub fn extract_uinode_borders(
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
image,
|
image,
|
||||||
clip: parent_clip.map(|clip| clip.clip),
|
clip: maybe_clip.map(|clip| clip.clip),
|
||||||
camera_entity: render_camera_entity,
|
camera_entity: render_camera_entity,
|
||||||
item: ExtractedUiItem::Node {
|
item: ExtractedUiItem::Node {
|
||||||
transform: global_transform.compute_matrix(),
|
transform: global_transform.compute_matrix(),
|
||||||
|
Loading…
Reference in New Issue
Block a user