22 lines
478 B
Rust
22 lines
478 B
Rust
use crate::prelude::*;
|
|
|
|
pub struct Offset {
|
|
pub inner: WidgetId,
|
|
pub amt: UiVec2,
|
|
}
|
|
|
|
impl Widget for Offset {
|
|
fn draw(&mut self, painter: &mut Painter) {
|
|
let region = UiRegion::FULL.offset(self.amt);
|
|
painter.widget_within(&self.inner, region);
|
|
}
|
|
|
|
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len {
|
|
ctx.width(&self.inner)
|
|
}
|
|
|
|
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len {
|
|
ctx.height(&self.inner)
|
|
}
|
|
}
|