span direction (sign) now works
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user