root / trunk / web / dojo / dojox / layout / DragPane.js @ 13
History | View | Annotate | Download (1.13 KB)
| 1 | 9 | andrej.cim | /*
|
|---|---|---|---|
| 2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
| 3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
| 4 | see: http://dojotoolkit.org/license for details
|
||
| 5 | */
|
||
| 6 | |||
| 7 | |||
| 8 | if(!dojo._hasResource["dojox.layout.DragPane"]){ |
||
| 9 | dojo._hasResource["dojox.layout.DragPane"]=true; |
||
| 10 | dojo.provide("dojox.layout.DragPane");
|
||
| 11 | dojo.require("dijit._Widget");
|
||
| 12 | dojo.declare("dojox.layout.DragPane",dijit._Widget,{invert:true,postCreate:function(){ |
||
| 13 | this.inherited(arguments); |
||
| 14 | this.connect(this.domNode,"onmousedown","_down"); |
||
| 15 | this.connect(this.domNode,"onmouseup","_up"); |
||
| 16 | },_down:function(e){ |
||
| 17 | var t=this.domNode; |
||
| 18 | dojo.style(t,"cursor","move"); |
||
| 19 | this._x=e.pageX;
|
||
| 20 | this._y=e.pageY;
|
||
| 21 | if((this._x<t.offsetLeft+t.clientWidth)&&(this._y<t.offsetTop+t.clientHeight)){ |
||
| 22 | dojo.setSelectable(t,false);
|
||
| 23 | this._mover=this.connect(t,"onmousemove","_move"); |
||
| 24 | } |
||
| 25 | },_up:function(e){ |
||
| 26 | dojo.setSelectable(this.domNode,true); |
||
| 27 | dojo.style(this.domNode,"cursor","pointer"); |
||
| 28 | this.disconnect(this._mover); |
||
| 29 | },_move:function(e){ |
||
| 30 | var _1=this.invert?1:-1; |
||
| 31 | this.domNode.scrollTop+=(this._y-e.pageY)*_1; |
||
| 32 | this.domNode.scrollLeft+=(this._x-e.pageX)*_1; |
||
| 33 | this._x=e.pageX;
|
||
| 34 | this._y=e.pageY;
|
||
| 35 | }}); |
||
| 36 | } |