@@ -23,6 +23,8 @@ signal replace_event_requested(row) ## Emitted when replacing event
2323signal edit_event_requested (row ) ## Emitted when editing event
2424signal add_condition_requested (row ) ## Emitted when adding condition to event
2525signal add_action_requested (row ) ## Emitted when adding action to event
26+ signal condition_dropped (source_row , condition_data , target_row ) ## Emitted when condition is dropped on an event
27+ signal action_dropped (source_row , action_data , target_row ) ## Emitted when action is dropped on an event
2628
2729# === Constants ===
2830const EVENT_ROW_SCENE = preload ("res://addons/flowkit/ui/workspace/event_row.tscn" )
@@ -241,6 +243,8 @@ func _instantiate_event_row(data: FKEventBlock) -> Control:
241243 row .edit_event_requested .connect (func (r ): edit_event_requested .emit (r ))
242244 row .add_condition_requested .connect (func (r ): add_condition_requested .emit (r ))
243245 row .add_action_requested .connect (func (r ): add_action_requested .emit (r ))
246+ row .condition_dropped .connect (func (src , cond , tgt ): condition_dropped .emit (src , cond , tgt ))
247+ row .action_dropped .connect (func (src , act , tgt ): action_dropped .emit (src , act , tgt ))
244248 row .data_changed .connect (_on_child_modified )
245249 row .before_data_changed .connect (func (): before_data_changed .emit ())
246250
@@ -288,6 +292,8 @@ func _instantiate_group(data: FKGroupBlock) -> Control:
288292 nested .edit_event_requested .connect (func (r ): edit_event_requested .emit (r ))
289293 nested .add_condition_requested .connect (func (r ): add_condition_requested .emit (r ))
290294 nested .add_action_requested .connect (func (r ): add_action_requested .emit (r ))
295+ nested .condition_dropped .connect (func (src , cond , tgt ): condition_dropped .emit (src , cond , tgt ))
296+ nested .action_dropped .connect (func (src , act , tgt ): action_dropped .emit (src , act , tgt ))
291297
292298 return nested
293299
@@ -833,17 +839,11 @@ func _calculate_drop_index(dragged_node: Node) -> int:
833839 var mid_y = rect .position .y + rect .size .y * 0.5
834840
835841 if local_y < mid_y :
836- # Insert before this child - find its position in group_data
837- # Iterate through data to find the matching visual child
838- for data_idx in range (group_data .children .size ()):
839- var child_obj = _get_child_node_at_data_index (data_idx )
840- if child_obj == child :
841- return data_idx
842- # Fallback if not found
842+ # Insert at this position (i is the visual index which maps to data index)
843843 return i
844844
845845 # Insert at end (after all visible children)
846- return group_data . children .size ()
846+ return visible_children .size ()
847847
848848
849849func _get_child_node_at_data_index (data_idx : int ) -> Node :
0 commit comments