bevy/crates
James Lucas 0f1eebed38
Fixing sprite pixel space point computation for sprites with zero custom_size (#19907)
# Objective

Current implementation of `Sprite::compute_pixel_space_point` always
returns the sprite centre as an `Ok` point when the `custom_size` is set
to `Vec2::ZERO`. This leads to unexpected behaviour. For example, it
causes these sprites to block all interactions with other sprites in the
picking backend (under default settings). This small PR:

- Fixes sprite pixel space point computation for sprites with zero
custom_size
- Resolves issue #19880.

## Solution

We handle the zero custom_size case explicitly and return
`Err(point_relative_to_sprite_center)` instead of
`Ok(point_relative_to_texture)`.

## Testing

Implemented a new test for zero custom_size sprites within the
`bevy_sprite::sprite` module. Also verified that the example from issue
#19880 is behaving as expected.

No further testing is required.

- How can other people (reviewers) test your changes? Is there anything
specific they need to know?

Can run the simple application example from the linked issue. Or
evaluate the implemented test.

---------

Co-authored-by: James Lucas <jalucas@nvidia.com>
2025-07-03 17:43:32 +00:00
..
bevy_a11y Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_animation Prevent AnimationGraph from serializing AssetIds. (#19615) 2025-06-30 22:26:05 +00:00
bevy_anti_aliasing Use RenderStartup in bevy_anti_aliasing. (#19897) 2025-07-02 22:38:44 +00:00
bevy_app Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_asset Add test that repros #11111 (different loader settings produce same asset) (#19094) 2025-07-02 22:39:04 +00:00
bevy_audio Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_color Ugrade to wgpu version 25.0 (#19563) 2025-06-26 19:41:47 +00:00
bevy_core_pipeline Make render and compute pipeline descriptors defaultable. (#19903) 2025-07-02 18:47:27 +00:00
bevy_core_widgets Newtyped ScrollPosition (#19881) 2025-07-01 17:41:48 +00:00
bevy_derive Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_dev_tools Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_diagnostic updating: very very minorly (#19827) 2025-06-26 21:48:20 +00:00
bevy_dylib Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_ecs Implement MapEntities for arrays, HashMap, BTreeMap, IndexMap (#19908) 2025-07-02 14:50:55 +00:00
bevy_encase_derive Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_feathers Feathers toggle switches. (#19928) 2025-07-03 01:09:31 +00:00
bevy_gilrs Add newlines before impl blocks (#19746) 2025-06-22 23:07:02 +00:00
bevy_gizmos Use RenderStartup in bevy_gizmos. (#19898) 2025-07-02 20:38:37 +00:00
bevy_gltf Nudge users into migrating to new default glTF coordinate conversion (#19816) 2025-06-28 18:35:41 +00:00
bevy_image optimize ktx2 level data concatenation (#19845) 2025-06-29 21:59:56 +00:00
bevy_input bevy_input: build warnings without bevy_reflect (#19862) 2025-06-29 17:13:43 +00:00
bevy_input_focus Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_internal Light Textures (#18031) 2025-06-30 21:56:17 +00:00
bevy_log Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_macro_utils Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_math Add unit structs for each ease function (#18739) 2025-07-02 19:18:20 +00:00
bevy_mesh Ugrade to wgpu version 25.0 (#19563) 2025-06-26 19:41:47 +00:00
bevy_mikktspace Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_pbr fix skin uniform buffer size (#19888) 2025-07-02 20:06:27 +00:00
bevy_picking Upstream raycasting UVs (#19791) 2025-06-24 18:10:59 +00:00
bevy_platform bevy_platform: clippy without default features (#19860) 2025-06-29 17:12:57 +00:00
bevy_ptr Add newlines before impl blocks (#19746) 2025-06-22 23:07:02 +00:00
bevy_reflect bevy_reflect: streamline generated FromReflect::from_reflect (#19906) 2025-07-02 14:59:20 +00:00
bevy_remote Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_render Make render and compute pipeline descriptors defaultable. (#19903) 2025-07-02 18:47:27 +00:00
bevy_scene Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_solari Make render and compute pipeline descriptors defaultable. (#19903) 2025-07-02 18:47:27 +00:00
bevy_sprite Fixing sprite pixel space point computation for sprites with zero custom_size (#19907) 2025-07-03 17:43:32 +00:00
bevy_state Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_tasks Update derive_more requirement from 1 to 2 (#19671) 2025-06-24 11:13:04 +00:00
bevy_text Replace Handle::Weak with Handle::Uuid. (#19896) 2025-07-02 14:40:35 +00:00
bevy_time Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_transform Update derive_more requirement from 1 to 2 (#19671) 2025-06-24 11:13:04 +00:00
bevy_ui Make render and compute pipeline descriptors defaultable. (#19903) 2025-07-02 18:47:27 +00:00
bevy_utils bevy_utils: clippy without debug feature enabled (#19861) 2025-06-29 17:13:27 +00:00
bevy_window bevy_window: fix compilation without default features (#19870) 2025-06-30 20:51:52 +00:00
bevy_winit bevy_winit: fix compile and clippy on wasm (#19869) 2025-06-29 21:30:28 +00:00