Skip to content

Can someone explain me why FlexDirection::Column is required for Overflow::scroll_y()? #18868

Answered by Maksych
Maksych asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, after I watch example https://bevyengine.org/examples/ui-user-interface/scroll/ I understand how it works.
Need only specify overflow on container node.
And that's all.

Updated:

use bevy::{
    color::palettes::tailwind, picking::pointer::PointerId, platform::collections::HashSet,
    prelude::*,
};

fn spawn_camera(mut commands: Commands) {
    commands.spawn(Camera2d);
}

fn spawn_ui(mut commands: Commands) {
    commands
        .spawn(Node {
            width: Val::Percent(100.),
            height: Val::Percent(100.),
            overflow: Overflow::scroll_y(),
            flex_wrap: FlexWrap::Wrap,
            row_gap: Val::Px(10.),
            ..Default::default()
        })

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Maksych
Comment options

Answer selected by Maksych
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants