mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user