Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Cosmic Edit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Bevy Cosmic Edit
Commits
7a1922f3
Commit
7a1922f3
authored
11 months ago
by
sam edelsten
Browse files
Options
Downloads
Patches
Plain Diff
fix doctests, add missing docs
parent
3343978a
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/cursor.rs
+12
-0
12 additions, 0 deletions
src/cursor.rs
src/input.rs
+3
-0
3 additions, 0 deletions
src/input.rs
src/lib.rs
+0
-8
0 additions, 8 deletions
src/lib.rs
src/placeholder.rs
+1
-4
1 addition, 4 deletions
src/placeholder.rs
src/util.rs
+1
-1
1 addition, 1 deletion
src/util.rs
with
17 additions
and
13 deletions
src/cursor.rs
+
12
−
0
View file @
7a1922f3
...
@@ -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
,
}
}
...
...
This diff is collapsed.
Click to expand it.
src/input.rs
+
3
−
0
View file @
7a1922f3
...
@@ -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
>
,
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
0
−
8
View file @
7a1922f3
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
src/placeholder.rs
+
1
−
4
View file @
7a1922f3
...
@@ -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)
...
...
This diff is collapsed.
Click to expand it.
src/util.rs
+
1
−
1
View file @
7a1922f3
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment