actually use the text library for text editing (fully working I think but code isn't cleanest)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use image::DynamicImage;
|
||||
|
||||
use crate::{
|
||||
core::{TextEdit, TextEditCtx},
|
||||
layout::{
|
||||
ActiveSensors, PainterCtx, Sensor, SensorMap, StaticWidgetId, TextData, TextureHandle,
|
||||
Textures, Vec2, Widget, WidgetId, WidgetInstance, WidgetLike,
|
||||
@@ -24,7 +25,7 @@ pub struct Ui<Ctx> {
|
||||
// TODO: make these non pub(crate)
|
||||
pub(crate) primitives: Primitives,
|
||||
pub(crate) textures: Textures,
|
||||
text: TextData,
|
||||
pub(crate) text: TextData,
|
||||
full_redraw: bool,
|
||||
|
||||
pub(super) active: Active,
|
||||
@@ -188,6 +189,14 @@ impl<Ctx> Ui<Ctx> {
|
||||
.push(f);
|
||||
self.widgets.data_mut(&id.id).unwrap().sensor = true;
|
||||
}
|
||||
|
||||
pub fn text(&mut self, id: &WidgetId<TextEdit>) -> TextEditCtx<'_> {
|
||||
self.updates.push(id.id.duplicate());
|
||||
TextEditCtx {
|
||||
text: self.widgets.get_mut(id).unwrap(),
|
||||
font_system: &mut self.text.font_system,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<W: Widget, Ctx> Index<&WidgetId<W>> for Ui<Ctx> {
|
||||
|
||||
Reference in New Issue
Block a user