/// Checks to see if a recent update has caused the current mouse hover
/// node to change.
Checks to see if a recent update has caused the current mouse hover
node to change.
Checks to see if a recent update has caused the current mouse hover node to change .
fn update_roll_over(&mut self) -> bool {
        // TODO: While the mouse is down, maintain the hovered node.
        if self.is_mouse_down {
            return false;
        }
        let mouse_pos = self.mouse_pos;
        let mut new_cursor = self.mouse_cursor;
        let hover_changed = self.mutate_with_update_context(|context| {
            // Check hovered object.
            let mut new_hovered = None;
            for (_depth, level) in context.levels.clone().iter().rev() {
                if new_hovered.is_none() {
                    new_hovered = level.mouse_pick(context, *level, (mouse_pos.0, mouse_pos.1));
                } else {
                    break;
                }
            }
            let cur_hovered = context.mouse_hovered_object;
            if cur_hovered.map(|d| d.as_ptr()) != new_hovered.map(|d| d.as_ptr()) {
                // RollOut of previous node.
                if let Some(node) = cur_hovered {
                    if !node.removed() {
                        node.handle_clip_event(context, ClipEvent::RollOut);
                    }
                }
                // RollOver on new node.I still
                new_cursor = MouseCursor::Arrow;
                if let Some(node) = new_hovered {
                    new_cursor = node.mouse_cursor();
                    node.handle_clip_event(context, ClipEvent::RollOver);
                }
                context.mouse_hovered_object = new_hovered;
                Self::run_actions(context);
                true
            } else {
                false
            }
        });
        // Update mouse cursor if it has changed.
        if new_cursor != self.mouse_cursor {
            self.mouse_cursor = new_cursor;
            self.ui.set_mouse_cursor(new_cursor)
        }
        hover_changed
    }
fn update_roll_over ( & mut self ) -> bool { // TODO: While the mouse is down, maintain the hovered node. if self . is_mouse_down { return false ; } let mouse_pos = self . mouse_pos ; let mut new_cursor = self . mouse_cursor ; let hover_changed = self . mutate_with_update_context ( | context | { // Check hovered object. let mut new_hovered = None ; for ( _depth , level ) in context . levels . clone ( ) . iter ( ) . rev ( ) { if new_hovered . is_none ( ) { new_hovered = level . mouse_pick ( context , * level , ( mouse_pos . 0 , mouse_pos . 1 ) ) ; } else { break ; } } let cur_hovered = context . mouse_hovered_object ; if cur_hovered . map ( | d | d . as_ptr ( ) ) != new_hovered . map ( | d | d . as_ptr ( ) ) { // RollOut of previous node. if let Some ( node ) = cur_hovered { if ! node . removed ( ) { node . handle_clip_event ( context , ClipEvent :: RollOut ) ; } } // RollOver on new node.I still new_cursor = MouseCursor :: Arrow ; if let Some ( node ) = new_hovered { new_cursor = node . mouse_cursor ( ) ; node . handle_clip_event ( context , ClipEvent :: RollOver ) ; } context . mouse_hovered_object = new_hovered ; Self :: run_actions ( context ) ; true } else { false } } ) ; // Update mouse cursor if it has changed. if new_cursor != self . mouse_cursor { self . mouse_cursor = new_cursor ; self . ui . set_mouse_cursor ( new_cursor ) } hover_changed }
Checks to see if a recent update has caused the current mouse hover
node to change.
Checks to see if a recent update has caused the current mouse hover node to change .
&mut self