setzer22 / egui_node_graph

Build your node graph applications in Rust, using egui
MIT License
711 stars 132 forks source link

draw_graph_editor: fix cursor_in_editor #92

Closed kamirr closed 1 year ago

kamirr commented 1 year ago

Previously the editor assumed that if the editor_rect contained the cursor, then the editor should act like it is hovered. This works as long as the editor is the only widget in the central panel, but it broke when interacting with windows.

If a window was covering some part of the editor widget:

  1. You could open the node finder while hovering the window, which is terrible for interacting with widgets within that window.
  2. You could not close the node finder by clicking on the window (this click was considered neither a background click, nor an out-of-editor click).

This is fixed by using egui sense to detect hover, which will automatically handle any widgets overlapping the editor.