fix for some pool nesting errors

This commit is contained in:
Stewart Allen 2020-10-30 20:47:45 -04:00
commit 6cbf5abba0
3 changed files with 13 additions and 14 deletions

View file

@ -87,12 +87,13 @@
* @param {Bounds} parent
* @returns {boolean} true if fully inside parent bounds
*/
PRO.isNested = function(parent) {
PRO.isNested = function(parent, tolerance) {
let grace = tolerance || CONF.precision_bounds;
return (
this.minx >= parent.minx - CONF.precision_bounds && // min-x
this.maxx <= parent.maxx + CONF.precision_bounds && // max-x
this.miny >= parent.miny - CONF.precision_bounds && // min-y
this.maxy <= parent.maxy + CONF.precision_bounds // max-y
this.minx >= parent.minx - grace && // min-x
this.maxx <= parent.maxx + grace && // max-x
this.miny >= parent.miny - grace && // min-y
this.maxy <= parent.maxy + grace // max-y
);
};