Remove Core prefix from remaining UI widget components (#23938)

# Objective

This prefix was ruled unhelpful, and we previously removed it from most
of our types.

We missed a few apparently (spotted in #23924).

## Solution

Find and replace + update the migration guide.
This commit is contained in:
Alice Cecile
2026-04-22 12:56:27 -07:00
committed by GitHub
parent 3d3d9f35c7
commit 8623d29a7a
7 changed files with 36 additions and 43 deletions
@@ -0,0 +1,12 @@
---
title: "`Core` prefix removed from UI widget components"
pull_requests: [23612, 23938]
---
`CoreScrollbarThumb` has been renamed to `ScrollbarThumb`.
`CoreScrollbarDragState` has been renamed to `ScrollbarDragState`.
`CoreSliderDragState` has been renamed to `SliderDragState`.
Additionally, `ScrollbarThumb` nodes are now laid out after `ui_layout_system` by `update_scrollbar_thumb`. `ScrollbarThumb` entities do
not have a `Node` component. The only layout options are for borders, which can be set using `ScrollbarThumb`'s new
`border` and `border_radius` fields.
@@ -1,10 +0,0 @@
---
title: "CoreScrollbarThumb is now `ScrollbarThumb` and scroll bar thumb layout is updated separately"
pull_requests: [23612]
---
`CoreScrollbarThumb` has been renamed to `ScrollbarThumb`.
`ScrollbarThumb` nodes are now laid out after `ui_layout_system` by `update_scrollbar_thumb`. `ScrollbarThumb` entities do
not have a `Node` component. The only layout options are for borders, which can be set using `ScrollbarThumb`'s new
`border` and `border_radius` fields.
+6 -6
View File
@@ -76,7 +76,7 @@ pub struct Scrollbar {
/// size and scroll position.
#[derive(Component, FromTemplate, Debug, Default)]
#[require(
CoreScrollbarDragState,
ScrollbarDragState,
ComputedNode,
ComputedUiTargetCamera,
ComputedUiRenderTargetInfo,
@@ -119,7 +119,7 @@ impl Scrollbar {
/// inserted on the thumb entity.
#[derive(Component, Default, Reflect)]
#[reflect(Component, Default)]
pub struct CoreScrollbarDragState {
pub struct ScrollbarDragState {
/// Whether the scrollbar is currently being dragged.
pub dragging: bool,
/// The value of the scrollbar when dragging started.
@@ -187,7 +187,7 @@ fn scrollbar_on_pointer_down(
fn scrollbar_on_drag_start(
mut ev: On<Pointer<DragStart>>,
mut q_thumb: Query<(&ChildOf, &mut CoreScrollbarDragState), With<ScrollbarThumb>>,
mut q_thumb: Query<(&ChildOf, &mut ScrollbarDragState), With<ScrollbarThumb>>,
q_scrollbar: Query<&Scrollbar>,
q_scroll_area: Query<&ScrollPosition>,
) {
@@ -207,7 +207,7 @@ fn scrollbar_on_drag_start(
fn scrollbar_on_drag(
mut ev: On<Pointer<Drag>>,
mut q_thumb: Query<(&ChildOf, &mut CoreScrollbarDragState), With<ScrollbarThumb>>,
mut q_thumb: Query<(&ChildOf, &mut ScrollbarDragState), With<ScrollbarThumb>>,
mut q_scrollbar: Query<(&ComputedNode, &Scrollbar)>,
mut q_scroll_pos: Query<(&mut ScrollPosition, &ComputedNode), Without<Scrollbar>>,
ui_scale: Res<UiScale>,
@@ -249,7 +249,7 @@ fn scrollbar_on_drag(
fn scrollbar_on_drag_end(
mut ev: On<Pointer<DragEnd>>,
mut q_thumb: Query<&mut CoreScrollbarDragState, With<ScrollbarThumb>>,
mut q_thumb: Query<&mut ScrollbarDragState, With<ScrollbarThumb>>,
) {
if let Ok(mut drag) = q_thumb.get_mut(ev.entity) {
ev.propagate(false);
@@ -261,7 +261,7 @@ fn scrollbar_on_drag_end(
fn scrollbar_on_drag_cancel(
mut ev: On<Pointer<Cancel>>,
mut q_thumb: Query<&mut CoreScrollbarDragState, With<ScrollbarThumb>>,
mut q_thumb: Query<&mut ScrollbarDragState, With<ScrollbarThumb>>,
) {
if let Ok(mut drag) = q_thumb.get_mut(ev.entity) {
ev.propagate(false);
+6 -10
View File
@@ -96,7 +96,7 @@ pub enum TrackClick {
#[derive(Component, FromTemplate, Debug, Default, Clone)]
#[require(
AccessibilityNode(accesskit::Node::new(Role::Slider)),
CoreSliderDragState,
SliderDragState,
SliderValue,
SliderRange,
SliderStep
@@ -238,7 +238,7 @@ impl SliderPrecision {
/// Component used to manage the state of a slider during dragging.
#[derive(Component, Default, Reflect)]
#[reflect(Component)]
pub struct CoreSliderDragState {
pub struct SliderDragState {
/// Whether the slider is currently being dragged.
pub dragging: bool,
@@ -362,11 +362,7 @@ pub(crate) fn slider_on_pointer_down(
pub(crate) fn slider_on_drag_start(
mut drag_start: On<Pointer<DragStart>>,
mut q_slider: Query<
(
&SliderValue,
&mut CoreSliderDragState,
Has<InteractionDisabled>,
),
(&SliderValue, &mut SliderDragState, Has<InteractionDisabled>),
With<Slider>,
>,
) {
@@ -388,7 +384,7 @@ pub(crate) fn slider_on_drag(
&SliderRange,
Option<&SliderPrecision>,
&UiGlobalTransform,
&CoreSliderDragState,
&SliderDragState,
Has<InteractionDisabled>,
),
With<Slider>,
@@ -432,7 +428,7 @@ pub(crate) fn slider_on_drag_end(
&SliderRange,
Option<&SliderPrecision>,
&UiGlobalTransform,
&mut CoreSliderDragState,
&mut SliderDragState,
Has<InteractionDisabled>,
),
With<Slider>,
@@ -478,7 +474,7 @@ fn emit_slider_drag_value_change(
range: &SliderRange,
precision: Option<&SliderPrecision>,
transform: &UiGlobalTransform,
drag: &CoreSliderDragState,
drag: &SliderDragState,
q_thumb: &Query<&ComputedNode, With<SliderThumb>>,
q_children: &Query<&Children>,
ui_scale: &UiScale,
@@ -5,7 +5,7 @@ use bevy::{
input_focus::tab_navigation::{TabGroup, TabNavigationPlugin},
picking::hover::Hovered,
prelude::*,
ui_widgets::{ControlOrientation, CoreScrollbarDragState, Scrollbar, ScrollbarThumb},
ui_widgets::{ControlOrientation, Scrollbar, ScrollbarDragState, ScrollbarThumb},
};
fn main() {
@@ -159,10 +159,10 @@ fn text_row(caption: &str) -> impl Bundle {
// Update the color of the scrollbar thumb.
fn update_scrollbar_thumb(
mut q_thumb: Query<
(&mut BackgroundColor, &Hovered, &CoreScrollbarDragState),
(&mut BackgroundColor, &Hovered, &ScrollbarDragState),
(
With<ScrollbarThumb>,
Or<(Changed<Hovered>, Changed<CoreScrollbarDragState>)>,
Or<(Changed<Hovered>, Changed<ScrollbarDragState>)>,
),
>,
) {
+6 -11
View File
@@ -18,9 +18,9 @@ use bevy::{
ui_widgets::{
checkbox_self_update, observe,
popover::{Popover, PopoverAlign, PopoverPlacement, PopoverSide},
Activate, Button, Checkbox, CoreSliderDragState, MenuAction, MenuButton, MenuEvent,
MenuItem, MenuPopup, RadioButton, RadioGroup, Slider, SliderRange, SliderThumb,
SliderValue, TrackClick, ValueChange,
Activate, Button, Checkbox, MenuAction, MenuButton, MenuEvent, MenuItem, MenuPopup,
RadioButton, RadioGroup, Slider, SliderDragState, SliderRange, SliderThumb, SliderValue,
TrackClick, ValueChange,
},
};
@@ -453,7 +453,7 @@ fn update_slider_style(
&SliderValue,
&SliderRange,
&Hovered,
&CoreSliderDragState,
&SliderDragState,
Has<InteractionDisabled>,
),
(
@@ -461,7 +461,7 @@ fn update_slider_style(
Changed<SliderValue>,
Changed<SliderRange>,
Changed<Hovered>,
Changed<CoreSliderDragState>,
Changed<SliderDragState>,
Added<InteractionDisabled>,
)>,
With<DemoSlider>,
@@ -484,12 +484,7 @@ fn update_slider_style(
fn update_slider_style2(
sliders: Query<
(
Entity,
&Hovered,
&CoreSliderDragState,
Has<InteractionDisabled>,
),
(Entity, &Hovered, &SliderDragState, Has<InteractionDisabled>),
With<DemoSlider>,
>,
children: Query<&Children>,
+3 -3
View File
@@ -5,7 +5,7 @@ use bevy::{
picking::hover::Hovered,
prelude::*,
ui_widgets::{
observe, slider_self_update, CoreSliderDragState, Slider, SliderRange, SliderThumb,
observe, slider_self_update, Slider, SliderDragState, SliderRange, SliderThumb,
SliderValue, TrackClick,
},
};
@@ -257,14 +257,14 @@ fn update_slider_visuals(
&SliderValue,
&SliderRange,
&Hovered,
&CoreSliderDragState,
&SliderDragState,
Has<VerticalSlider>,
),
(
Or<(
Changed<SliderValue>,
Changed<Hovered>,
Changed<CoreSliderDragState>,
Changed<SliderDragState>,
)>,
With<DemoSlider>,
),