Skip to content

Regression in 0.3.14: UI layouts incorrectly when parent is smaller than child #534

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

Open
Noxime opened this issue Dec 14, 2022 · 1 comment · May be fixed by #941
Open

Regression in 0.3.14: UI layouts incorrectly when parent is smaller than child #534

Noxime opened this issue Dec 14, 2022 · 1 comment · May be fixed by #941

Comments

@Noxime
Copy link

Noxime commented Dec 14, 2022

Regressed when moving from 0.3.13 to 0.3.14. When an UI element (here a Group is smaller or equal to its parent size, it moves down by its height.

Minimum working example:

fn conf() -> Conf {
    Conf {
        window_width: 800,
        ..Default::default()
    }
}

#[macroquad::main(conf)]
async fn main() {
    loop {
        clear_background(GREEN);
        
        root_ui().group(hash!(), vec2(800.0, 200.0), |ui| {
            ui.label(vec2(20.0, 30.0), "Hello world");
        });

        next_frame().await
    }
}
Version Larger Smaller
0.3.13 image < image >
0.3.14 - 0.3.25, master #50c8feb image image

Discovered in Noxime/steamworks-rs#113

Noxime added a commit to Noxime/steamworks-rs that referenced this issue Dec 14, 2022
Versions 0.3.14 - 0.3.25 have a UI layouting regression: not-fl3/macroquad#534
Also previous version of 0.3.8 was too old for clipboard API
@zachs18
Copy link

zachs18 commented Apr 6, 2025

This appears to have regressed in ecbb72c, and still affects 0.4.x.

use macroquad::prelude::*;
use macroquad::ui::{hash, root_ui};

fn conf() -> Conf {
    Conf {
        window_width: 800,
        ..Default::default()
    }
}

#[macroquad::main(conf)]
async fn main() {
    loop {
        clear_background(GREEN);
        
        root_ui().group(hash!(), vec2(800.0, 200.0), |ui| {
            ui.label(vec2(20.0, 30.0), "Hello world");
        });

        next_frame().await
    }
}
[package]
name = "macroquad-mwe"
version = "0.1.0"
edition = "2021"

[dependencies.macroquad]
git = "https://github.com/not-fl3/macroquad"
# last good commit
#rev = "1dcc721dfec8817584b191e7a0c5942c6b6fe029"
# first regressed commit
rev = "ecbb72c6e6782f0be4d9b13b47eeb9168ff5fed2"

[dependencies]
# newer versions don't work on Rust 1.60.0
libc = "=0.2.100"
bumpalo = "=3.4.0"

Tested with Rust version 1.60.0 (newer versions panic on UB in old versions of dependencies).

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.

2 participants