bevy/examples/window
Shane Celis 5157fef84b
Add window drag move and drag resize without decoration example. (#15814)
# Objective

Add an example for the new drag move and drag resize introduced by PR
#15674 and fix #15734.

## Solution

I created an example that allows the user to exercise drag move and drag
resize separately. The user can also choose what direction the resize
works in.

![Screenshot 2024-10-10 at 4 06
43 AM](https://github.com/user-attachments/assets/1da558ab-a80f-49af-8b7d-bb635b0f038f)

### Name

The example is called `window_drag_move`. Happy to have that
bikeshedded.

### Contentious Refactor?

This PR removed the `ResizeDirection` enumeration in favor of using
`CompassOctant` which had the same variants. Perhaps this is
contentious.

### Unsafe?

In PR #15674 I mentioned that `start_drag_move()` and
`start_drag_resize()`'s requirement to only be called in the presence of
a left-click looks like a compiler-unenforceable contract that can cause
intermittent panics when not observed, so perhaps the functions should
be marked them unsafe. **I have not made that change** here since I
didn't see a clear consensus on that.

## Testing

I exercised this on x86 macOS. However, winit for macOS does not support
drag resize. It reports a good error when `start_drag_resize()` is
called. I'd like to see it tested on Windows and Linux.

---

## Showcase

Example window_drag_move shows how to drag or resize a window without
decoration.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-10-15 23:38:35 +00:00
..
clear_color.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
custom_user_event.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
low_power.rs Text Rework cleanup (#15887) 2024-10-15 02:32:34 +00:00
monitor_info.rs Text rework (#15591) 2024-10-09 18:35:36 +00:00
multiple_windows.rs Text rework (#15591) 2024-10-09 18:35:36 +00:00
scale_factor_override.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
screenshot.rs Text rework (#15591) 2024-10-09 18:35:36 +00:00
transparent_window.rs Migrate bevy_sprite to required components (#15489) 2024-10-09 16:17:26 +00:00
window_drag_move.rs Add window drag move and drag resize without decoration example. (#15814) 2024-10-15 23:38:35 +00:00
window_resizing.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
window_settings.rs Fix *most* clippy lints (#15906) 2024-10-14 20:52:35 +00:00