Skip to content
Snippets Groups Projects
Unverified Commit 11e8904e authored by sam's avatar sam Committed by GitHub
Browse files

show cursor on readonly widget (#71)

parent c9eb67b0
No related branches found
No related tags found
No related merge requests found
use bevy::{input::mouse::MouseMotion, prelude::*, window::PrimaryWindow}; use bevy::{input::mouse::MouseMotion, prelude::*, window::PrimaryWindow};
use crate::{CosmicEditor, CosmicTextChanged, ReadOnly}; use crate::{CosmicEditor, CosmicTextChanged};
/// For use with custom cursor control; Event is emitted when cursor enters a text widget /// For use with custom cursor control; Event is emitted when cursor enters a text widget
#[derive(Event)] #[derive(Event)]
...@@ -33,13 +33,9 @@ pub fn change_cursor( ...@@ -33,13 +33,9 @@ pub fn change_cursor(
} }
} }
// TODO: Only emit events; If configured to, have a fn to act on the events
pub fn hover_sprites( pub fn hover_sprites(
windows: Query<&Window, With<PrimaryWindow>>, windows: Query<&Window, With<PrimaryWindow>>,
mut cosmic_edit_query: Query< mut cosmic_edit_query: Query<(&mut Sprite, &GlobalTransform), With<CosmicEditor>>,
(&mut Sprite, &GlobalTransform),
(With<CosmicEditor>, Without<ReadOnly>),
>,
camera_q: Query<(&Camera, &GlobalTransform)>, camera_q: Query<(&Camera, &GlobalTransform)>,
mut hovered: Local<bool>, mut hovered: Local<bool>,
mut last_hovered: Local<bool>, mut last_hovered: Local<bool>,
...@@ -76,13 +72,7 @@ pub fn hover_sprites( ...@@ -76,13 +72,7 @@ pub fn hover_sprites(
} }
pub fn hover_ui( pub fn hover_ui(
mut interaction_query: Query< mut interaction_query: Query<&Interaction, (Changed<Interaction>, With<CosmicEditor>)>,
&Interaction,
(
Changed<Interaction>,
(With<CosmicEditor>, Without<ReadOnly>),
),
>,
mut evw_hover_in: EventWriter<TextHoverIn>, mut evw_hover_in: EventWriter<TextHoverIn>,
mut evw_hover_out: EventWriter<TextHoverOut>, mut evw_hover_out: EventWriter<TextHoverOut>,
) { ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment