Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtual_stack within a v_stack get's into an infinite loop #246

Closed
dominikwilkowski opened this issue Jan 2, 2024 · 7 comments · Fixed by #252
Closed

virtual_stack within a v_stack get's into an infinite loop #246

dominikwilkowski opened this issue Jan 2, 2024 · 7 comments · Fixed by #252

Comments

@dominikwilkowski
Copy link
Contributor

dominikwilkowski commented Jan 2, 2024

If you use the widget_gallery example and change the list.rs file to the below code you can reproduce this issue.

use floem::{
    reactive::create_signal,
    view::View,
    views::{
        label, v_stack, virtual_stack, Decorators, VirtualDirection, VirtualItemSize,
    },
};

pub fn virt_list_view() -> impl View {
    let field_list: im::Vector<i32> = (0..25).collect();
    let (dyn_field_list, _set_dyn_field_list) = create_signal(field_list);

    v_stack((
        label(move || "field"),
        label(move || "field"),
        label(move || "field"),
        label(move || "field"),
        label(move || "field"),
        virtual_stack(
            VirtualDirection::Vertical,
            VirtualItemSize::Fixed(Box::new(|| 31.0)),
            move || dyn_field_list.get(),
            move |item| *item,
            move |field| label(move || field).style(|s| s.height(31.0)),
        )
        .style(|s| s.gap(0, 5.0)),
    ))
    .style(|s| s.padding(8.0).width_full())
}

Edit: changed code to work after #248
Edit 2: changed code to work after #251

@jrmoulton
Copy link
Collaborator

jrmoulton commented Jan 2, 2024

331 taffy::compute::compute_node_layout::h45313723ba884378
331 taffy::compute::flexbox::compute::h65bcd4ee7171957c
330 taffy::compute::flexbox::compute_preliminary::hccaabf1de1734bbb
266 taffy::compute::compute_node_layout::h45313723ba884378
265 taffy::compute::flexbox::compute::h65bcd4ee7171957c
265 taffy::compute::flexbox::compute_preliminary::hccaabf1de1734bbb
254 taffy::compute::compute_node_layout::h45313723ba884378
251 taffy::compute::flexbox::compute::h65bcd4ee7171957c
248 taffy::compute::flexbox::compute_preliminary::hccaabf1de1734bbb
170 taffy::compute::compute_node_layout::h45313723ba884378
150 taffy::compute::flexbox::compute::h65bcd4ee7171957c
139 taffy::compute::flexbox::compute_preliminary::hccaabf1de1734bbb
50 taffy::compute::flexbox::compute_preliminary::hccaabf1de1734bbb

This is the a stack trace of the infinite loop as far as I can tell

Introduced here
7f9aff0
#177

@dominikwilkowski dominikwilkowski changed the title virtual_list within a v_stack get's into an infinite loop virtual_stack within a v_stack get's into an infinite loop Jan 3, 2024
@dominikwilkowski
Copy link
Contributor Author

Replacing virtual_stack with the widget virtual_list fixes the issue but now I have to deal with the style opinions of that widget (hover color etc).

@jrmoulton
Copy link
Collaborator

jrmoulton commented Jan 3, 2024

You can disable the default widget styling.

app.window(
    app_logic,
    Some(
        WindowConfig::default()
            .themed(false)                <<<------ This 
            .with_transparent(true)
            .show_titlebar(false)
           
    ),
)
.run();

@dominikwilkowski
Copy link
Contributor Author

Can you do that on a per-widget level?

@jrmoulton
Copy link
Collaborator

You can do style unset for specific properties

s.background(StyleValue::Unset)

but you need to do that for hover/active/etc. individually

@jrmoulton
Copy link
Collaborator

  .class(widgets::TooltipClass, |s| {
      s.background(StyleValue::Unset)
      .hover(|s| s.background(StyleValue::Unset)
  })

@Zoxc
Copy link
Contributor

Zoxc commented Jan 4, 2024

@dominikwilkowski You could also use views::virtual_list (with an extra container to match the widget variant if needed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants