From a747df5235aa8fbb8a8d1178f0a7df86c62f84e1 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Mon, 4 Sep 2023 17:10:21 -0700 Subject: [PATCH] directionCollideCoverage() tweaks * fix #2435 moved overMax outside of loop. --- src/gridstack-engine.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gridstack-engine.ts b/src/gridstack-engine.ts index e8b405f9a..b0969c17e 100644 --- a/src/gridstack-engine.ts +++ b/src/gridstack-engine.ts @@ -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