3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">Ext.ux.PanelResizer = Ext.extend(Ext.util.Observable, {
\r
12 constructor: function(config){
\r
13 Ext.apply(this, config);
\r
15 Ext.ux.PanelResizer.superclass.constructor.call(this, config);
\r
21 if(this.panel.elements.indexOf('footer')==-1){
\r
22 p.elements += ',footer';
\r
24 p.on('render', this.onRender, this);
\r
27 onRender : function(p){
\r
28 this.handle = p.footer.createChild({cls:'x-panel-resize'});
\r
30 this.tracker = new Ext.dd.DragTracker({
\r
31 onStart: this.onDragStart.createDelegate(this),
\r
32 onDrag: this.onDrag.createDelegate(this),
\r
33 onEnd: this.onDragEnd.createDelegate(this),
\r
37 this.tracker.initEl(this.handle);
\r
38 p.on('beforedestroy', this.tracker.destroy, this.tracker);
\r
42 onDragStart: function(e){
\r
43 this.dragging = true;
\r
44 this.startHeight = this.panel.el.getHeight();
\r
45 this.fireEvent('dragstart', this, e);
\r
49 onDrag: function(e){
\r
50 this.panel.setHeight((this.startHeight-this.tracker.getOffset()[1]).constrain(this.minHeight, this.maxHeight));
\r
51 this.fireEvent('drag', this, e);
\r
55 onDragEnd: function(e){
\r
56 this.dragging = false;
\r
57 this.fireEvent('dragend', this, e);
\r
60 Ext.preg('panelresizer', Ext.ux.PanelResizer);</pre>