span direction (sign) now works

This commit is contained in:
2025-08-11 02:41:14 -04:00
parent fa930180c1
commit 23a5ccd05e
4 changed files with 34 additions and 6 deletions

View File

@@ -40,10 +40,10 @@ impl UIPos {
let anchor = self
.anchor
.lerp(region.top_left.anchor, region.bot_right.anchor);
let offset = self.offset;
// + self
// .anchor
// .lerp(region.top_left.offset, region.bot_right.offset);
let offset = self.offset
+ self
.anchor
.lerp(region.top_left.offset, region.bot_right.offset);
UIPos { anchor, offset }
}
@@ -59,6 +59,16 @@ impl UIPos {
},
}
}
pub fn flip(&mut self) {
self.anchor = 1.0 - self.anchor;
self.offset = -self.offset;
}
pub fn flipped(mut self) -> Self {
self.flip();
self
}
}
#[derive(Clone, Copy, Debug)]
@@ -133,6 +143,12 @@ impl UIRegion {
bot_right: self.bot_right.axis_mut(axis),
}
}
pub fn flip(&mut self) {
self.top_left.flip();
self.bot_right.flip();
std::mem::swap(&mut self.top_left, &mut self.bot_right);
}
}
pub struct UIRegionAxisView<'a> {