use view::{IdView, View, ViewWrapper}; use printer::Printer; use vec::Vec2; pub struct TrackedView { pub view: T, pub offset: Vec2, } impl TrackedView { pub fn new(view: T) -> Self { TrackedView { view: view, offset: Vec2::zero(), } } pub fn with_id(self, id: &str) -> IdView { IdView::new(id, self) } } impl ViewWrapper for TrackedView { wrap_impl!(&self.view); fn wrap_draw(&mut self, printer: &Printer) { self.offset = printer.offset; self.view.draw(printer); } }