fix: avoid crash on update_cursor_icon (#7)
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
- Fixed so that webview can detect pointers correctly even if it is not the root entity.
|
- Fixed so that the webview can detect pointers correctly even if it is not the root entity.
|
||||||
|
- Avoid a crash when updating the cursor icon
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
|
|||||||
@@ -22,17 +22,15 @@ pub(crate) struct SystemCursorIconSender(Sender<SystemCursorIcon>);
|
|||||||
pub(crate) struct SystemCursorIconReceiver(pub(crate) Receiver<SystemCursorIcon>);
|
pub(crate) struct SystemCursorIconReceiver(pub(crate) Receiver<SystemCursorIcon>);
|
||||||
|
|
||||||
fn update_cursor_icon(
|
fn update_cursor_icon(
|
||||||
par_commands: ParallelCommands,
|
mut commands: Commands,
|
||||||
cursor_icon_receiver: Res<SystemCursorIconReceiver>,
|
cursor_icon_receiver: Res<SystemCursorIconReceiver>,
|
||||||
windows: Query<Entity>,
|
windows: Query<Entity>,
|
||||||
) {
|
) {
|
||||||
while let Ok(cursor_icon) = cursor_icon_receiver.0.try_recv() {
|
while let Ok(cursor_icon) = cursor_icon_receiver.0.try_recv() {
|
||||||
windows.par_iter().for_each(|window| {
|
windows.iter().for_each(|window| {
|
||||||
par_commands.command_scope(|mut commands| {
|
|
||||||
commands
|
commands
|
||||||
.entity(window)
|
.entity(window)
|
||||||
.insert(CursorIcon::System(cursor_icon));
|
.insert(CursorIcon::System(cursor_icon));
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user