Skip to content

Commit d2c264d

Browse files
committed
try to fix SecondHalfGames#149 (clipping issue)
1 parent b4df755 commit d2c264d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

crates/yakui-core/src/paint/paint_dom.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ impl PaintDom {
185185
.expect("an active layer is required to call add_mesh");
186186

187187
let current_clip = self.clip_stack.last().copied();
188+
dbg!(current_clip);
188189
let call = match layer.calls.last_mut() {
189190
Some(PaintCall::Yakui(call))
190191
if call.texture == texture_id

crates/yakui/examples/dropdown.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
44
#![allow(clippy::collapsible_if)]
55

6-
use yakui::widgets::Layer;
6+
use yakui::widgets::{Layer, Scrollable};
77
use yakui::{align, button, column, reflow, use_state, widgets::Pad, Alignment, Dim2};
8+
use yakui::{constrained, Constraints, Vec2};
89
use yakui_core::Pivot;
910

1011
pub fn run() {
@@ -27,16 +28,20 @@ pub fn run() {
2728
Pad::ZERO.show(|| {
2829
Layer::new().show(|| {
2930
reflow(Alignment::BOTTOM_LEFT, Pivot::TOP_LEFT, Dim2::ZERO, || {
30-
column(|| {
31-
let current = selected.get();
32-
for (i, option) in options.iter().enumerate() {
33-
if i != current {
34-
if button(*option).clicked {
35-
selected.set(i);
36-
open.set(false);
31+
constrained(Constraints::loose(Vec2::new(100.0, 20.0)), || {
32+
Scrollable::vertical().show(|| {
33+
column(|| {
34+
let current = selected.get();
35+
for (i, option) in options.iter().enumerate() {
36+
if i != current {
37+
if button(*option).clicked {
38+
selected.set(i);
39+
open.set(false);
40+
}
41+
}
3742
}
38-
}
39-
}
43+
});
44+
});
4045
});
4146
});
4247
});

0 commit comments

Comments
 (0)