Skip to content
Snippets Groups Projects
Commit 7a1922f3 authored by sam edelsten's avatar sam edelsten
Browse files

fix doctests, add missing docs

parent 3343978a
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,18 @@ use bevy::{input::mouse::MouseMotion, prelude::*, window::PrimaryWindow}; ...@@ -8,6 +8,18 @@ use bevy::{input::mouse::MouseMotion, prelude::*, window::PrimaryWindow};
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)] #[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
pub struct CursorSet; pub struct CursorSet;
/// Config enum for mouse cursor events.
#[derive(Default, Clone)]
pub enum CursorConfig {
/// Emit [`TextHoverIn`] and [`TextHoverOut`] events and change mouse cursor on hover
#[default]
Default,
/// Emit [`TextHoverIn`] and [`TextHoverOut`] events, but do not change the cursor
Events,
/// Ignore mouse events
None,
}
pub(crate) struct CursorPlugin { pub(crate) struct CursorPlugin {
pub change_cursor: CursorConfig, pub change_cursor: CursorConfig,
} }
......
...@@ -38,16 +38,19 @@ impl Plugin for InputPlugin { ...@@ -38,16 +38,19 @@ impl Plugin for InputPlugin {
} }
} }
/// Timer for double / triple clicks
#[derive(Resource)] #[derive(Resource)]
pub struct ClickTimer(pub Timer); pub struct ClickTimer(pub Timer);
// TODO: hide this behind #cfg wasm, depends on wasm having own copy/paste fn // TODO: hide this behind #cfg wasm, depends on wasm having own copy/paste fn
/// Crossbeam channel struct for Wasm clipboard data
#[allow(dead_code)] #[allow(dead_code)]
pub struct WasmPaste { pub struct WasmPaste {
text: String, text: String,
entity: Entity, entity: Entity,
} }
/// Async channel for receiving from the clipboard in Wasm
#[derive(Resource)] #[derive(Resource)]
pub struct WasmPasteAsyncChannel { pub struct WasmPasteAsyncChannel {
pub tx: crossbeam_channel::Sender<WasmPaste>, pub tx: crossbeam_channel::Sender<WasmPaste>,
......
...@@ -72,14 +72,6 @@ impl Plugin for CosmicEditPlugin { ...@@ -72,14 +72,6 @@ impl Plugin for CosmicEditPlugin {
#[derive(Component)] #[derive(Component)]
pub struct CosmicPrimaryCamera; pub struct CosmicPrimaryCamera;
#[derive(Default, Clone)]
pub enum CursorConfig {
#[default]
Default,
Events,
None,
}
/// Resource struct that holds configuration options for cosmic fonts. /// Resource struct that holds configuration options for cosmic fonts.
#[derive(Resource, Clone)] #[derive(Resource, Clone)]
pub struct CosmicFontConfig { pub struct CosmicFontConfig {
......
...@@ -7,9 +7,7 @@ use cosmic_text::{Attrs, Edit}; ...@@ -7,9 +7,7 @@ use cosmic_text::{Attrs, Edit};
/// ``` /// ```
/// # use bevy::prelude::*; /// # use bevy::prelude::*;
/// # use bevy_cosmic_edit::*; /// # use bevy_cosmic_edit::*;
/// #
/// # fn setup(mut commands: Commands) { /// # fn setup(mut commands: Commands) {
/// // Create a new cosmic bundle
/// commands.spawn((CosmicEditBundle { /// commands.spawn((CosmicEditBundle {
/// sprite_bundle: SpriteBundle { /// sprite_bundle: SpriteBundle {
/// sprite: Sprite { /// sprite: Sprite {
...@@ -20,10 +18,9 @@ use cosmic_text::{Attrs, Edit}; ...@@ -20,10 +18,9 @@ use cosmic_text::{Attrs, Edit};
/// }, /// },
/// ..default() /// ..default()
/// }, /// },
/// Placeholder::new("Email", Attrs::new().color(Color::GRAY.to_cosmic()), /// Placeholder::new("Email", Attrs::new().color(Color::GRAY.to_cosmic())),
/// )); /// ));
/// # } /// # }
/// #
/// # fn main() { /// # fn main() {
/// # App::new() /// # App::new()
/// # .add_plugins(MinimalPlugins) /// # .add_plugins(MinimalPlugins)
......
...@@ -18,7 +18,7 @@ impl ColorExtras for Color { ...@@ -18,7 +18,7 @@ impl ColorExtras for Color {
} }
} }
/// System to unfocus editors when [Esc] is pressed /// System to unfocus editors when \[Esc\] is pressed
pub fn deselect_editor_on_esc(i: Res<ButtonInput<KeyCode>>, mut focus: ResMut<FocusedWidget>) { pub fn deselect_editor_on_esc(i: Res<ButtonInput<KeyCode>>, mut focus: ResMut<FocusedWidget>) {
if i.just_pressed(KeyCode::Escape) { if i.just_pressed(KeyCode::Escape) {
focus.0 = None; focus.0 = None;
......
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