src/ng-tag-cloud.js
function(elem, other_elems) {
                    // Pairwise overlap detection
                    var overlapping = function(a, b) {
                        if (Math.abs(2.0*a.offsetLeft + a.offsetWidth - 2.0*b.offsetLeft - b.offsetWidth) < a.offsetWidth + b.offsetWidth) {
                            if (Math.abs(2.0*a.offsetTop + a.offsetHeight - 2.0*b.offsetTop - b.offsetHeight) < a.offsetHeight + b.offsetHeight) {
                                return true;
                            }
                        }
                        return false;
                    };
                    var i = 0;
                    // Check elements for overlap one by one, stop and return false as soon as an overlap is found
                    for(i = 0; i < other_elems.length; i++) {
                        if (overlapping(elem, other_elems[i])) {
                            return true;
                        }
                    }
                    return false;
                }
function(elem, other_elems) {
                    // Pairwise overlap detection
                    var overlapping = function(a, b) {
                        if (Math.abs(2.0*a.offsetLeft + a.offsetWidth - 2.0*b.offsetLeft - b.offsetWidth) < a.offsetWidth + b.offsetWidth) {
                            if (Math.abs(2.0*a.offsetTop + a.offsetHeight - 2.0*b.offsetTop - b.offsetHeight) < a.offsetHeight + b.offsetHeight) {
                                return true;
                            }
                        }
                        return false;
                    };
                    var i = 0;
                    // Check elements for overlap one by one, stop and return false as soon as an overlap is found
                    for(i = 0; i < other_elems.length; i++) {
                        if (overlapping(elem, other_elems[i])) {
                            return true;
                        }
                    }
                    return false;
                }
function ( elem , other_elems ) { // Pairwise overlap detection var overlapping = function ( a , b ) { if ( Math . abs ( 2.0 * a . offsetLeft + a . offsetWidth - 2.0 * b . offsetLeft - b . offsetWidth ) < a . offsetWidth + b . offsetWidth ) { if ( Math . abs ( 2.0 * a . offsetTop + a . offsetHeight - 2.0 * b . offsetTop - b . offsetHeight ) < a . offsetHeight + b . offsetHeight ) { return true ; } } return false ; } ; var i = 0 ; // Check elements for overlap one by one, stop and return false as soon as an overlap is found for ( i = 0 ; i < other_elems . length ; i ++ ) { if ( overlapping ( elem , other_elems [ i ] ) ) { return true ; } } return false ; }
Helper function to test if an element overlaps others
Helper function to test if an element overlaps others