]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Intersect methods into the core. Determines when element "a" coordinates inters...
authorEduardo Lundgren <eduardolundgren@gmail.com>
Mon, 10 Nov 2008 05:16:22 +0000 (05:16 +0000)
committerEduardo Lundgren <eduardolundgren@gmail.com>
Mon, 10 Nov 2008 05:16:22 +0000 (05:16 +0000)
ui/ui.core.js

index 402baa1ef6df4beda9d6e5ff30aab60113899078..3f5ea2a104b93cdc84c34d4e0d0b7d573b1ea580 100644 (file)
@@ -104,6 +104,21 @@ $.ui = {
                has = (e[scroll] > 0);
                e[scroll] = 0;
                return has;
+       },
+       
+       intersectHeight: function(aTop, bTop, bHeight) {
+               //Determines when "aTop" element coordinate intersects with b element height
+               return (aTop > bTop) && (aTop < (bTop + bHeight));
+       },
+       
+       intersectWidth: function(aLeft, bLeft, bWidth) {
+               //Determines when "aLeft" element coordinate intersects with b element width
+               return (aLeft > bLeft) && (aLeft < (bLeft + bWidth));
+       },
+       
+       intersect: function(aTop, aLeft, bTop, bLeft, bHeight, bWidth) {
+               //Determines when element "a" coordinates intersects with element "b"
+               return $.ui.intersectHeight(aTop, bTop, bHeight) && $.ui.intersectWidth(aLeft, bLeft, bWidth);
        }
 };