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)
|
_place_module_in_cell(_drag_module, target_col, target_row)
|
||||||
module_placed.emit(_drag_module, target_col, target_row)
|
module_placed.emit(_drag_module, target_col, target_row)
|
||||||
else:
|
else:
|
||||||
# INSERT: flatten all modules, insert dragged one at target, reflow
|
# Place in the empty cell directly — you get full control of positioning
|
||||||
var all_modules := _collect_all_modules()
|
_place_module_in_cell(_drag_module, target_col, target_row)
|
||||||
|
module_placed.emit(_drag_module, target_col, target_row)
|
||||||
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)
|
|
||||||
else:
|
else:
|
||||||
# Dropped outside the grid — return to source if still valid
|
# Dropped outside the grid — return to source if still valid
|
||||||
if _is_valid_cell(_drag_source_col, _drag_source_row):
|
if _is_valid_cell(_drag_source_col, _drag_source_row):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue