Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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