Commit 8db5f31
authored
Color::srgb requires values in range 0..1 and the ui/relative_cursor_position example used misleading 0..255 range (#20685)
`Color::srgb` requires values in range `0..1` and the
`ui/relative_cursor_position` example uses misleading `0..255` range
# Objective
- To remove misleading range error in UI example (it actually caught me
off-guard when I was learning about Bevy UI)
## Solution
- Scaled data to (approx.) `0..1` range of values via dividing by `255`
with 2 digits precision. This will change the example look, as
previously the example node rendered 100% white.
## Testing
- Run the isolated example, screenshots below
---
## Showcase
- Comparison below:
### Previous version
<img width="671" height="518" alt="image"
src="https://github.com/user-attachments/assets/4825072f-40fe-43d0-a4da-aed2a07b7f15"
/>
### New version
<img width="405" height="410" alt="image"
src="https://github.com/user-attachments/assets/67b97b08-d86f-4d04-871f-845b66bbe3c3"
/>1 parent f3710a3 commit 8db5f31
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
0 commit comments