From ab699aafdc1924df649e3b41d6c1c48728d75126 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Fri, 17 Apr 2026 09:59:38 +0200 Subject: [PATCH] using variables for better readability --- public/js/composables/GridLogic.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/js/composables/GridLogic.js b/public/js/composables/GridLogic.js index ae2043698..773f766a2 100644 --- a/public/js/composables/GridLogic.js +++ b/public/js/composables/GridLogic.js @@ -122,10 +122,13 @@ class GridLogic { 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(); - if (occupiersFrame.every(frame => currItem.frame.includes(frame))) { + // checks if target contains widget with the same high and width + // so swapping is possible + const occupiersFrame = occupiers.map(occupier => this.data[occupier].frame).flat(); + const occupiersInsideMovingItem = occupiersFrame.every(frame => currItem.frame.includes(frame)); + + if (occupiersInsideMovingItem) { // every slot of all items in the target zone is inside said zone let replaceUpdate = []; let newOccupierFrames = [];