switch to WidgetRef

This commit is contained in:
2025-12-07 15:18:39 -05:00
parent f9376eb6d4
commit 089ed08c16
6 changed files with 32 additions and 32 deletions

View File

@@ -11,7 +11,7 @@ use openworm::net::{ClientMsg, NetClientMsg};
pub const SIZE: u32 = 20;
pub fn main_view(client: &mut Client, ui: &mut Ui) -> WidgetId {
pub fn main_view(client: &mut Client, ui: &mut Ui) -> WidgetRef {
let ClientState::LoggedIn(state) = &mut client.state else {
panic!("we ain't logged in buh");
};
@@ -75,13 +75,13 @@ pub fn msg_panel(ui: &mut Ui, state: &mut LoggedIn) -> impl WidgetRet + use<> {
let ClientState::LoggedIn(state) = &mut ctx.state.state else {
panic!("we ain't logged in buh");
};
let content = ctx.ui.text(ctx.id).take();
let content = ctx.widget.get_mut().take();
let msg = NetClientMsg {
content: content.clone(),
};
state.network.send(ClientMsg::SendMsg(msg.clone()));
let msg = msg_widget(&state.username, &content).add(ctx.ui);
ctx.ui[&msg_area].children.push(msg.any());
msg_area.get_mut().children.push(msg.any());
})
.pad(15)
.attr::<Selector>(send_text)