-
Notifications
You must be signed in to change notification settings - Fork 21
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
Clipping issues with layer+reflow+scrolling dropdown #149
Comments
reprod: use yakui::widgets::{Layer, Scrollable};
use yakui::{button, column, reflow, use_state, widgets::Pad, Alignment, Dim2};
use yakui::{constrained, row, Constraints, Vec2};
use yakui_core::Pivot;
pub fn run() {
let open = use_state(|| false);
let options = ["Hello", "World", "Foobar", "Foobar", "Foobar", "Foobar"];
let selected = use_state(|| 0);
row(|| {
button("bbbbbbbbbbbbb");
constrained(Constraints::loose(Vec2::new(f32::INFINITY, 100.0)), || {
Scrollable::vertical().show(|| {
column(|| {
if button(options[selected.get()]).clicked {
open.modify(|x| !x);
}
if open.get() {
Pad::ZERO.show(|| {
Layer::new().show(|| {
reflow(Alignment::BOTTOM_LEFT, Pivot::TOP_LEFT, Dim2::ZERO, || {
constrained(
Constraints::loose(Vec2::new(f32::INFINITY, 80.0)),
|| {
Scrollable::vertical().show(|| {
column(|| {
let current = selected.get();
for (i, option) in options.iter().enumerate() {
if i != current {
if button(*option).clicked {
selected.set(i);
open.set(false);
}
}
}
});
});
},
);
});
});
});
}
});
});
});
});
}
fn main() {
bootstrap::start(run as fn());
} |
simpler version: pub fn run() {
let open = use_state(|| false);
let options = ["Hello", "World", "Foobar", "Foobar", "Foobar", "Foobar"];
let selected = use_state(|| 0);
row(|| {
button("abcde");
Scrollable::vertical().show(|| {
reflow(Alignment::BOTTOM_LEFT, Pivot::TOP_LEFT, Dim2::ZERO, || {
constrained(Constraints::loose(Vec2::new(f32::INFINITY, 80.0)), || {
Scrollable::vertical().show(|| {
column(|| {
let current = selected.get();
for (i, option) in options.iter().enumerate() {
if i != current {
if button(*option).clicked {
selected.set(i);
open.set(false);
}
}
}
});
});
});
});
});
});
}
fn main() {
bootstrap::start(run as fn());
} |
We figured out the issue.
Because the clip rects inherently don't intersect correctly (it being on a new layer, reflowed, etc...) this breaks the clipping |
@LPGhatguy We're not sure how to fix this, do you have any ideas? |
…n pushing new clip rect
…n pushing new clip rect, more sophisticated example for dropdown to test SecondHalfGames#149
…n pushing new clip rect, more sophisticated example for dropdown to test SecondHalfGames#149
…n pushing new clip rect, more sophisticated example for dropdown to test SecondHalfGames#149
…n pushing new clip rect, more sophisticated example for dropdown to test SecondHalfGames#149
We've successfully implemented a fix for this, after the discussions on rust gamedev discord! please look at our fork for if it's a suitable fix, then we'll extract it into a separate PR |
The expected strategy of a layer+reflow+scrolling container should work. If not, there's a bug in one of those components that we gotta look at
The text was updated successfully, but these errors were encountered: