128128//! Bevy provides some backends out of the box, but you can even write your own. It's been
129129//! made as easy as possible intentionally; the `bevy_mod_raycast` backend is 50 lines of code.
130130//!
131- //! #### Focus ([`focus `])
131+ //! #### Hover ([`hover `])
132132//!
133133//! The next step is to use the data from the backends, combine and sort the results, and determine
134- //! what each cursor is hovering over, producing a [`HoverMap`](`crate::focus ::HoverMap`). Note that
134+ //! what each cursor is hovering over, producing a [`HoverMap`](`crate::hover ::HoverMap`). Note that
135135//! just because a pointer is over an entity, it is not necessarily *hovering* that entity. Although
136- //! multiple backends may be reporting that a pointer is hitting an entity, the focus system needs
136+ //! multiple backends may be reporting that a pointer is hitting an entity, the hover system needs
137137//! to determine which entities are actually being hovered by this pointer based on the pick depth,
138138//! order of the backend, and the optional [`PickingBehavior`] component of the entity. In other words,
139139//! if one entity is in front of another, usually only the topmost one will be hovered.
@@ -154,7 +154,7 @@ extern crate alloc;
154154
155155pub mod backend;
156156pub mod events;
157- pub mod focus ;
157+ pub mod hover ;
158158pub mod input;
159159#[ cfg( feature = "bevy_mesh_picking_backend" ) ]
160160pub mod mesh_picking;
@@ -201,9 +201,9 @@ pub struct PickingBehavior {
201201 ///
202202 /// For example, if a pointer is over a UI element, as well as a 3d mesh, backends will report
203203 /// hits for both of these entities. Additionally, the hits will be sorted by the camera order,
204- /// so if the UI is drawing on top of the 3d mesh, the UI will be "above" the mesh. When focus
204+ /// so if the UI is drawing on top of the 3d mesh, the UI will be "above" the mesh. When hovering
205205 /// is computed, the UI element will be checked first to see if it this field is set to block
206- /// lower entities. If it does (default), the focus system will stop there, and only the UI
206+ /// lower entities. If it does (default), the hovering system will stop there, and only the UI
207207 /// element will be marked as hovered. However, if this field is set to `false`, both the UI
208208 /// element *and* the mesh will be marked as hovered.
209209 ///
@@ -257,12 +257,12 @@ pub enum PickSet {
257257 ProcessInput ,
258258 /// Reads inputs and produces [`backend::PointerHits`]s. In the [`PreUpdate`] schedule.
259259 Backend ,
260- /// Reads [`backend::PointerHits`]s, and updates focus , selection, and highlighting states. In
260+ /// Reads [`backend::PointerHits`]s, and updates the hovermap , selection, and highlighting states. In
261261 /// the [`PreUpdate`] schedule.
262- Focus ,
263- /// Runs after all the focus systems are done, before event listeners are triggered. In the
262+ Hover ,
263+ /// Runs after all the [`PickSet::Hover`] systems are done, before event listeners are triggered. In the
264264 /// [`PreUpdate`] schedule.
265- PostFocus ,
265+ PostHover ,
266266 /// Runs after all other picking sets. In the [`PreUpdate`] schedule.
267267 Last ,
268268}
@@ -298,7 +298,7 @@ pub struct PickingPlugin {
298298 /// Enables and disables input collection.
299299 pub is_input_enabled : bool ,
300300 /// Enables and disables updating interaction states of entities.
301- pub is_focus_enabled : bool ,
301+ pub is_hover_enabled : bool ,
302302 /// Enables or disables picking for window entities.
303303 pub is_window_picking_enabled : bool ,
304304}
@@ -309,10 +309,10 @@ impl PickingPlugin {
309309 state. is_input_enabled && state. is_enabled
310310 }
311311
312- /// Whether or not systems updating entities' [`PickingInteraction`](focus ::PickingInteraction)
312+ /// Whether or not systems updating entities' [`PickingInteraction`](hover ::PickingInteraction)
313313 /// component should be running.
314- pub fn focus_should_run ( state : Res < Self > ) -> bool {
315- state. is_focus_enabled && state. is_enabled
314+ pub fn hover_should_run ( state : Res < Self > ) -> bool {
315+ state. is_hover_enabled && state. is_enabled
316316 }
317317
318318 /// Whether or not window entities should receive pick events.
@@ -326,7 +326,7 @@ impl Default for PickingPlugin {
326326 Self {
327327 is_enabled : true ,
328328 is_input_enabled : true ,
329- is_focus_enabled : true ,
329+ is_hover_enabled : true ,
330330 is_window_picking_enabled : true ,
331331 }
332332 }
@@ -370,8 +370,8 @@ impl Plugin for PickingPlugin {
370370 (
371371 PickSet :: ProcessInput . run_if ( Self :: input_should_run) ,
372372 PickSet :: Backend ,
373- PickSet :: Focus . run_if ( Self :: focus_should_run ) ,
374- PickSet :: PostFocus ,
373+ PickSet :: Hover . run_if ( Self :: hover_should_run ) ,
374+ PickSet :: PostHover ,
375375 PickSet :: Last ,
376376 )
377377 . chain ( ) ,
@@ -393,10 +393,10 @@ pub struct InteractionPlugin;
393393impl Plugin for InteractionPlugin {
394394 fn build ( & self , app : & mut App ) {
395395 use events:: * ;
396- use focus :: { update_focus , update_interactions} ;
396+ use hover :: { generate_hovermap , update_interactions} ;
397397
398- app. init_resource :: < focus :: HoverMap > ( )
399- . init_resource :: < focus :: PreviousHoverMap > ( )
398+ app. init_resource :: < hover :: HoverMap > ( )
399+ . init_resource :: < hover :: PreviousHoverMap > ( )
400400 . init_resource :: < PointerState > ( )
401401 . add_event :: < Pointer < Cancel > > ( )
402402 . add_event :: < Pointer < Click > > ( )
@@ -414,9 +414,9 @@ impl Plugin for InteractionPlugin {
414414 . add_event :: < Pointer < Released > > ( )
415415 . add_systems (
416416 PreUpdate ,
417- ( update_focus , update_interactions, pointer_events)
417+ ( generate_hovermap , update_interactions, pointer_events)
418418 . chain ( )
419- . in_set ( PickSet :: Focus ) ,
419+ . in_set ( PickSet :: Hover ) ,
420420 ) ;
421421 }
422422}
0 commit comments