Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / chart / MaskLayer.js
1 Ext.define('Ext.chart.MaskLayer', {
2     extend: 'Ext.Component',
3     
4     constructor: function(config) {
5         config = Ext.apply(config || {}, {
6             style: 'position:absolute;background-color:#888;cursor:move;opacity:0.6;border:1px solid #222;'
7         });
8         this.callParent([config]);    
9     },
10     
11     initComponent: function() {
12         var me = this;
13         me.callParent(arguments);
14         me.addEvents(
15             'mousedown',
16             'mouseup',
17             'mousemove',
18             'mouseenter',
19             'mouseleave'
20         );
21     },
22
23     initDraggable: function() {
24         this.callParent(arguments);
25         this.dd.onStart = function (e) {
26             var me = this,
27                 comp = me.comp;
28     
29             // Cache the start [X, Y] array
30             this.startPosition = comp.getPosition(true);
31     
32             // If client Component has a ghost method to show a lightweight version of itself
33             // then use that as a drag proxy unless configured to liveDrag.
34             if (comp.ghost && !comp.liveDrag) {
35                  me.proxy = comp.ghost();
36                  me.dragTarget = me.proxy.header.el;
37             }
38     
39             // Set the constrainTo Region before we start dragging.
40             if (me.constrain || me.constrainDelegate) {
41                 me.constrainTo = me.calculateConstrainRegion();
42             }
43         };
44     }
45 });