Skip to content

Commit

Permalink
try to fix SecondHalfGames#149 (clipping issue)
Browse files Browse the repository at this point in the history
  • Loading branch information
msparkles committed Apr 12, 2024
1 parent b4df755 commit d2c264d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions crates/yakui-core/src/paint/paint_dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ impl PaintDom {
.expect("an active layer is required to call add_mesh");

let current_clip = self.clip_stack.last().copied();
dbg!(current_clip);
let call = match layer.calls.last_mut() {
Some(PaintCall::Yakui(call))
if call.texture == texture_id
Expand Down
25 changes: 15 additions & 10 deletions crates/yakui/examples/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
#![allow(clippy::collapsible_if)]

use yakui::widgets::Layer;
use yakui::widgets::{Layer, Scrollable};
use yakui::{align, button, column, reflow, use_state, widgets::Pad, Alignment, Dim2};
use yakui::{constrained, Constraints, Vec2};
use yakui_core::Pivot;

pub fn run() {
Expand All @@ -27,16 +28,20 @@ pub fn run() {
Pad::ZERO.show(|| {
Layer::new().show(|| {
reflow(Alignment::BOTTOM_LEFT, Pivot::TOP_LEFT, Dim2::ZERO, || {
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);
constrained(Constraints::loose(Vec2::new(100.0, 20.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);
}
}
}
}
}
});
});
});
});
});
Expand Down

0 comments on commit d2c264d

Please sign in to comment.