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};
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
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 change_cursor: CursorConfig,
}
......
......@@ -38,16 +38,19 @@ impl Plugin for InputPlugin {
}
}
/// Timer for double / triple clicks
#[derive(Resource)]
pub struct ClickTimer(pub Timer);
// TODO: hide this behind #cfg wasm, depends on wasm having own copy/paste fn
/// Crossbeam channel struct for Wasm clipboard data
#[allow(dead_code)]
pub struct WasmPaste {
text: String,
entity: Entity,
}
/// Async channel for receiving from the clipboard in Wasm
#[derive(Resource)]
pub struct WasmPasteAsyncChannel {
pub tx: crossbeam_channel::Sender<WasmPaste>,
......
......@@ -72,14 +72,6 @@ impl Plugin for CosmicEditPlugin {
#[derive(Component)]
pub struct CosmicPrimaryCamera;
#[derive(Default, Clone)]
pub enum CursorConfig {
#[default]
Default,
Events,
None,
}
/// Resource struct that holds configuration options for cosmic fonts.
#[derive(Resource, Clone)]
pub struct CosmicFontConfig {
......
......@@ -7,9 +7,7 @@ use cosmic_text::{Attrs, Edit};
/// ```
/// # use bevy::prelude::*;
/// # use bevy_cosmic_edit::*;
/// #
/// # fn setup(mut commands: Commands) {
/// // Create a new cosmic bundle
/// commands.spawn((CosmicEditBundle {
/// sprite_bundle: SpriteBundle {
/// sprite: Sprite {
......@@ -20,10 +18,9 @@ use cosmic_text::{Attrs, Edit};
/// },
/// ..default()
/// },
/// Placeholder::new("Email", Attrs::new().color(Color::GRAY.to_cosmic()),
/// Placeholder::new("Email", Attrs::new().color(Color::GRAY.to_cosmic())),
/// ));
/// # }
/// #
/// # fn main() {
/// # App::new()
/// # .add_plugins(MinimalPlugins)
......
......@@ -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>) {
if i.just_pressed(KeyCode::Escape) {
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