Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI
fix: remove scroll easing
Preetham Pemmasani3a4ecdd1a5e9
diff --git a/bindings/rust/blenderui/examples/site_chat.rs b/bindings/rust/blenderui/examples/site_chat.rsindex 0a8b332..2f01dcb 100644--- a/bindings/rust/blenderui/examples/site_chat.rs+++ b/bindings/rust/blenderui/examples/site_chat.rs@@ -26,9 +26,6 @@ impl Render for Page {(s.source.len(), p.first().zip(p.last()).map(|(a, b)| (a.item, b.item)))};let shown = shown.map_or_else(String::new, |(a, b)| format!("showing {a}..{b}"));- if std::env::var_os("CHAT_TRACE").is_some() {- eprintln!("{:?} {shown}", std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_millis() % 100_000).unwrap_or(0));- }html().styled().size_full().child(body().m_0().size_full().child(// fills the window: the list takes what the status bar leavesdiff --git a/bindings/rust/blenderui/src/vlist/element.rs b/bindings/rust/blenderui/src/vlist/element.rsindex c4e69ff..647779d 100644--- a/bindings/rust/blenderui/src/vlist/element.rs+++ b/bindings/rust/blenderui/src/vlist/element.rs@@ -103,10 +103,9 @@ impl<S: ItemSource, P: Measurer + ItemPainter> IntoElement for VariableList<S, P.on_mouse_up(MouseButton::Left, move |_, _, cx| up.update(cx, |s, _| s.pointer_up())).on_scroll_wheel(move |e, w, cx| {wh.update(cx, |s, _| {- // a notched wheel gives whole lines; a touchpad fractions of one+ // Blender's wheel scrolls at once, a notch or a touchpad fraction alike: no easinglet lines = f64::from(e.delta);- if std::env::var_os("CHAT_TRACE").is_some() { eprintln!("{:?} WHEEL {lines}", std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_millis() % 100_000).unwrap_or(0)); } // TEMP-TRACE- s.view.wheel(-lines * WHEEL_NOTCH_PX, lines.fract() != 0.0);+ s.view.wheel(-lines * WHEEL_NOTCH_PX, true);});w.request_animation_frame();})@@ -131,7 +130,7 @@ impl<S: ItemSource, P: Measurer + ItemPainter> IntoElement for VariableList<S, Pconst LINE_PX: f64 = 19.0;/// One wheel notch, in px: several messages per notch.-const WHEEL_NOTCH_PX: f64 = 1000.0;+const WHEEL_NOTCH_PX: f64 = 57.0;fn state_pointer_down<S: ItemSource, P: Measurer + ItemPainter>(state: Entity<ListState<S, P>>,diff --git a/bindings/rust/blenderui/tests/vlist.rs b/bindings/rust/blenderui/tests/vlist.rsindex 206ab09..9900851 100644--- a/bindings/rust/blenderui/tests/vlist.rs+++ b/bindings/rust/blenderui/tests/vlist.rs@@ -129,22 +129,3 @@ fn the_background_follows_the_theme() {};assert_ne!(shot("light"), shot("dark"));}--#[test]-fn probe_wheel_latency() {- run("dark", |cx| {- let (id, chat) = open(cx, 1_000_000);- frame(cx, id);- let first = |cx: &App| chat.read(cx).view.placed().first().map(|p| p.item).unwrap();- println!("start first={}", first(cx));- for notch in 0..4 {- cx.simulate_scroll(id, 300.0, 200.0, 3);- for f in 0..30 {- std::thread::sleep(std::time::Duration::from_millis(16));- let t = std::time::Instant::now();- cx.draw(id);- println!("notch {notch} frame {f}: first={} draw {:.2} ms", first(cx), t.elapsed().as_secs_f64() * 1000.0);- }- }- });-}