]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/dnd/Moveable.js
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
8 if(!dojo
._hasResource
["dojo.dnd.Moveable"]){
9 dojo
._hasResource
["dojo.dnd.Moveable"]=true;
10 dojo
.provide("dojo.dnd.Moveable");
11 dojo
.require("dojo.dnd.Mover");
12 dojo
.declare("dojo.dnd.Moveable",null,{handle
:"",delay
:0,skip
:false,constructor:function(_1
,_2
){
13 this.node
=dojo
.byId(_1
);
17 this.handle
=_2
.handle
?dojo
.byId(_2
.handle
):null;
19 this.handle
=this.node
;
21 this.delay
=_2
.delay
>0?_2
.delay
:0;
23 this.mover
=_2
.mover
?_2
.mover
:dojo
.dnd
.Mover
;
24 this.events
=[dojo
.connect(this.handle
,"onmousedown",this,"onMouseDown"),dojo
.connect(this.handle
,"ondragstart",this,"onSelectStart"),dojo
.connect(this.handle
,"onselectstart",this,"onSelectStart")];
25 },markupFactory:function(_3
,_4
){
26 return new dojo
.dnd
.Moveable(_4
,_3
);
28 dojo
.forEach(this.events
,dojo
.disconnect
);
29 this.events
=this.node
=this.handle
=null;
30 },onMouseDown:function(e
){
31 if(this.skip
&&dojo
.dnd
.isFormElement(e
)){
35 this.events
.push(dojo
.connect(this.handle
,"onmousemove",this,"onMouseMove"),dojo
.connect(this.handle
,"onmouseup",this,"onMouseUp"));
39 this.onDragDetected(e
);
42 },onMouseMove:function(e
){
43 if(Math
.abs(e
.pageX
-this._lastX
)>this.delay
||Math
.abs(e
.pageY
-this._lastY
)>this.delay
){
45 this.onDragDetected(e
);
48 },onMouseUp:function(e
){
50 dojo
.disconnect(this.events
.pop());
53 },onSelectStart:function(e
){
54 if(!this.skip
||!dojo
.dnd
.isFormElement(e
)){
57 },onDragDetected:function(e
){
58 new this.mover(this.node
,e
,this);
59 },onMoveStart:function(_5
){
60 dojo
.publish("/dnd/move/start",[_5
]);
61 dojo
.addClass(dojo
.body(),"dojoMove");
62 dojo
.addClass(this.node
,"dojoMoveItem");
63 },onMoveStop:function(_6
){
64 dojo
.publish("/dnd/move/stop",[_6
]);
65 dojo
.removeClass(dojo
.body(),"dojoMove");
66 dojo
.removeClass(this.node
,"dojoMoveItem");
67 },onFirstMove:function(_7
,e
){
68 },onMove:function(_8
,_9
,e
){
74 },onMoving:function(_a
,_b
){
75 },onMoved:function(_c
,_d
){