Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / MaskLayer.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   <title>The source code</title>
6   <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8   <style type="text/css">
9     .highlight { display: block; background-color: #ddd; }
10   </style>
11   <script type="text/javascript">
12     function highlight() {
13       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
14     }
15   </script>
16 </head>
17 <body onload="prettyPrint(); highlight();">
18   <pre class="prettyprint lang-js">Ext.define('Ext.chart.MaskLayer', {
19     extend: 'Ext.Component',
20     
21     constructor: function(config) {
22         config = Ext.apply(config || {}, {
23             style: 'position:absolute;background-color:#888;cursor:move;opacity:0.6;border:1px solid #222;'
24         });
25         this.callParent([config]);    
26     },
27     
28     initComponent: function() {
29         var me = this;
30         me.callParent(arguments);
31         me.addEvents(
32             'mousedown',
33             'mouseup',
34             'mousemove',
35             'mouseenter',
36             'mouseleave'
37         );
38     },
39
40     initDraggable: function() {
41         this.callParent(arguments);
42         this.dd.onStart = function (e) {
43             var me = this,
44                 comp = me.comp;
45     
46             // Cache the start [X, Y] array
47             this.startPosition = comp.getPosition(true);
48     
49             // If client Component has a ghost method to show a lightweight version of itself
50             // then use that as a drag proxy unless configured to liveDrag.
51             if (comp.ghost &amp;&amp; !comp.liveDrag) {
52                  me.proxy = comp.ghost();
53                  me.dragTarget = me.proxy.header.el;
54             }
55     
56             // Set the constrainTo Region before we start dragging.
57             if (me.constrain || me.constrainDelegate) {
58                 me.constrainTo = me.calculateConstrainRegion();
59             }
60         };
61     }
62 });</pre>
63 </body>
64 </html>