pub fn transform_scroll(&self, offset: Vec2, viewport: Rect) -> Option<Event> {
        // TODO: need to wire this up so that it always propagates mouse events
        // if the widget is active.
        match self {
            Event::MouseDown(mouse_event) => {
                if viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseDown(mouse_event))
                } else {
                    None
                }
            }
            Event::MouseUp(mouse_event) => {
                if viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseUp(mouse_event))
                } else {
                    None
                }
            }
            Event::MouseMoved(mouse_event) => {
                if viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseMoved(mouse_event))
                } else {
                    None
                }
            }
            _ => Some(self.clone()),
        }
    }
/// Transform the event for the contents of a scrolling container.
Transform the event for the contents of a scrolling container.
Transform the event for the contents of a scrolling container .
pub fn transform_scroll(&self, offset: Vec2, viewport: Rect) -> Option<Event> {
        // TODO: need to wire this up so that it always propagates mouse events
        // if the widget is active.
        match self {
            Event::MouseDown(mouse_event) => {
                if viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseDown(mouse_event))
                } else {
                    None
                }
            }
            Event::MouseUp(mouse_event) => {
                if viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseUp(mouse_event))
                } else {
                    None
                }
            }
            Event::MouseMoved(mouse_event) => {
                if viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseMoved(mouse_event))
                } else {
                    None
                }
            }
            _ => Some(self.clone()),
        }
    }
pub fn transform_scroll ( & self , offset : Vec2 , viewport : Rect ) -> Option < Event > { // TODO: need to wire this up so that it always propagates mouse events // if the widget is active. match self { Event :: MouseDown ( mouse_event ) => { if viewport . winding ( mouse_event . pos ) != 0 { let mut mouse_event = mouse_event . clone ( ) ; mouse_event . pos += offset ; Some ( Event :: MouseDown ( mouse_event ) ) } else { None } } Event :: MouseUp ( mouse_event ) => { if viewport . winding ( mouse_event . pos ) != 0 { let mut mouse_event = mouse_event . clone ( ) ; mouse_event . pos += offset ; Some ( Event :: MouseUp ( mouse_event ) ) } else { None } } Event :: MouseMoved ( mouse_event ) => { if viewport . winding ( mouse_event . pos ) != 0 { let mut mouse_event = mouse_event . clone ( ) ; mouse_event . pos += offset ; Some ( Event :: MouseMoved ( mouse_event ) ) } else { None } } _ => Some ( self . clone ( ) ) , } }
Transform the event for the contents of a scrolling container.
Transform the event for the contents of a scrolling container .
&self
offset
Vec2
viewport
Rect
&self
offset
Vec2
viewport
Rect