I have a bCoord array that contains the image x, y position, width, and height. I put the other object in the array I do not cover each other. The source is working very well if array objects are big or equal size which I want to include there, otherwise not. I have this solution, but it is not very good if someone has a good solution to this problem, please share me. You can use this function to verify that an object overlaps with each other Does: this.isCover = function (for pixels, width, height) {for (var i = 0; i & lt; bCoords.length; i ++) if (hasithbildings ], Pixel.x, pixel.i) || iterbuilding (bicorns [i], pixel.x + width, pixel ii) | hasithbuilding (bicorns [i], pixel.x, pixel.i + altitude) | ethylbilding ( Beacomes [ii], pixel x + width, pixel. Y + height)) return b commerce [i]; Return tap; } Function isThereBuilding (obj, x, y) {return (obj.x & lt; = x & amp; (obj.w + obj.x) & gt; = x) & amp; Amp; (Obj.y & lt; = y & (obj.h + obj.y)> = y); }
hitTest = function (o, l) {function get offset (o) {for (var r = {l: o.offsetLeft, t: o.offsetop, r: o .offsetwidth, b: o offset heit}; o = o. Offset print; rl + o. Offset left, RT + = OFSettop); Return r.r + = r.l, r.b + = r.t, r; } (Var b, s, r = [], a = getOffset (o), j = isNa (l.length), i = (j? L = [l]: l) .length; i; b = Get Offset (L [- I]), (Al == BL || (al & gt; BL; L & Lftift; = BR: BLTC; = RR)) and amp; amp; and (on == BT || (AT & gt; BT? & Lt; = bb: bt & lt; = ab)) & amp; amp; (r [l.length] = l [i])); Return J? !! R.length: r; }; Found
Comments
Post a Comment