-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mv js vendor libs into vendor folder
- Loading branch information
unknown
authored and
unknown
committed
Feb 27, 2015
1 parent
5a16dcc
commit 02d9b64
Showing
15 changed files
with
32,559 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
beautifulmind/mindmap/static/mindmap/js/vendor/jquery.collisioncheck-1.1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Collision Check Plugin v1.1 | ||
* Copyright (c) Constantin Groß, 48design.de | ||
* v1.2 rewrite with thanks to Daniel | ||
* | ||
* @requires jQuery v1.3.2 | ||
* @description Checks single or groups of objects (divs, images or any other block element) for collission / overlapping | ||
* @returns an object collection with all colliding / overlapping html objects | ||
* | ||
* Dual licensed under the MIT and GPL licenses: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* http://www.gnu.org/licenses/gpl.html | ||
* | ||
*/ | ||
(function($) { | ||
$.fn.collidesWith = function(elements) { | ||
var rects = this; | ||
var checkWith = $(elements); | ||
var c = $([]); | ||
|
||
if (!rects || !checkWith) { return false; } | ||
|
||
rects.each(function() { | ||
var rect = $(this); | ||
|
||
// define minimum and maximum coordinates | ||
var rectOff = rect.offset(); | ||
var rectMinX = rectOff.left; | ||
var rectMinY = rectOff.top; | ||
var rectMaxX = rectMinX + rect.outerWidth(); | ||
var rectMaxY = rectMinY + rect.outerHeight(); | ||
|
||
checkWith.not(rect).each(function() { | ||
var otherRect = $(this); | ||
var otherRectOff = otherRect.offset(); | ||
var otherRectMinX = otherRectOff.left; | ||
var otherRectMinY = otherRectOff.top; | ||
var otherRectMaxX = otherRectMinX + otherRect.outerWidth(); | ||
var otherRectMaxY = otherRectMinY + otherRect.outerHeight(); | ||
|
||
// check for intersection | ||
if ( rectMinX >= otherRectMaxX || | ||
rectMaxX <= otherRectMinX || | ||
rectMinY >= otherRectMaxY || | ||
rectMaxY <= otherRectMinY ) { | ||
return true; // no intersection, continue each-loop | ||
} else { | ||
// intersection found, add only once | ||
if(c.length == c.not(this).length) { c.push(this); } | ||
} | ||
}); | ||
}); | ||
// return collection | ||
return c; | ||
} | ||
})(jQuery); |
Oops, something went wrong.