1717from fps_counter import FPSCounter
1818from renderer import NodeEditorRenderer # <-- new import
1919from canvas_panning import CanvasPanning
20+ from connection_drag_state import ConnectionDragState
2021
2122class NodeEditor :
2223 def __init__ (self , toolbar = None , undo_depth = 10 ):
@@ -29,9 +30,7 @@ def __init__(self, toolbar=None, undo_depth=10):
2930 self .connections = ConnectionList ()
3031 self .undo_stack = UndoStack (max_depth = undo_depth )
3132 self .selection = NodeSelection () # multiple selection of nodes
32- self .dragging_connection : bool = False
33- self .connection_start_node : tuple [int , int ] | None = None
34- self .connection_end_pos : tuple [int ,int ] | None = None
33+ self .connection_drag = ConnectionDragState ()
3534 self .next_node_id = 1
3635 self .zoom : float = 1.0 # 1.0 = 100%, min 0.1 (1:10), max e.g. 2.0
3736 self .toolbar = toolbar if toolbar else Toolbar ()
@@ -182,6 +181,9 @@ def handle_mouse_motion(self, event):
182181 self .panning_state .update_panning (
183182 (x , y ), self .zoom , PANNING_FOLLOWS_MOUSE
184183 )
184+ # Handle connection dragging
185+ if self .connection_drag .is_active ():
186+ self .connection_drag .update_end ((x , y ))
185187
186188 def handle_mouse_wheel (self , event ):
187189 # Get mouse position
0 commit comments