Skip to content

Commit 3d04eeb

Browse files
Allow Outline's to have negative offset values (#23835)
# Objective Allow negative outline offset values ## Solution Instead of clamping outline offsets to equal or above zero, clamp them to equal or above the length of the node's shorter side. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
1 parent dc70b2e commit 3d04eeb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • crates/bevy_ui/src/layout

crates/bevy_ui/src/layout/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,9 @@ pub fn ui_layout_system(
298298
target_size,
299299
)
300300
.unwrap_or(0.)
301-
.max(0.);
301+
// Clamp outline offsets to at least the length of the node's shorter side
302+
// Negative offset outlines can be useful to create thing like in-set focus indicators
303+
.max(-0.5 * node.size.min_element());
302304
}
303305

304306
node.bypass_change_detection().scrollbar_size =

0 commit comments

Comments
 (0)