Skip to content

Commit

Permalink
feat: clipboard and selectable text
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Mar 20, 2024
1 parent 45d7210 commit a6b8e08
Show file tree
Hide file tree
Showing 24 changed files with 849 additions and 167 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = [ "--cfg=web_sys_unstable_apis" ]
83 changes: 81 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ tokio = { version = "1.0", default-features = false, features = ["macros", "rt"]
arrayvec = "0.7"
sync_wrapper = "1.0"
smallvec = "1.0"
arboard = "3.0"

bytemuck = { version = "1.13", features = ["derive"] }
winit = "0.29"
Expand Down Expand Up @@ -75,7 +76,7 @@ gloo-timers = "0.3"
web-time = "1.0"
wasm-bindgen-futures = "0.4"
wasm-bindgen = "0.2"
web-sys = "0.3"
web-sys = { version = "0.3", features = ["Clipboard"] }
tracing-tree = "0.3"

[dependencies]
Expand Down
4 changes: 4 additions & 0 deletions violet-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ tokio.workspace = true
gloo-timers.workspace = true
wasm-bindgen-futures.workspace = true
cosmic-text = { workspace = true, features = ["wasm-web"] }
web-sys.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
arboard.workspace = true
3 changes: 3 additions & 0 deletions violet-core/src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use palette::Srgba;
use crate::{
assets::Asset,
layout::{Layout, SizeResolver},
stored::UntypedHandle,
text::{LayoutGlyphs, TextSegment, Wrap},
unit::Unit,
Edges, Frame, Rect,
Expand Down Expand Up @@ -97,6 +98,8 @@ component! {
pub(crate) atoms,

pub on_animation_frame: OnAnimationFrame,

pub handles: Vec<UntypedHandle>,
}

pub type OnAnimationFrame = Box<dyn FnMut(&Frame, &EntityRef, Duration) + Send + Sync>;
Loading

0 comments on commit a6b8e08

Please sign in to comment.