move everything out of layout

This commit is contained in:
2025-12-11 05:48:29 -05:00
parent 174c447706
commit a85e129026
48 changed files with 142 additions and 160 deletions

View File

@@ -1,13 +1,13 @@
use crate::{default::UiState, prelude::*};
use crate::prelude::*;
use std::time::{Duration, Instant};
use winit::dpi::{LogicalPosition, LogicalSize};
pub struct Selector;
impl<W: 'static + Widget> WidgetAttr<W> for Selector {
type Input = WidgetId<TextEdit>;
type Input = WidgetHandle<TextEdit>;
fn run(ui: &mut Ui, container: &WidgetId<W>, id: Self::Input) {
fn run(ui: &mut Ui, container: &WidgetHandle<W>, id: Self::Input) {
let container = container.clone();
ui.register_event(
&container.clone(),
@@ -30,7 +30,7 @@ pub struct Selectable;
impl WidgetAttr<TextEdit> for Selectable {
type Input = ();
fn run(ui: &mut Ui, id: &WidgetId<TextEdit>, _: Self::Input) {
fn run(ui: &mut Ui, id: &WidgetHandle<TextEdit>, _: Self::Input) {
let id = id.clone();
ui.register_event(&id.clone(), CursorSense::click_or_drag(), move |ctx| {
select(ctx.ui, id.clone(), ctx.state, ctx.data);
@@ -38,7 +38,7 @@ impl WidgetAttr<TextEdit> for Selectable {
}
}
fn select(ui: &mut Ui, id: WidgetId<TextEdit>, state: &mut UiState, data: CursorData) {
fn select(ui: &mut Ui, id: WidgetHandle<TextEdit>, state: &mut UiState, data: CursorData) {
let now = Instant::now();
let recent = (now - state.last_click) < Duration::from_millis(300);
state.last_click = now;

View File

@@ -1,4 +1,4 @@
use crate::layout::DefaultEvent;
use iris_core::DefaultEvent;
#[derive(Eq, PartialEq, Hash, Clone)]
pub struct Submit;

View File

@@ -30,7 +30,7 @@ pub struct DefaultState<AppState> {
pub struct UiState {
pub renderer: UiRenderer,
pub input: Input,
pub focus: Option<WidgetId<TextEdit>>,
pub focus: Option<WidgetHandle<TextEdit>>,
pub clipboard: Clipboard,
pub window: Arc<Window>,
pub ime: usize,

View File

@@ -1,7 +1,4 @@
use crate::{
layout::Ui,
render::{UiLimits, UiRenderNode},
};
use iris_core::{Ui, UiLimits, UiRenderNode};
use pollster::FutureExt;
use std::sync::Arc;
use wgpu::{util::StagingBelt, *};