Skip to content
Open
21 changes: 21 additions & 0 deletions _release-content/migration-guides/cursor_module_to_bevy_picking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "`cursor` module moved from `bevy_feathers` to `bevy_picking`"
pull_requests: [25294]
---

The `bevy_feathers` `cursor` module, containing `EntityCursor`, `DefaultCursor`, `OverrideCursor`, and `CursorIconPlugin` have been moved
from `bevy_feathers::cursor` to `bevy_picking::cursor`.

The `custom_cursor` feature has also been moved to `bevy_picking`.

Before:

```rust
use bevy_feathers::cursor::{CursorIconPlugin, DefaultCursor, EntityCursor, OverrideCursor};
```

After:

```rust
use bevy_picking::cursor::{CursorIconPlugin, DefaultCursor, EntityCursor, OverrideCursor};
```
5 changes: 3 additions & 2 deletions crates/bevy_feathers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ bevy_input_focus = { path = "../bevy_input_focus", version = "0.20.0-dev", featu
] }
bevy_log = { path = "../bevy_log", version = "0.20.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.20.0-dev" }
bevy_picking = { path = "../bevy_picking", version = "0.20.0-dev" }
bevy_picking = { path = "../bevy_picking", version = "0.20.0-dev", features = [
"custom_cursor",
] }
bevy_shader = { path = "../bevy_shader", version = "0.20.0-dev" }
bevy_platform = { path = "../bevy_platform", version = "0.20.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.20.0-dev" }
Expand All @@ -43,7 +45,6 @@ accesskit = "0.24"

