3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 Ext.lib.Region = function(t, r, b, l) {
25 Ext.lib.Region.prototype = {
26 contains : function(region) {
28 return ( region.left >= me.left &&
29 region.right <= me.right &&
30 region.top >= me.top &&
31 region.bottom <= me.bottom );
35 getArea : function() {
37 return ( (me.bottom - me.top) * (me.right - me.left) );
40 intersect : function(region) {
42 t = Math.max(me.top, region.top),
43 r = Math.min(me.right, region.right),
44 b = Math.min(me.bottom, region.bottom),
45 l = Math.max(me.left, region.left);
47 if (b >= t && r >= l) {
48 return new Ext.lib.Region(t, r, b, l);
52 union : function(region) {
54 t = Math.min(me.top, region.top),
55 r = Math.max(me.right, region.right),
56 b = Math.max(me.bottom, region.bottom),
57 l = Math.min(me.left, region.left);
59 return new Ext.lib.Region(t, r, b, l);
62 constrainTo : function(r) {
64 me.top = me.top.constrain(r.top, r.bottom);
65 me.bottom = me.bottom.constrain(r.top, r.bottom);
66 me.left = me.left.constrain(r.left, r.right);
67 me.right = me.right.constrain(r.left, r.right);
71 adjust : function(t, l, b, r) {
81 Ext.lib.Region.getRegion = function(el) {
82 var p = Ext.lib.Dom.getXY(el),
84 r = p[0] + el.offsetWidth,
85 b = p[1] + el.offsetHeight,
88 return new Ext.lib.Region(t, r, b, l);