Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T02:33:16.030Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

scrollable.rs

73 lines · 2.3 KB · rust
1#![cfg_attr(target_family = "wasm", no_main)]
2
3use gpui::{App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, size};
4use gpui_platform::application;
5
6struct Scrollable {}
7
8impl Render for Scrollable {
9    fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
10        div()
11            .size_full()
12            .id("vertical")
13            .p_4()
14            .overflow_scroll()
15            .bg(gpui::white())
16            .child("Example for test 2 way scroll in nested layout")
17            .child(
18                div()
19                    .h(px(5000.))
20                    .border_1()
21                    .border_color(gpui::blue())
22                    .bg(gpui::blue().opacity(0.05))
23                    .p_4()
24                    .child(
25                        div()
26                            .mb_5()
27                            .w_full()
28                            .id("horizontal")
29                            .overflow_scroll()
30                            .child(
31                                div()
32                                    .w(px(2000.))
33                                    .h(px(150.))
34                                    .bg(gpui::green().opacity(0.1))
35                                    .hover(|this| this.bg(gpui::green().opacity(0.2)))
36                                    .border_1()
37                                    .border_color(gpui::green())
38                                    .p_4()
39                                    .child("Scroll Horizontal"),
40                            ),
41                    )
42                    .child("Scroll Vertical"),
43            )
44    }
45}
46
47fn run_example() {
48    application().run(|cx: &mut App| {
49        let bounds = Bounds::centered(None, size(px(500.), px(500.0)), cx);
50        cx.open_window(
51            WindowOptions {
52                window_bounds: Some(WindowBounds::Windowed(bounds)),
53                ..Default::default()
54            },
55            |_, cx| cx.new(|_| Scrollable {}),
56        )
57        .unwrap();
58        cx.activate(true);
59    });
60}
61
62#[cfg(not(target_family = "wasm"))]
63fn main() {
64    run_example();
65}
66
67#[cfg(target_family = "wasm")]
68#[wasm_bindgen::prelude::wasm_bindgen(start)]
69pub fn start() {
70    gpui_platform::web_init();
71    run_example();
72}
73
Served at tenant.openagents/omega Member data and write actions are omitted.