app work?
This commit is contained in:
@@ -7,8 +7,7 @@ pub struct Aligned {
|
||||
|
||||
impl Widget for Aligned {
|
||||
fn draw(&mut self, painter: &mut Painter) {
|
||||
let region =
|
||||
UiRegion::from_ui_size_align(painter.size(&self.inner).to_uivec2(), self.align);
|
||||
let region = UiRegion::from_ui_size_align(painter.region_size(&self.inner), self.align);
|
||||
painter.widget_within(&self.inner, region);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,13 @@ impl Widget for Sized {
|
||||
}
|
||||
|
||||
fn desired_size(&mut self, ctx: &mut SizeCtx) -> Size {
|
||||
let rel = ctx.size.rel;
|
||||
if let Some(x) = self.x {
|
||||
ctx.size.axis_mut(Axis::X).set(x.apply_rest(rel.x));
|
||||
}
|
||||
if let Some(y) = self.y {
|
||||
ctx.size.axis_mut(Axis::Y).set(y.apply_rest(rel.y));
|
||||
}
|
||||
Size {
|
||||
x: self.x.unwrap_or_else(|| ctx.size(&self.inner).x),
|
||||
y: self.y.unwrap_or_else(|| ctx.size(&self.inner).y),
|
||||
|
||||
@@ -182,7 +182,7 @@ impl<'a> TextEditCtx<'a> {
|
||||
}
|
||||
|
||||
pub fn select(&mut self, pos: Vec2, size: Vec2) {
|
||||
let pos = pos - self.text.region().top_left.to_size(size);
|
||||
let pos = pos - self.text.region().top_left.to_abs(size);
|
||||
self.text.cursor = self.text.buf.hit(pos.x, pos.y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user