mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 05:48:27 +00:00
Merge pull request #40 from fkaa/fkaa/fix-small-stuff
Fix some small stuff
This commit is contained in:
commit
9aa14cedad
@ -86,6 +86,7 @@ where
|
||||
|
||||
let cursor_pos = ui.ctx().input().pointer.hover_pos().unwrap_or(Pos2::ZERO);
|
||||
let mut cursor_in_editor = editor_rect.contains(cursor_pos);
|
||||
let mut cursor_in_finder = false;
|
||||
|
||||
// Gets filled with the port locations as nodes are drawn
|
||||
let mut port_locations = PortLocations::new();
|
||||
@ -124,7 +125,7 @@ where
|
||||
delayed_responses.extend(responses);
|
||||
}
|
||||
|
||||
let r = ui.allocate_rect(ui.min_rect(), Sense::click());
|
||||
let r = ui.allocate_rect(ui.min_rect(), Sense::click().union(Sense::drag()));
|
||||
if r.clicked() {
|
||||
click_on_background = true;
|
||||
}
|
||||
@ -132,7 +133,7 @@ where
|
||||
/* Draw the node finder, if open */
|
||||
let mut should_close_node_finder = false;
|
||||
if let Some(ref mut node_finder) = self.node_finder {
|
||||
let mut node_finder_area = Area::new("node_finder");
|
||||
let mut node_finder_area = Area::new("node_finder").order(Order::Foreground);
|
||||
if let Some(pos) = node_finder.position {
|
||||
node_finder_area = node_finder_area.current_pos(pos);
|
||||
}
|
||||
@ -157,6 +158,7 @@ where
|
||||
// if the cursor is in the finder, then we can consider that also in the editor.
|
||||
if !cursor_in_editor && finder_rect.contains(cursor_pos) {
|
||||
cursor_in_editor = true;
|
||||
cursor_in_finder = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -265,14 +267,14 @@ where
|
||||
self.connection_in_progress = None;
|
||||
}
|
||||
|
||||
if mouse.button_down(PointerButton::Secondary) && cursor_in_editor {
|
||||
if mouse.secondary_down() && cursor_in_editor && !cursor_in_finder {
|
||||
self.node_finder = Some(NodeFinder::new_at(cursor_pos));
|
||||
}
|
||||
if ui.ctx().input().key_pressed(Key::Escape) {
|
||||
self.node_finder = None;
|
||||
}
|
||||
|
||||
if ui.ctx().input().pointer.middle_down() {
|
||||
if r.dragged() && ui.ctx().input().pointer.middle_down() {
|
||||
self.pan_zoom.pan += ui.ctx().input().pointer.delta();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user