MCPcopy Create free account
hub / github.com/microsoft/SandDance / hasOverlap

Function hasOverlap

docs/app/js/sanddance-app.js:120203–120207  ·  view source on GitHub ↗
(items, pad)

Source from the content-addressed store, hash-verified

120201// including padding pixels of separation
120202const intersect = (a, b, sep)=>sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
120203const hasOverlap = (items, pad)=>{
120204 for(var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i){
120205 if (intersect(a, b = items[i].bounds, pad)) return true;
120206 }
120207};
120208const hasBounds = (item)=>{
120209 const b = item.bounds;
120210 return b.width() > 1 && b.height() > 1;

Callers 1

transformFunction · 0.70

Calls 1

intersectFunction · 0.70

Tested by

no test coverage detected