Start on a svgutils unit test file
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1856 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -213,4 +213,22 @@ svgedit.math.snapToAngle = function(x1,y1,x2,y2) {
|
||||
return {x:x, y:y, a:snapangle};
|
||||
};
|
||||
|
||||
|
||||
// Function: rectsIntersect
|
||||
// Check if two rectangles (BBoxes objects) intersect each other
|
||||
//
|
||||
// Paramaters:
|
||||
// r1 - The first BBox-like object
|
||||
// r2 - The second BBox-like object
|
||||
//
|
||||
// Returns:
|
||||
// Boolean that's true if rectangles intersect
|
||||
svgedit.math.rectsIntersect = function(r1, r2) {
|
||||
return r2.x < (r1.x+r1.width) &&
|
||||
(r2.x+r2.width) > r1.x &&
|
||||
r2.y < (r1.y+r1.height) &&
|
||||
(r2.y+r2.height) > r1.y;
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user