the great orientation refactor (move to x & y UiScalars/Spans) + don't call full size in align
This commit is contained in:
@@ -15,10 +15,10 @@ pub struct TextEdit {
|
||||
|
||||
impl TextEdit {
|
||||
pub fn region(&self) -> UiRegion {
|
||||
UiRegion::from_size_align(
|
||||
self.tex().map(|t| t.size()).unwrap_or(Vec2::ZERO),
|
||||
self.align,
|
||||
)
|
||||
self.tex()
|
||||
.map(|t| t.size())
|
||||
.unwrap_or(Vec2::ZERO)
|
||||
.align(self.align)
|
||||
}
|
||||
|
||||
pub fn content(&self) -> String {
|
||||
@@ -44,7 +44,7 @@ impl Widget for TextEdit {
|
||||
let size = vec2(1, self.attrs.line_height);
|
||||
painter.primitive_within(
|
||||
RectPrimitive::color(Color::WHITE),
|
||||
UiRegion::from_size_align(size, Align::TopLeft)
|
||||
size.align(Align::TOP_LEFT)
|
||||
.offset(offset)
|
||||
.within(®ion),
|
||||
);
|
||||
@@ -205,7 +205,7 @@ impl<'a> TextEditCtx<'a> {
|
||||
}
|
||||
|
||||
pub fn select(&mut self, pos: Vec2, size: Vec2) {
|
||||
let pos = pos - self.text.region().top_left.to_abs(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