fn update_state(states: &mut HashMap<EventType, EventState>, tree_node: TreeNode, layout: &Rect, event_type: EventType) {
        let state = states.entry(event_type).or_insert(EventState::default());

        let (node, depth) = tree_node;
        // Node is at or above best depth and is at or above best z-level
        let mut should_update = depth >= state.best_depth && layout.z_index >= state.best_z_index;
        // OR node is above best z-level
        should_update |= layout.z_index > state.best_z_index;

        if should_update {
            state.best_match = Some(node);
            state.best_z_index = layout.z_index;
            state.best_depth = depth;
        }
    }
/// Updates the state data for the given event
Updates the state data for the given event
Updates the state data for the given event
fn update_state(states: &mut HashMap<EventType, EventState>, tree_node: TreeNode, layout: &Rect, event_type: EventType) {
        let state = states.entry(event_type).or_insert(EventState::default());
        let (node, depth) = tree_node;
        // Node is at or above best depth and is at or above best z-level
        let mut should_update = depth >= state.best_depth && layout.z_index >= state.best_z_index;
        // OR node is above best z-level
        should_update |= layout.z_index > state.best_z_index;
        if should_update {
            state.best_match = Some(node);
            state.best_z_index = layout.z_index;
            state.best_depth = depth;
        }
    }
fn update_state ( states : & mut HashMap < EventType , EventState > , tree_node : TreeNode , layout : & Rect , event_type : EventType ) { let state = states . entry ( event_type ) . or_insert ( EventState :: default ( ) ) ; let ( node , depth ) = tree_node ; // Node is at or above best depth and is at or above best z-level let mut should_update = depth >= state . best_depth && layout . z_index >= state . best_z_index ; // OR node is above best z-level should_update |= layout . z_index > state . best_z_index ; if should_update { state . best_match = Some ( node ) ; state . best_z_index = layout . z_index ; state . best_depth = depth ; } }
Updates the state data for the given event
Updates the state data for the given event
states
&mut HashMap<EventType, EventState>
tree_node
TreeNode
layout
&Rect
event_type
EventType
states
&mut HashMap<EventType, EventState>
tree_node
TreeNode
layout
&Rect
event_type
EventType