Skip to content

Commit

Permalink
directionCollideCoverage() tweaks
Browse files Browse the repository at this point in the history
* fix gridstack#2435 moved overMax outside of loop.
  • Loading branch information
adumesny committed Sep 5, 2023
1 parent 87cdedb commit a747df5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gridstack-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ export class GridStackEngine {
}

let collide: GridStackNode;
let overMax = 0.5; // need >50%
collides.forEach(n => {
if (n.locked || !n._rect) return;
let r2 = n._rect; // overlapping target
let yOver = Number.MAX_VALUE, xOver = Number.MAX_VALUE, overMax = 0.5; // need >50%
let yOver = Number.MAX_VALUE, xOver = Number.MAX_VALUE;
// depending on which side we started from, compute the overlap % of coverage
// (ex: from above/below we only compute the max horizontal line coverage)
if (r0.y < r2.y) { // from above
Expand Down

0 comments on commit a747df5

Please sign in to comment.