Skip to content

Commit

Permalink
Clean up deps
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Oct 21, 2023
1 parent c3121fc commit 0d04a1f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
6 changes: 0 additions & 6 deletions Cargo.lock

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

12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
async-channel = "1.9.0"
dioxus = { git = "https://github.com/ealmloff/dioxus", branch = "fix-signals-outside-of-runtime" }
dioxus-web = { git = "https://github.com/ealmloff/dioxus", branch = "fix-signals-outside-of-runtime" }
dioxus-signals = { git = "https://github.com/ealmloff/dioxus", branch = "fix-signals-outside-of-runtime" }
futures = "0.3.28"
interpolation = "0.3.0"
js-sys = "0.3.64"
log = "0.4.20"
dioxus-logger = "0.4.1"
wasm-bindgen = "0.2.87"
web-sys = "0.3.64"
dioxus-use-mounted = { git = "https://github.com/matthunz/dioxus-use-mounted" }
dioxus-spring = { git = "https://github.com/matthunz/dioxus-spring" }
dioxus-resize-observer = { git = "https://github.com/dioxus-community/dioxus-resize-observer" }

[dev-dependencies]
log = "0.4.20"
dioxus-logger = "0.4.1"
12 changes: 8 additions & 4 deletions src/ripple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub fn Ripple<'a>(
cx: Scope<'a>,
onclick: EventHandler<'a, Event<MouseData>>,
children: Element<'a>,
duration: Option<Duration>,
) -> Element<'a> {
let is_pressed = use_state(cx, || false);

Expand All @@ -18,6 +19,9 @@ pub fn Ripple<'a>(

let (spring_ref, value_ref) = use_spring_signal(cx, [0f32; 2]);
let animated_ref = use_mounted(cx);

let duration = duration.unwrap_or(Duration::from_millis(200));

use_animated(cx, animated_ref, value_ref, |[size, opacity]| {
format!(
r"
Expand All @@ -43,20 +47,20 @@ pub fn Ripple<'a>(
cursor: "pointer",
onmounted: move |event| container_ref.onmounted(event),
onmousedown: move |_| {
spring_ref.animate([size as _, 1.], Duration::from_millis(200));
spring_ref.animate([size as _, 1.], duration);
is_pressed.set(true)
},
onmouseup: move |event| {
if **is_pressed {
spring_ref.queue([size as _, 0.], Duration::from_millis(200));
spring_ref.queue([0., 0.], Duration::from_millis(0));
spring_ref.queue([size as _, 0.], duration);
spring_ref.queue([0., 0.], Duration::ZERO);
onclick.call(event);
is_pressed.set(false)
}
},
onmouseleave: move |_| {
if **is_pressed {
spring_ref.animate([0., 0.], Duration::from_millis(200));
spring_ref.animate([0., 0.], duration);
is_pressed.set(false)
}
},
Expand Down
4 changes: 0 additions & 4 deletions src/tab_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,11 @@ fn TabRowItem<'a>(
let sizes = *sizes;
dioxus_signals::use_effect(cx, move || {
if let Some(content_rect) = &*resize.read() {
log::info!("{} {}", content_rect.left(), content_rect.width());

sizes
.write()
.entry(idx)
.and_modify(|rect| *rect = content_rect.clone())
.or_insert(content_rect.clone());

log::info!("update");
}
});

Expand Down

0 comments on commit 0d04a1f

Please sign in to comment.