feat(dees-dashboardgrid): enhance widget placement validation and logging for drag-and-drop interactions

This commit is contained in:
2025-09-18 10:39:11 +00:00
parent 9b39196195
commit 792e77f824
3 changed files with 187 additions and 15 deletions

View File

@@ -161,7 +161,9 @@ export const resolveWidgetPlacement = (
if (!other.locked && !other.noMove && other.w === moving.w && other.h === moving.h) {
const otherClone = sourceWidgets.find(widget => widget.id === other.id);
if (otherClone) {
const swapTarget = previousPosition ?? original;
// Use the original position of the moving widget for a clean swap
// This prevents the "snapping together" issue where both widgets end up at the same position
const swapTarget = original;
otherClone.x = swapTarget.x;
otherClone.y = swapTarget.y;
return { widgets: sourceWidgets, movedWidgets: [moving.id, otherClone.id], swappedWith: otherClone.id };