From 98bdb8c526f02515b5a753e46bc4a9bb5b31729b Mon Sep 17 00:00:00 2001 From: chfhtw Date: Fri, 17 Apr 2026 09:57:24 +0200 Subject: [PATCH] bugfix: if the moving object is bigger than 1x1 and its target location touches the original location swapping could locate the occupier inside the overlapping slot making the occupier overlap the moving object --- public/js/composables/GridLogic.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/js/composables/GridLogic.js b/public/js/composables/GridLogic.js index d3d9b6ade..ae2043698 100644 --- a/public/js/composables/GridLogic.js +++ b/public/js/composables/GridLogic.js @@ -116,7 +116,12 @@ class GridLogic { if (occupiers.some(frame => this.data[frame]?.pinned)) { return []; } - + + // checks if target contains moving widgets start position + // so swapping should be avoided + const targetAndItemOverlap = this.getItemFrame(item).some(frame => currItem.frame.includes(frame)) + if (!targetAndItemOverlap) { + // checks if target contains widget with the same high and width let occupiersData = occupiers.map(occupier => this.data[occupier]); let occupiersFrame = occupiersData.map(occupier => occupier.frame).flat(); @@ -137,6 +142,7 @@ class GridLogic { replaceUpdate[item.index] = { index: item.index, x, y }; return replaceUpdate; + } } const updates = this.add(currItem, prefer);