diff options
| author | 2023-02-22 21:23:04 +0100 | |
|---|---|---|
| committer | 2023-02-22 21:23:04 +0100 | |
| commit | 4f41927155e7d4bc38497b0e298a0b23ccea6ca1 (patch) | |
| tree | 70b7dbc1afdc62dfeaf42f0c62e8f4c01e407729 /native/src/user_interface.rs | |
| parent | a35d6d2e4d59f71309f31c87ea5150959d639185 (diff) | |
| parent | 666f3cd143047e49a010f0c97eabc7136f92aa35 (diff) | |
| download | iced-4f41927155e7d4bc38497b0e298a0b23ccea6ca1.tar.gz iced-4f41927155e7d4bc38497b0e298a0b23ccea6ca1.tar.bz2 iced-4f41927155e7d4bc38497b0e298a0b23ccea6ca1.zip | |
Merge branch 'iced-rs:master' into master
Diffstat (limited to 'native/src/user_interface.rs')
| -rw-r--r-- | native/src/user_interface.rs | 35 | 
1 files changed, 18 insertions, 17 deletions
| diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 80dece21..68ccda55 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -21,8 +21,8 @@ use crate::{  /// The [`integration_opengl`] & [`integration_wgpu`] examples use a  /// [`UserInterface`] to integrate Iced in an existing graphical application.  /// -/// [`integration_opengl`]: https://github.com/iced-rs/iced/tree/0.7/examples/integration_opengl -/// [`integration_wgpu`]: https://github.com/iced-rs/iced/tree/0.7/examples/integration_wgpu +/// [`integration_opengl`]: https://github.com/iced-rs/iced/tree/0.8/examples/integration_opengl +/// [`integration_wgpu`]: https://github.com/iced-rs/iced/tree/0.8/examples/integration_wgpu  #[allow(missing_debug_implementations)]  pub struct UserInterface<'a, Message, Renderer> {      root: Element<'a, Message, Renderer>, @@ -263,16 +263,16 @@ where                  }              } -            let base_cursor = if manual_overlay +            let base_cursor = manual_overlay                  .as_ref() -                .unwrap() -                .is_over(Layout::new(&layout), cursor_position) -            { -                // TODO: Type-safe cursor availability -                Point::new(-1.0, -1.0) -            } else { -                cursor_position -            }; +                .filter(|overlay| { +                    overlay.is_over(Layout::new(&layout), cursor_position) +                }) +                .map(|_| { +                    // TODO: Type-safe cursor availability +                    Point::new(-1.0, -1.0) +                }) +                .unwrap_or(cursor_position);              self.overlay = Some(layout); @@ -440,12 +440,13 @@ where                  overlay.layout(renderer, self.bounds, Vector::ZERO)              }); -            let new_cursor_position = -                if overlay_layout.bounds().contains(cursor_position) { -                    Point::new(-1.0, -1.0) -                } else { -                    cursor_position -                }; +            let new_cursor_position = if overlay +                .is_over(Layout::new(&overlay_layout), cursor_position) +            { +                Point::new(-1.0, -1.0) +            } else { +                cursor_position +            };              self.overlay = Some(overlay_layout); | 
