strong & weak widgets
This commit is contained in:
@@ -30,7 +30,7 @@ pub struct DefaultState<AppState> {
|
||||
pub struct UiState {
|
||||
pub renderer: UiRenderer,
|
||||
pub input: Input,
|
||||
pub focus: Option<WidgetHandle<TextEdit>>,
|
||||
pub focus: Option<WidgetView<TextEdit>>,
|
||||
pub clipboard: Clipboard,
|
||||
pub window: Arc<Window>,
|
||||
pub ime: usize,
|
||||
@@ -91,7 +91,7 @@ impl<State: DefaultAppState> AppState for DefaultState<State> {
|
||||
|
||||
let input_changed = ui_state.input.event(&event);
|
||||
let cursor_state = ui_state.cursor_state().clone();
|
||||
let old = ui_state.focus.clone();
|
||||
let old = ui_state.focus;
|
||||
if cursor_state.buttons.left.is_start() {
|
||||
ui_state.focus = None;
|
||||
}
|
||||
@@ -121,10 +121,9 @@ impl<State: DefaultAppState> AppState for DefaultState<State> {
|
||||
ui_state.renderer.resize(size)
|
||||
}
|
||||
WindowEvent::KeyboardInput { event, .. } => {
|
||||
if let Some(sel) = &ui_state.focus
|
||||
if let Some(sel) = ui_state.focus
|
||||
&& event.state.is_pressed()
|
||||
{
|
||||
let sel = &sel.clone();
|
||||
let mut text = sel.edit(ui);
|
||||
match text.apply_event(event, &ui_state.input.modifiers) {
|
||||
TextInputResult::Unfocus => {
|
||||
|
||||
Reference in New Issue
Block a user