Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  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>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. Ext.lib.Region = function(t, r, b, l) {
  16. var me = this;
  17. me.top = t;
  18. me[1] = t;
  19. me.right = r;
  20. me.bottom = b;
  21. me.left = l;
  22. me[0] = l;
  23. };
  24. Ext.lib.Region.prototype = {
  25. contains : function(region) {
  26. var me = this;
  27. return ( region.left >= me.left &&
  28. region.right <= me.right &&
  29. region.top >= me.top &&
  30. region.bottom <= me.bottom );
  31. },
  32. getArea : function() {
  33. var me = this;
  34. return ( (me.bottom - me.top) * (me.right - me.left) );
  35. },
  36. intersect : function(region) {
  37. var me = this,
  38. t = Math.max(me.top, region.top),
  39. r = Math.min(me.right, region.right),
  40. b = Math.min(me.bottom, region.bottom),
  41. l = Math.max(me.left, region.left);
  42. if (b >= t && r >= l) {
  43. return new Ext.lib.Region(t, r, b, l);
  44. }
  45. },
  46. union : function(region) {
  47. var me = this,
  48. t = Math.min(me.top, region.top),
  49. r = Math.max(me.right, region.right),
  50. b = Math.max(me.bottom, region.bottom),
  51. l = Math.min(me.left, region.left);
  52. return new Ext.lib.Region(t, r, b, l);
  53. },
  54. constrainTo : function(r) {
  55. var me = this;
  56. me.top = me.top.constrain(r.top, r.bottom);
  57. me.bottom = me.bottom.constrain(r.top, r.bottom);
  58. me.left = me.left.constrain(r.left, r.right);
  59. me.right = me.right.constrain(r.left, r.right);
  60. return me;
  61. },
  62. adjust : function(t, l, b, r) {
  63. var me = this;
  64. me.top += t;
  65. me.left += l;
  66. me.right += r;
  67. me.bottom += b;
  68. return me;
  69. }
  70. };
  71. Ext.lib.Region.getRegion = function(el) {
  72. var p = Ext.lib.Dom.getXY(el),
  73. t = p[1],
  74. r = p[0] + el.offsetWidth,
  75. b = p[1] + el.offsetHeight,
  76. l = p[0];
  77. return new Ext.lib.Region(t, r, b, l);
  78. };</pre>
  79. </body>
  80. </html>