Correct event relativization in Panel

This commit is contained in:
Alexandre Bury 2017-10-12 20:43:33 -07:00
parent 67a6640142
commit ab1f4a2ba6

View File

@ -1,4 +1,5 @@
use Printer;
use event::{Event, EventResult};
use vec::Vec2;
use view::{View, ViewWrapper};
@ -18,6 +19,10 @@ impl<V: View> Panel<V> {
impl<V: View> ViewWrapper for Panel<V> {
wrap_impl!(self.view: V);
fn wrap_on_event(&mut self, event: Event) -> EventResult {
self.view.on_event(event.relativized((1, 1)))
}
fn wrap_required_size(&mut self, req: Vec2) -> Vec2 {
// TODO: make borders conditional?
let req = req.saturating_sub((2, 2));