snap text on shader

This commit is contained in:
2025-08-23 22:16:00 -04:00
parent 5ce6fca275
commit 50ccf7393d
10 changed files with 101 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
use std::{any::TypeId, marker::PhantomData};
use std::{any::TypeId, marker::PhantomData, sync::mpsc::Sender};
use crate::{
layout::{FnTag, Ui, UiMsg, UiMsgSender, Widget, WidgetLike, WidgetTag},
layout::{FnTag, Ui, Widget, WidgetLike, WidgetTag},
util::{Id, RefCounter},
};
@@ -18,7 +18,7 @@ pub struct WidgetId<W = AnyWidget> {
pub(super) ty: TypeId,
pub(super) id: Id,
counter: RefCounter,
send: UiMsgSender,
send: Sender<Id>,
_pd: PhantomData<W>,
}
@@ -41,7 +41,7 @@ impl<W> Clone for WidgetId<W> {
}
impl<W> WidgetId<W> {
pub(super) fn new(id: Id, ty: TypeId, send: UiMsgSender) -> Self {
pub(super) fn new(id: Id, ty: TypeId, send: Sender<Id>) -> Self {
Self {
ty,
id,
@@ -73,7 +73,7 @@ impl<W> WidgetId<W> {
impl<W> Drop for WidgetId<W> {
fn drop(&mut self) {
if self.counter.drop() {
let _ = self.send.send(UiMsg::FreeWidget(self.id.duplicate()));
let _ = self.send.send(self.id.duplicate());
}
}
}