3 * Copyright(c) 2006-2010 Ext JS, LLC
5 * http://www.extjs.com/license
7 Ext.ux.PanelResizer = Ext.extend(Ext.util.Observable, {
\r
11 constructor: function(config){
\r
12 Ext.apply(this, config);
\r
14 Ext.ux.PanelResizer.superclass.constructor.call(this, config);
\r
20 if(this.panel.elements.indexOf('footer')==-1){
\r
21 p.elements += ',footer';
\r
23 p.on('render', this.onRender, this);
\r
26 onRender : function(p){
\r
27 this.handle = p.footer.createChild({cls:'x-panel-resize'});
\r
29 this.tracker = new Ext.dd.DragTracker({
\r
30 onStart: this.onDragStart.createDelegate(this),
\r
31 onDrag: this.onDrag.createDelegate(this),
\r
32 onEnd: this.onDragEnd.createDelegate(this),
\r
36 this.tracker.initEl(this.handle);
\r
37 p.on('beforedestroy', this.tracker.destroy, this.tracker);
\r
41 onDragStart: function(e){
\r
42 this.dragging = true;
\r
43 this.startHeight = this.panel.el.getHeight();
\r
44 this.fireEvent('dragstart', this, e);
\r
48 onDrag: function(e){
\r
49 this.panel.setHeight((this.startHeight-this.tracker.getOffset()[1]).constrain(this.minHeight, this.maxHeight));
\r
50 this.fireEvent('drag', this, e);
\r
54 onDragEnd: function(e){
\r
55 this.dragging = false;
\r
56 this.fireEvent('dragend', this, e);
\r
59 Ext.preg('panelresizer', Ext.ux.PanelResizer);