1 |
/*
|
1 |
/*
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
3 |
All Rights Reserved.
|
3 |
All Rights Reserved.
|
4 |
|
4 |
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
7 |
|
7 |
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
9 |
*/
|
9 |
*/
|
- |
|
10 |
|
- |
|
11 |
|
10 |
|
12 |
|
11 |
dojo.provide("dojo.dnd.HtmlDragMove");
|
13 |
dojo.provide("dojo.dnd.HtmlDragMove");
|
12 |
dojo.require("dojo.dnd.*");
|
14 |
dojo.require("dojo.dnd.*");
|
13 |
dojo.declare("dojo.dnd.HtmlDragMoveSource", dojo.dnd.HtmlDragSource, {onDragStart:function () {
|
15 |
dojo.declare("dojo.dnd.HtmlDragMoveSource", dojo.dnd.HtmlDragSource, {onDragStart:function () {
|
14 |
var dragObj = new dojo.dnd.HtmlDragMoveObject(this.dragObject, this.type);
|
16 |
var dragObj = new dojo.dnd.HtmlDragMoveObject(this.dragObject, this.type);
|
15 |
if (this.constrainToContainer) {
|
17 |
if (this.constrainToContainer) {
|
16 |
dragObj.constrainTo(this.constrainingContainer);
|
18 |
dragObj.constrainTo(this.constrainingContainer);
|
17 |
}
|
19 |
}
|
18 |
return dragObj;
|
20 |
return dragObj;
|
19 |
}, onSelected:function () {
|
21 |
}, onSelected:function () {
|
20 |
for (var i = 0; i < this.dragObjects.length; i++) {
|
22 |
for (var i = 0; i < this.dragObjects.length; i++) {
|
21 |
dojo.dnd.dragManager.selectedSources.push(new dojo.dnd.HtmlDragMoveSource(this.dragObjects[i]));
|
23 |
dojo.dnd.dragManager.selectedSources.push(new dojo.dnd.HtmlDragMoveSource(this.dragObjects[i]));
|
22 |
}
|
24 |
}
|
23 |
}});
|
25 |
}});
|
24 |
dojo.declare("dojo.dnd.HtmlDragMoveObject", dojo.dnd.HtmlDragObject, {onDragStart:function (e) {
|
26 |
dojo.declare("dojo.dnd.HtmlDragMoveObject", dojo.dnd.HtmlDragObject, {onDragStart:function (e) {
|
25 |
dojo.html.clearSelection();
|
27 |
dojo.html.clearSelection();
|
26 |
this.dragClone = this.domNode;
|
28 |
this.dragClone = this.domNode;
|
27 |
if (dojo.html.getComputedStyle(this.domNode, "position") != "absolute") {
|
29 |
if (dojo.html.getComputedStyle(this.domNode, "position") != "absolute") {
|
28 |
this.domNode.style.position = "relative";
|
30 |
this.domNode.style.position = "relative";
|
29 |
}
|
31 |
}
|
30 |
var left = parseInt(dojo.html.getComputedStyle(this.domNode, "left"));
|
32 |
var left = parseInt(dojo.html.getComputedStyle(this.domNode, "left"));
|
31 |
var top = parseInt(dojo.html.getComputedStyle(this.domNode, "top"));
|
33 |
var top = parseInt(dojo.html.getComputedStyle(this.domNode, "top"));
|
32 |
this.dragStartPosition = {x:isNaN(left) ? 0 : left, y:isNaN(top) ? 0 : top};
|
34 |
this.dragStartPosition = {x:isNaN(left) ? 0 : left, y:isNaN(top) ? 0 : top};
|
33 |
this.scrollOffset = dojo.html.getScroll().offset;
|
35 |
this.scrollOffset = dojo.html.getScroll().offset;
|
34 |
this.dragOffset = {y:this.dragStartPosition.y - e.pageY, x:this.dragStartPosition.x - e.pageX};
|
36 |
this.dragOffset = {y:this.dragStartPosition.y - e.pageY, x:this.dragStartPosition.x - e.pageX};
|
35 |
this.containingBlockPosition = {x:0, y:0};
|
37 |
this.containingBlockPosition = {x:0, y:0};
|
36 |
if (this.constrainToContainer) {
|
38 |
if (this.constrainToContainer) {
|
37 |
this.constraints = this.getConstraints();
|
39 |
this.constraints = this.getConstraints();
|
38 |
}
|
40 |
}
|
39 |
dojo.event.connect(this.domNode, "onclick", this, "_squelchOnClick");
|
41 |
dojo.event.connect(this.domNode, "onclick", this, "_squelchOnClick");
|
40 |
}, onDragEnd:function (e) {
|
42 |
}, onDragEnd:function (e) {
|
41 |
}, setAbsolutePosition:function (x, y) {
|
43 |
}, setAbsolutePosition:function (x, y) {
|
42 |
if (!this.disableY) {
|
44 |
if (!this.disableY) {
|
43 |
this.domNode.style.top = y + "px";
|
45 |
this.domNode.style.top = y + "px";
|
44 |
}
|
46 |
}
|
45 |
if (!this.disableX) {
|
47 |
if (!this.disableX) {
|
46 |
this.domNode.style.left = x + "px";
|
48 |
this.domNode.style.left = x + "px";
|
47 |
}
|
49 |
}
|
48 |
}, _squelchOnClick:function (e) {
|
50 |
}, _squelchOnClick:function (e) {
|
49 |
dojo.event.browser.stopEvent(e);
|
51 |
dojo.event.browser.stopEvent(e);
|
50 |
dojo.event.disconnect(this.domNode, "onclick", this, "_squelchOnClick");
|
52 |
dojo.event.disconnect(this.domNode, "onclick", this, "_squelchOnClick");
|
51 |
}});
|
53 |
}});
|
52 |
|
54 |
|