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,7 +1,7 @@
use crate::prelude::*;
pub struct Masked {
pub inner: WidgetId,
pub inner: WidgetHandle,
}
impl Widget for Masked {

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct Aligned {
pub inner: WidgetId,
pub inner: WidgetHandle,
pub align: Align,
}

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct LayerOffset {
pub inner: WidgetId,
pub inner: WidgetHandle,
pub offset: usize,
}

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct MaxSize {
pub inner: WidgetId,
pub inner: WidgetHandle,
pub x: Option<Len>,
pub y: Option<Len>,
}

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct Offset {
pub inner: WidgetId,
pub inner: WidgetHandle,
pub amt: UiVec2,
}

View File

@@ -2,7 +2,7 @@ use crate::prelude::*;
pub struct Pad {
pub padding: Padding,
pub inner: WidgetId,
pub inner: WidgetHandle,
}
impl Widget for Pad {

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct Scroll {
inner: WidgetId,
inner: WidgetHandle,
axis: Axis,
amt: f32,
snap_end: bool,
@@ -41,7 +41,7 @@ impl Widget for Scroll {
}
impl Scroll {
pub fn new(inner: WidgetId, axis: Axis) -> Self {
pub fn new(inner: WidgetHandle, axis: Axis) -> Self {
Self {
inner,
axis,

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct Sized {
pub inner: WidgetId,
pub inner: WidgetHandle,
pub x: Option<Len>,
pub y: Option<Len>,
}

View File

@@ -2,7 +2,7 @@ use crate::prelude::*;
use std::marker::PhantomData;
pub struct Span {
pub children: Vec<WidgetId>,
pub children: Vec<WidgetHandle>,
pub dir: Dir,
pub gap: f32,
}
@@ -182,7 +182,7 @@ impl<const LEN: usize, Wa: WidgetArrLike<LEN, Tag>, Tag> SpanBuilder<LEN, Wa, Ta
}
impl std::ops::Deref for Span {
type Target = Vec<WidgetId>;
type Target = Vec<WidgetHandle>;
fn deref(&self) -> &Self::Target {
&self.children

View File

@@ -3,7 +3,7 @@ use std::marker::PhantomData;
use crate::prelude::*;
pub struct Stack {
pub children: Vec<WidgetId>,
pub children: Vec<WidgetHandle>,
pub size: StackSize,
}

View File

@@ -2,7 +2,7 @@ use crate::prelude::*;
#[derive(Default)]
pub struct WidgetPtr {
pub inner: Option<WidgetId>,
pub inner: Option<WidgetHandle>,
}
impl Widget for WidgetPtr {

View File

@@ -1,15 +1,10 @@
use crate::prelude::*;
use iris_core::util::{HashMap, Id};
use std::{
ops::{BitOr, Deref, DerefMut},
rc::Rc,
};
use crate::{
layout::{UiModule, UiRegion},
util::{HashMap, Id, Vec2},
};
#[derive(Clone, Copy, PartialEq)]
pub enum Button {
Left,
@@ -125,7 +120,7 @@ pub struct CursorModule<Ctx> {
}
impl<Ctx: 'static> UiModule for CursorModule<Ctx> {
fn on_draw(&mut self, inst: &WidgetInstance) {
fn on_draw(&mut self, inst: &ActiveData) {
if self.map.contains_key(&inst.id) {
self.active
.entry(inst.layer)
@@ -134,7 +129,7 @@ impl<Ctx: 'static> UiModule for CursorModule<Ctx> {
}
}
fn on_undraw(&mut self, inst: &WidgetInstance) {
fn on_undraw(&mut self, inst: &ActiveData) {
if let Some(layer) = self.active.get_mut(&inst.layer) {
layer.remove(&inst.id);
}
@@ -147,7 +142,7 @@ impl<Ctx: 'static> UiModule for CursorModule<Ctx> {
}
}
fn on_move(&mut self, inst: &WidgetInstance) {
fn on_move(&mut self, inst: &ActiveData) {
if let Some(map) = self.active.get_mut(&inst.layer)
&& let Some(region) = map.get_mut(&inst.id)
{

View File

@@ -1,7 +1,6 @@
use std::ops::{Deref, DerefMut};
use crate::prelude::*;
use cosmic_text::{Affinity, Attrs, Cursor, FontSystem, LayoutRun, Motion};
use std::ops::{Deref, DerefMut};
use unicode_segmentation::UnicodeSegmentation;
use winit::{
event::KeyEvent,

View File

@@ -3,8 +3,9 @@ mod edit;
pub use build::*;
pub use edit::*;
use iris_core::util::MutDetect;
use crate::{prelude::*, util::MutDetect};
use crate::prelude::*;
use cosmic_text::{Attrs, BufferLine, Cursor, Metrics, Shaping};
use std::ops::{Deref, DerefMut};
@@ -21,11 +22,11 @@ pub struct TextView {
// cache
tex: Option<RenderedText>,
width: Option<f32>,
pub hint: Option<WidgetId>,
pub hint: Option<WidgetHandle>,
}
impl TextView {
pub fn new(buf: TextBuffer, attrs: TextAttrs, hint: Option<WidgetId>) -> Self {
pub fn new(buf: TextBuffer, attrs: TextAttrs, hint: Option<WidgetHandle>) -> Self {
Self {
attrs: attrs.into(),
buf: buf.into(),