fix drag: revert empty-cell drop to direct placement instead of list-reflow (insert-index clamping broke corner positioning)
This commit is contained in:
parent
f33cf3d7f8
commit
6198fd556f
1 changed files with 3 additions and 8 deletions
|
|
@ -199,14 +199,9 @@ func _end_drag(mouse_pos: Vector2) -> void:
|
|||
_place_module_in_cell(_drag_module, target_col, target_row)
|
||||
module_placed.emit(_drag_module, target_col, target_row)
|
||||
else:
|
||||
# INSERT: flatten all modules, insert dragged one at target, reflow
|
||||
var all_modules := _collect_all_modules()
|
||||
|
||||
var insert_index := target_row * columns + target_col
|
||||
insert_index = clampi(insert_index, 0, all_modules.size())
|
||||
all_modules.insert(insert_index, _drag_module)
|
||||
|
||||
_reflow_modules(all_modules)
|
||||
# Place in the empty cell directly — you get full control of positioning
|
||||
_place_module_in_cell(_drag_module, target_col, target_row)
|
||||
module_placed.emit(_drag_module, target_col, target_row)
|
||||
else:
|
||||
# Dropped outside the grid — return to source if still valid
|
||||
if _is_valid_cell(_drag_source_col, _drag_source_row):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue