examples/grow21/client/lib/crafty.js
function(a, b, target){
			if (target == null)
				target={}
			// Doing it in this order means we can use either a or b as the target, with no conflict
			// Round resulting values to integers; down for xy, up for wh
			// Would be slightly off if negative w, h were allowed
			target._h = Math.max(a._y + a._h, b._y + b._h);
			target._w = Math.max(a._x + a._w, b._x + b._w);
			target._x = ~~Math.min(a._x, b._x);
			target._y = ~~Math.min(a._y, b._y);
			target._w -= target._x;
			target._h -= target._y
			target._w = (target._w == ~~target._w) ? target._w : ~~target._w + 1 | 0;
			target._h = (target._h == ~~target._h) ? target._h : ~~target._h + 1 | 0;
			return target
		}
function(a, b, target){
			if (target == null)
				target={}
			// Doing it in this order means we can use either a or b as the target, with no conflict
			// Round resulting values to integers; down for xy, up for wh
			// Would be slightly off if negative w, h were allowed
			target._h = Math.max(a._y + a._h, b._y + b._h);
			target._w = Math.max(a._x + a._w, b._x + b._w);
			target._x = ~~Math.min(a._x, b._x);
			target._y = ~~Math.min(a._y, b._y);
			target._w -= target._x;
			target._h -= target._y
			target._w = (target._w == ~~target._w) ? target._w : ~~target._w + 1 | 0;
			target._h = (target._h == ~~target._h) ? target._h : ~~target._h + 1 | 0;
			return target
		}
function ( a , b , target ) { if ( target == null ) target = { } // Doing it in this order means we can use either a or b as the target, with no conflict // Round resulting values to integers; down for xy, up for wh // Would be slightly off if negative w, h were allowed target . _h = Math . max ( a . _y + a . _h , b . _y + b . _h ) ; target . _w = Math . max ( a . _x + a . _w , b . _x + b . _w ) ; target . _x = ~ ~ Math . min ( a . _x , b . _x ) ; target . _y = ~ ~ Math . min ( a . _y , b . _y ) ; target . _w -= target . _x ; target . _h -= target . _y target . _w = ( target . _w == ~ ~ target . _w ) ? target . _w : ~ ~ target . _w + 1 | 0 ; target . _h = ( target . _h == ~ ~ target . _h ) ? target . _h : ~ ~ target . _h + 1 | 0 ; return target }
Finds smallest rectangles that overlaps a and b, merges them into target
Finds smallest rectangles that overlaps a and b merges them into target