bevy/crates
Michel van der Hulst 6ce7ce208e Change UI coordinate system to have origin at top left corner (#6000)
# Objective
Fixes #5572

## Solution

Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down.

After that I'm trying to fix all issues, that pop up:
- interaction expected the "old" position
- images and text were displayed upside-down
- baseline of text was based on the top of the glyph instead of bottom

... probably a lot more.

---

Result when running examples:
<details>
    <summary>Button example</summary>

main branch:
![button main](https://user-images.githubusercontent.com/4232644/190856087-61dd1d98-42b5-4238-bd97-149744ddfeba.png)
this pr:
![button pr](https://user-images.githubusercontent.com/4232644/190856097-3f4bc97a-ed15-4e97-b7f1-2b2dd6bb8b14.png)

</details>

<details>
    <summary>Text example</summary>

m
![text main](https://user-images.githubusercontent.com/4232644/192142831-4cf19aa1-f49a-485e-af7b-374d6f5c396c.png)
ain branch: 


this pr:
![text pr fixed](https://user-images.githubusercontent.com/4232644/192142829-c433db3b-32e1-4ee8-b493-0b4a4d9c8e70.png)


</details>

<details>
    <summary>Text debug example</summary>

main branch:
![text_debug main](https://user-images.githubusercontent.com/4232644/192142822-940aefa6-e502-410b-8da4-5570f77b5df2.png)

this pr:
![text_debug pr fixed](https://user-images.githubusercontent.com/4232644/194547010-8c968f5c-5a71-4ffc-871d-790c06d48016.png)

</details>

<details>
    <summary>Transparency UI example</summary>

main branch:
![transparency_ui main](https://user-images.githubusercontent.com/4232644/190856172-328c60fe-3622-4598-97d5-2f1595db13b3.png)


this pr:
![transperency_ui pr](https://user-images.githubusercontent.com/4232644/190856179-a2dafb99-41ea-45a9-9dd6-400fa3ef24b9.png)

</details>

<details>
    <summary>UI example</summary>

**ui example**
main branch:
![ui main](https://user-images.githubusercontent.com/4232644/192142812-e20ba31a-6841-46d9-a785-4198cf22dc99.png)

this pr:
![ui pr fixed](https://user-images.githubusercontent.com/4232644/192142788-cc0b74e0-7710-4faa-b5a2-60270a5da77c.png)

</details>

## Changelog
UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down.

## Migration Guide
All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap)
System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left
2022-10-11 12:51:44 +00:00
..
bevy_animation Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_app Adding Debug implementations for App, Stage, Schedule, Query, QueryState, etc. (#6214) 2022-10-10 20:59:38 +00:00
bevy_asset Reflect Default for ComputedVisibility and Handle<T> (#6187) 2022-10-06 19:31:47 +00:00
bevy_audio Update rodio requirement from 0.15 to 0.16 (#6020) 2022-09-19 13:56:56 +00:00
bevy_core Fixes Camera not being serializable due to missing registrations in core functionality. (#6170) 2022-10-10 16:34:22 +00:00
bevy_core_pipeline Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_diagnostic add globals to mesh view bind group (#5409) 2022-09-28 04:20:27 +00:00
bevy_dylib Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_dynamic_plugin Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_ecs Adding Debug implementations for App, Stage, Schedule, Query, QueryState, etc. (#6214) 2022-10-10 20:59:38 +00:00
bevy_ecs_compile_fail_tests Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
bevy_encase_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gilrs Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_gltf Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
bevy_hierarchy Fix RemoveChildren command (#6192) 2022-10-10 23:40:32 +00:00
bevy_input Make TouchInput and ForceTouch serializable (#6191) 2022-10-10 23:59:27 +00:00
bevy_internal fix #6062 incorrect links for render module docs (#6099) 2022-09-28 21:02:26 +00:00
bevy_log Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_macro_utils Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_math Add Camera::viewport_to_world (#6126) 2022-10-05 22:16:26 +00:00
bevy_mikktspace Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_pbr remove mandatory mesh attributes (#6127) 2022-10-10 17:58:15 +00:00
bevy_ptr Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_reflect Impl Reflect for PathBuf and OsString (#6193) 2022-10-08 17:02:21 +00:00
bevy_render use bevy default texture format if the surface is not yet available (#6233) 2022-10-11 12:32:03 +00:00
bevy_scene scenes: simplify return type of iter_instance_entities (#5994) 2022-10-10 23:09:08 +00:00
bevy_sprite Add globals struct to mesh2d (#6222) 2022-10-10 19:23:43 +00:00
bevy_tasks Nested spawns on scope (#4466) 2022-09-28 01:59:10 +00:00
bevy_text Change UI coordinate system to have origin at top left corner (#6000) 2022-10-11 12:51:44 +00:00
bevy_time Fix doc for Timer::percent_left (#6198) 2022-10-08 14:51:21 +00:00
bevy_transform Remove Transform::apply_non_uniform_scale (#6133) 2022-10-10 16:50:18 +00:00
bevy_ui Change UI coordinate system to have origin at top left corner (#6000) 2022-10-11 12:51:44 +00:00
bevy_utils Remove Sync bound from Local (#5483) 2022-09-12 04:15:55 +00:00
bevy_window Make bevy_window and bevy_input events serializable (#6180) 2022-10-06 13:14:23 +00:00
bevy_winit Change UI coordinate system to have origin at top left corner (#6000) 2022-10-11 12:51:44 +00:00