Skip to content

Commit

Permalink
Draw edit button without table::fit
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfoodK committed Oct 16, 2024
1 parent c5e8c5e commit 4f00a96
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions luda-editor/new-client/src/episode_editor/speaker_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,16 @@ impl Component for SpeakerSelector<'_> {
if let Some(speakers) = speakers.as_ref() {
for (speaker_id, name) in speakers {
items.push(table::fixed(16.px(), |_wh, _ctx| {}));
items.push(table::fit(table::FitAlign::LeftTop, |ctx| {
ctx.add(button::TextButtonFit {
height: wh.height,
items.push(table::ratio(1, |wh, ctx| {
ctx.add(button::TextButton {
rect: wh.to_rect(),
text: name.as_ref().unwrap_or(&"N/A".to_string()),
text_color: Color::WHITE,
stroke_color: Color::WHITE,
stroke_width: 1.px(),
fill_color: Color::BLACK,
side_padding: 8.px(),
mouse_buttons: vec![MouseButton::Left],
on_mouse_up_in: &|_event| {
on_mouse_up_in: |_event| {
select_speaker(speaker_id);
},
});
Expand All @@ -105,17 +104,17 @@ impl Component for SpeakerSelector<'_> {
}

items.push(table::ratio(1, |_wh, _ctx| {}));
items.push(table::fit(table::FitAlign::LeftTop, |ctx| {
ctx.add(button::TextButtonFit {
height: wh.height,
// TODO: Fix table::fit
items.push(table::fixed(96.px(), |wh, ctx| {
ctx.add(button::TextButton {
rect: wh.to_rect(),
text: "설정",
text_color: Color::WHITE,
stroke_color: Color::WHITE,
stroke_width: 1.px(),
fill_color: Color::BLACK,
side_padding: 8.px(),
mouse_buttons: vec![MouseButton::Left],
on_mouse_up_in: &|_event| todo!(),
on_mouse_up_in: |_event| todo!(),
});
}));

Expand Down

0 comments on commit 4f00a96

Please sign in to comment.