3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"> Ext.lib.Region = function(t, r, b, l) {
\r
19 Ext.lib.Region.prototype = {
\r
20 contains : function(region) {
\r
22 return ( region.left >= me.left &&
\r
23 region.right <= me.right &&
\r
24 region.top >= me.top &&
\r
25 region.bottom <= me.bottom );
\r
29 getArea : function() {
\r
31 return ( (me.bottom - me.top) * (me.right - me.left) );
\r
34 intersect : function(region) {
\r
36 t = Math.max(me.top, region.top),
\r
37 r = Math.min(me.right, region.right),
\r
38 b = Math.min(me.bottom, region.bottom),
\r
39 l = Math.max(me.left, region.left);
\r
41 if (b >= t && r >= l) {
\r
42 return new Ext.lib.Region(t, r, b, l);
\r
46 union : function(region) {
\r
48 t = Math.min(me.top, region.top),
\r
49 r = Math.max(me.right, region.right),
\r
50 b = Math.max(me.bottom, region.bottom),
\r
51 l = Math.min(me.left, region.left);
\r
53 return new Ext.lib.Region(t, r, b, l);
\r
56 constrainTo : function(r) {
\r
58 me.top = me.top.constrain(r.top, r.bottom);
\r
59 me.bottom = me.bottom.constrain(r.top, r.bottom);
\r
60 me.left = me.left.constrain(r.left, r.right);
\r
61 me.right = me.right.constrain(r.left, r.right);
\r
65 adjust : function(t, l, b, r) {
\r
75 Ext.lib.Region.getRegion = function(el) {
\r
76 var p = Ext.lib.Dom.getXY(el),
\r
78 r = p[0] + el.offsetWidth,
\r
79 b = p[1] + el.offsetHeight,
\r
82 return new Ext.lib.Region(t, r, b, l);
\r