[features]
default = []
custom_cursor = ["bevy_window/custom_cursor"]
webgl = []
webgpu = []

Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use bevy_ecs::{
system::{Commands, Query},
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::prelude::*;
use bevy_text::FontWeight;
Expand All @@ -21,7 +21,6 @@ use bevy_ui_widgets::Button;

use crate::{
constants::{fonts, size},
cursor::EntityCursor,
focus::FocusIndicator,
font_styles::InheritableFont,
rounded_corners::RoundedCorners,
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use bevy_ecs::{
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_math::Rot2;
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::prelude::*;
use bevy_text::FontWeight;
Expand All @@ -28,7 +28,6 @@ use bevy_ui_widgets::{ActivateOnPress, Checkbox};

use crate::{
constants::{fonts, size},
cursor::EntityCursor,
focus::FocusIndicator,
font_styles::InheritableFont,
theme::{InheritableThemeTextColor, ThemeBackgroundColor, ThemeBorderColor},
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_feathers/src/controls/color_plane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use bevy_ecs::{
};
use bevy_math::{Vec2, Vec3};
use bevy_picking::{
cursor::EntityCursor,
events::{Cancel, Drag, DragEnd, DragStart, Pointer, Press},
Pickable,
};
Expand All @@ -30,7 +31,7 @@ use bevy_ui::{
use bevy_ui_render::{prelude::UiMaterial, ui_material::MaterialNode, UiMaterialPlugin};
use bevy_ui_widgets::ValueChange;

use crate::{cursor::EntityCursor, palette, theme::ThemeBackgroundColor, tokens};
use crate::{palette, theme::ThemeBackgroundColor, tokens};

/// A "color plane" widget, which is a 2d picker that allows selecting two
/// components of a color space.
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/color_slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use bevy_ecs::{
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_log::warn_once;
use bevy_picking::PickingSystems;
use bevy_picking::{cursor::EntityCursor, PickingSystems};
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::Reflect;
use bevy_scene::prelude::*;
Expand All @@ -33,7 +33,6 @@ use bevy_ui_widgets::{
use crate::{
alpha_pattern::{AlphaPattern, AlphaPatternMaterial},
controls::{FeathersSlider, FeathersTextInput, ToggleSwitchSlide},
cursor::EntityCursor,
focus::FocusIndicator,
palette,
rounded_corners::RoundedCorners,
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_feathers/src/controls/disclosure_toggle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bevy_ecs::{
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_math::Rot2;
use bevy_picking::PickingSystems;
use bevy_picking::{cursor::EntityCursor, PickingSystems};
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::Reflect;
use bevy_scene::{bsn, Scene, SceneComponent};
Expand All @@ -21,8 +21,8 @@ use bevy_ui_widgets::Checkbox;
use bevy_window::SystemCursorIcon;

use crate::{
constants::icons, cursor::EntityCursor, display::icon, focus::FocusIndicator,
theme::InheritableThemeTextColor, tokens,
constants::icons, display::icon, focus::FocusIndicator, theme::InheritableThemeTextColor,
tokens,
};

/// A toggle button which shows a chevron that points either right or down, used to expand or
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/listview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy_ecs::{
use bevy_input_focus::{
tab_navigation::TabIndex, InputFocus, InputFocusSystems, InputFocusVisible,
};
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::{bsn, bsn_list, Scene, SceneComponent, SceneList};
use bevy_text::{FontSize, FontWeight};
Expand All @@ -30,7 +30,6 @@ use bevy_ui_widgets::{
use crate::{
constants::{fonts, size},
controls::{FeathersScrollbar, ScrollbarGutter},
cursor::EntityCursor,
font_styles::InheritableFont,
theme::{InheritableThemeTextColor, ThemeBackgroundColor, ThemeBorderColor},
tokens,
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy_ecs::{
template::template,
};
use bevy_log::{info, warn};
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::Reflect;
use bevy_scene::prelude::*;
Expand All @@ -32,7 +32,6 @@ use bevy_ui_widgets::{
use crate::{
constants::{fonts, icons, size},
controls::{ButtonVariant, FeathersButton, FeathersToolButton},
cursor::EntityCursor,
display::icon,
font_styles::InheritableFont,
rounded_corners::RoundedCorners,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_feathers/src/controls/number_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use bevy_input_focus::{FocusGained, FocusLost, FocusedInput, InputFocus, InputFo
use bevy_log::{warn, warn_once};
use bevy_math::ops;
use bevy_picking::{
cursor::EntityCursor,
events::{Cancel, Drag, DragEnd, DragStart, Pointer, Press, Release},
hover::Hovered,
pointer::PointerButton,
Expand All @@ -45,7 +46,6 @@ use bevy_ui_widgets::ValueChange;
use crate::{
constants::{fonts, size},
controls::{FeathersSlider, FeathersTextInput, FeathersTextInputContainer},
cursor::EntityCursor,
rounded_corners::RoundedCorners,
theme::{
SurfaceLevel, ThemeBackgroundColor, ThemeBorderColor, ThemeContext, ThemeTextColor,
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use bevy_ecs::{
system::{Commands, Query},
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::prelude::*;
use bevy_text::FontWeight;
Expand All @@ -26,7 +26,6 @@ use bevy_ui_widgets::{ActivateOnPress, RadioButton};

use crate::{
constants::{fonts, size},
cursor::EntityCursor,
focus::FocusIndicator,
font_styles::InheritableFont,
theme::{InheritableThemeTextColor, ThemeBackgroundColor, ThemeBorderColor},
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_feathers/src/controls/scrollbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ use bevy_ecs::{
template::EntityTemplate,
};
use bevy_math::Vec2;
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::prelude::*;
use bevy_ui::{px, BorderRadius, ComputedNode, Node, UiSystems, Val};
use bevy_ui_widgets::{ControlOrientation, Scrollbar, ScrollbarDragState, ScrollbarThumb};

use crate::{cursor::EntityCursor, theme::ThemeBackgroundColor, tokens};
use crate::{theme::ThemeBackgroundColor, tokens};

/// A scrollbar. The `target` property should point to an entity whose
/// [`ScrollPosition`](bevy_ui::ScrollPosition) will be synchronized with the scrollbar.
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use bevy_ecs::{
system::{Commands, Query, Res},
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::prelude::*;
use bevy_text::FontWeight;
Expand All @@ -31,7 +31,6 @@ use bevy_ui_widgets::{

use crate::{
constants::{fonts, size},
cursor::EntityCursor,
display::caption,
focus::FocusIndicator,
font_styles::InheritableFont,
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use bevy_ecs::{
template::template,
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_picking::PickingSystems;
use bevy_picking::{cursor::EntityCursor, PickingSystems};
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::Reflect;
use bevy_scene::prelude::*;
Expand All @@ -26,7 +26,6 @@ use bevy_ui_widgets::TextInput;

use crate::{
constants::{fonts, size},
cursor::EntityCursor,
focus::FocusWithinIndicator,
font_styles::InheritableFont,
theme::{
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/controls/toggle_switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy_ecs::{
world::Mut,
};
use bevy_input_focus::tab_navigation::TabIndex;
use bevy_picking::{hover::Hovered, PickingSystems};
use bevy_picking::{cursor::EntityCursor, hover::Hovered, PickingSystems};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_scene::prelude::*;
use bevy_ui::{
Expand All @@ -27,7 +27,6 @@ use bevy_ui_widgets::{ActivateOnPress, Checkbox};
use crate::{
constants::size,
controls::ColorSliderThumb,
cursor::EntityCursor,
focus::FocusIndicator,
theme::{ThemeBackgroundColor, ThemeBorderColor},
tokens,
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_feathers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ use bevy_app::{
use bevy_asset::embedded_asset;
use bevy_ecs::{query::With, schedule::IntoScheduleConfigs};
use bevy_input_focus::tab_navigation::TabNavigationPlugin;
use bevy_picking::cursor::{CursorIconPlugin, DefaultCursor, EntityCursor};
use bevy_text::{TextColor, TextFont};
use bevy_ui::{AccessibilityUiSystems, UiSystems};
use bevy_ui_render::{ImageNodeAssetChangedSystems, UiMaterialPlugin};

use crate::{
alpha_pattern::{AlphaPatternMaterial, AlphaPatternResource},
controls::ControlsPlugin,
cursor::{CursorIconPlugin, DefaultCursor, EntityCursor},
theme::{ThemeContext, ThemedText, UiTheme},
};

mod alpha_pattern;
pub mod constants;
pub mod containers;
pub mod controls;
pub mod cursor;
pub mod dark_theme;
pub mod display;
pub mod focus;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ reflect_documentation = ["bevy_reflect/reflect_documentation"]
custom_cursor = [
"bevy_window/custom_cursor",
"bevy_winit/custom_cursor",
"bevy_feathers?/custom_cursor",
"bevy_picking/custom_cursor",
]

# Experimental support for nodes that are ignored for UI layouting
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_picking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license = "MIT OR Apache-2.0"
[features]
# Provides a mesh picking backend
mesh_picking = ["dep:bevy_mesh", "dep:crossbeam-channel"]
custom_cursor = ["bevy_window/custom_cursor"]

[dependencies]
# bevy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Provides a way to automatically set the mouse cursor based on hovered entity.
use crate::{hover::HoverMap, pointer::PointerId, PickingSystems};
use bevy_app::{App, Plugin, PreUpdate};
use bevy_derive::Deref;
use bevy_ecs::{
Expand All @@ -12,7 +13,6 @@ use bevy_ecs::{
system::{Commands, Query, Res},
template::FromTemplate,
};
use bevy_picking::{hover::HoverMap, pointer::PointerId, PickingSystems};
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
#[cfg(feature = "custom_cursor")]
use bevy_window::CustomCursor;
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_picking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ extern crate alloc;
use core::time::Duration;

pub mod backend;
pub mod cursor;
pub mod events;
pub mod hover;
pub mod input;
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/widgets/feathers_gallery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use bevy::{
constants::{fonts, icons},
containers::*,
controls::*,
cursor::{EntityCursor, OverrideCursor},
dark_theme::create_dark_theme,
display::{caption, icon, label, label_dim, label_small},
font_styles::InheritableFont,
Expand All @@ -17,6 +16,7 @@ use bevy::{
tokens, FeathersPlugins,
},
input_focus::{tab_navigation::TabGroup, AutoFocus, InputFocus},
picking::cursor::{EntityCursor, OverrideCursor},
prelude::*,
text::{EditableText, TextEdit, TextEditChange},
ui::{Checked, InteractionDisabled, Selected},
Expand Down