pub fn transform_scroll(&self, offset: Vec2, viewport: Rect, force: bool) -> Option<Event> {
        match self {
            Event::MouseDown(mouse_event) => {
                if force || 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 force || 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::MouseMove(mouse_event) => {
                if force || viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseMove(mouse_event))
                } else {
                    None
                }
            }
            Event::Wheel(mouse_event) => {
                if force || viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::Wheel(mouse_event))
                } else {
                    None
                }
            }
            _ => Some(self.clone()),
        }
    }
/// Transform the event for the contents of a scrolling container.
///
/// the `force` flag is used to ensure an event is delivered even
/// if the cursor is out of the viewport, such as if the contents are active
/// or hot.
Transform the event for the contents of a scrolling container.
the `force` flag is used to ensure an event is delivered even
if the cursor is out of the viewport, such as if the contents are active
or hot.
Transform the event for the contents of a scrolling container . the ` force ` flag is used to ensure an event is delivered even if the cursor is out of the viewport such as if the contents are active or hot .
pub fn transform_scroll(&self, offset: Vec2, viewport: Rect, force: bool) -> Option<Event> {
        match self {
            Event::MouseDown(mouse_event) => {
                if force || 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 force || 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::MouseMove(mouse_event) => {
                if force || viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::MouseMove(mouse_event))
                } else {
                    None
                }
            }
            Event::Wheel(mouse_event) => {
                if force || viewport.winding(mouse_event.pos) != 0 {
                    let mut mouse_event = mouse_event.clone();
                    mouse_event.pos += offset;
                    Some(Event::Wheel(mouse_event))
                } else {
                    None
                }
            }
            _ => Some(self.clone()),
        }
    }
pub fn transform_scroll ( & self , offset : Vec2 , viewport : Rect , force : bool ) -> Option < Event > { match self { Event :: MouseDown ( mouse_event ) => { if force || 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 force || 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 :: MouseMove ( mouse_event ) => { if force || viewport . winding ( mouse_event . pos ) != 0 { let mut mouse_event = mouse_event . clone ( ) ; mouse_event . pos += offset ; Some ( Event :: MouseMove ( mouse_event ) ) } else { None } } Event :: Wheel ( mouse_event ) => { if force || viewport . winding ( mouse_event . pos ) != 0 { let mut mouse_event = mouse_event . clone ( ) ; mouse_event . pos += offset ; Some ( Event :: Wheel ( 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
force
bool
&self
offset
Vec2
viewport
Rect
force
bool