mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2026-01-04 18:49:15 +00:00
upgrade Dojo to 1.6.1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,9 +8,9 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Avatar"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Avatar"] = true;
|
||||
dojo.provide("dojo.dnd.Avatar");
|
||||
|
||||
dojo.require("dojo.dnd.common");
|
||||
|
||||
|
||||
dojo.declare("dojo.dnd.Avatar", null, {
|
||||
// summary:
|
||||
// Object that represents transferred DnD items visually
|
||||
@@ -93,7 +93,7 @@ dojo.declare("dojo.dnd.Avatar", null, {
|
||||
var icon = dojo.byId("a11yIcon");
|
||||
var text = '+'; // assume canDrop && copy
|
||||
if (this.manager.canDropFlag && !this.manager.copy) {
|
||||
text = '< '; // canDrop && move
|
||||
text = '< '; // canDrop && move
|
||||
}else if (!this.manager.canDropFlag && !this.manager.copy) {
|
||||
text = "o"; //!canDrop && move
|
||||
}else if(!this.manager.canDropFlag){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,10 +8,10 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Container"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Container"] = true;
|
||||
dojo.provide("dojo.dnd.Container");
|
||||
|
||||
dojo.require("dojo.dnd.common");
|
||||
dojo.require("dojo.parser");
|
||||
|
||||
|
||||
/*
|
||||
Container states:
|
||||
"" - normal state
|
||||
@@ -63,7 +63,7 @@ dojo.dnd.Item = function(){
|
||||
|
||||
dojo.declare("dojo.dnd.Container", null, {
|
||||
// summary:
|
||||
// a Container object, which knows when mouse hovers over it,
|
||||
// a Container object, which knows when mouse hovers over it,
|
||||
// and over which element it hovers
|
||||
|
||||
// object attributes (for markup)
|
||||
@@ -140,7 +140,7 @@ dojo.declare("dojo.dnd.Container", null, {
|
||||
},
|
||||
forInItems: function(/*Function*/ f, /*Object?*/ o){
|
||||
// summary:
|
||||
// iterates over a data map skipping members that
|
||||
// iterates over a data map skipping members that
|
||||
// are present in the empty object (IE and/or 3rd-party libraries).
|
||||
o = o || dojo.global;
|
||||
var m = this.map, e = dojo.dnd._empty;
|
||||
@@ -327,8 +327,7 @@ dojo.declare("dojo.dnd.Container", null, {
|
||||
var prefix = "dojoDnd" + type;
|
||||
var state = type.toLowerCase() + "State";
|
||||
//dojo.replaceClass(this.node, prefix + newState, prefix + this[state]);
|
||||
dojo.removeClass(this.node, prefix + this[state]);
|
||||
dojo.addClass(this.node, prefix + newState);
|
||||
dojo.replaceClass(this.node, prefix + newState, prefix + this[state]);
|
||||
this[state] = newState;
|
||||
},
|
||||
_addItemClass: function(node, type){
|
||||
@@ -375,7 +374,7 @@ dojo.declare("dojo.dnd.Container", null, {
|
||||
|
||||
dojo.dnd._createNode = function(tag){
|
||||
// summary:
|
||||
// returns a function, which creates an element of given tag
|
||||
// returns a function, which creates an element of given tag
|
||||
// (SPAN by default) and sets its innerHTML to given text
|
||||
// tag: String
|
||||
// a tag name or empty for SPAN
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,11 +8,11 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Manager"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Manager"] = true;
|
||||
dojo.provide("dojo.dnd.Manager");
|
||||
|
||||
dojo.require("dojo.dnd.common");
|
||||
dojo.require("dojo.dnd.autoscroll");
|
||||
dojo.require("dojo.dnd.Avatar");
|
||||
|
||||
|
||||
dojo.declare("dojo.dnd.Manager", null, {
|
||||
// summary:
|
||||
// the manager of DnD operations (usually a singleton)
|
||||
@@ -84,7 +84,7 @@ dojo.declare("dojo.dnd.Manager", null, {
|
||||
dojo.connect(dojo.body(), "onselectstart", dojo.stopEvent)
|
||||
];
|
||||
var c = "dojoDnd" + (copy ? "Copy" : "Move");
|
||||
dojo.addClass(dojo.body(), c);
|
||||
dojo.addClass(dojo.body(), c);
|
||||
},
|
||||
canDrop: function(flag){
|
||||
// summary:
|
||||
@@ -98,8 +98,7 @@ dojo.declare("dojo.dnd.Manager", null, {
|
||||
stopDrag: function(){
|
||||
// summary:
|
||||
// stop the DnD in progress
|
||||
dojo.removeClass(dojo.body(), "dojoDndCopy");
|
||||
dojo.removeClass(dojo.body(), "dojoDndMove");
|
||||
dojo.removeClass(dojo.body(), ["dojoDndCopy", "dojoDndMove"]);
|
||||
dojo.forEach(this.events, dojo.disconnect);
|
||||
this.events = [];
|
||||
this.avatar.destroy();
|
||||
@@ -132,7 +131,7 @@ dojo.declare("dojo.dnd.Manager", null, {
|
||||
s.left = (e.pageX + this.OFFSET_X) + "px";
|
||||
s.top = (e.pageY + this.OFFSET_Y) + "px";
|
||||
var copy = Boolean(this.source.copyState(dojo.isCopyKey(e)));
|
||||
if(this.copy != copy){
|
||||
if(this.copy != copy){
|
||||
this._setCopyStatus(copy);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +165,7 @@ dojo.declare("dojo.dnd.Manager", null, {
|
||||
switch(e.keyCode){
|
||||
case dojo.keys.CTRL:
|
||||
var copy = Boolean(this.source.copyState(true));
|
||||
if(this.copy != copy){
|
||||
if(this.copy != copy){
|
||||
this._setCopyStatus(copy);
|
||||
}
|
||||
break;
|
||||
@@ -184,7 +183,7 @@ dojo.declare("dojo.dnd.Manager", null, {
|
||||
// keyboard event
|
||||
if(this.avatar && e.keyCode == dojo.keys.CTRL){
|
||||
var copy = Boolean(this.source.copyState(false));
|
||||
if(this.copy != copy){
|
||||
if(this.copy != copy){
|
||||
this._setCopyStatus(copy);
|
||||
}
|
||||
}
|
||||
@@ -199,8 +198,9 @@ dojo.declare("dojo.dnd.Manager", null, {
|
||||
this.copy = copy;
|
||||
this.source._markDndStatus(this.copy);
|
||||
this.updateAvatar();
|
||||
dojo.removeClass(dojo.body(), "dojoDnd" + (this.copy ? "Move" : "Copy"));
|
||||
dojo.addClass(dojo.body(), "dojoDnd" + (this.copy ? "Copy" : "Move"));
|
||||
dojo.replaceClass(dojo.body(),
|
||||
"dojoDnd" + (this.copy ? "Copy" : "Move"),
|
||||
"dojoDnd" + (this.copy ? "Move" : "Copy"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,9 +8,9 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Moveable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Moveable"] = true;
|
||||
dojo.provide("dojo.dnd.Moveable");
|
||||
|
||||
dojo.require("dojo.dnd.Mover");
|
||||
|
||||
|
||||
/*=====
|
||||
dojo.declare("dojo.dnd.__MoveableArgs", [], {
|
||||
// handle: Node||String
|
||||
@@ -54,6 +54,7 @@ dojo.declare("dojo.dnd.Moveable", null, {
|
||||
this.mover = params.mover ? params.mover : dojo.dnd.Mover;
|
||||
this.events = [
|
||||
dojo.connect(this.handle, "onmousedown", this, "onMouseDown"),
|
||||
dojo.connect(this.handle, "ontouchstart", this, "onMouseDown"),
|
||||
// cancel text selection and text dragging
|
||||
dojo.connect(this.handle, "ondragstart", this, "onSelectStart"),
|
||||
dojo.connect(this.handle, "onselectstart", this, "onSelectStart")
|
||||
@@ -76,17 +77,20 @@ dojo.declare("dojo.dnd.Moveable", null, {
|
||||
// mouse event processors
|
||||
onMouseDown: function(e){
|
||||
// summary:
|
||||
// event processor for onmousedown, creates a Mover for the node
|
||||
// event processor for onmousedown/ontouchstart, creates a Mover for the node
|
||||
// e: Event
|
||||
// mouse event
|
||||
// mouse/touch event
|
||||
if(this.skip && dojo.dnd.isFormElement(e)){ return; }
|
||||
if(this.delay){
|
||||
this.events.push(
|
||||
dojo.connect(this.handle, "onmousemove", this, "onMouseMove"),
|
||||
dojo.connect(this.handle, "onmouseup", this, "onMouseUp")
|
||||
dojo.connect(this.handle, "ontouchmove", this, "onMouseMove"),
|
||||
dojo.connect(this.handle, "onmouseup", this, "onMouseUp"),
|
||||
dojo.connect(this.handle, "ontouchend", this, "onMouseUp")
|
||||
);
|
||||
this._lastX = e.pageX;
|
||||
this._lastY = e.pageY;
|
||||
var pos = e.touches ? e.touches[0] : e;
|
||||
this._lastX = pos.pageX;
|
||||
this._lastY = pos.pageY;
|
||||
}else{
|
||||
this.onDragDetected(e);
|
||||
}
|
||||
@@ -94,10 +98,11 @@ dojo.declare("dojo.dnd.Moveable", null, {
|
||||
},
|
||||
onMouseMove: function(e){
|
||||
// summary:
|
||||
// event processor for onmousemove, used only for delayed drags
|
||||
// event processor for onmousemove/ontouchmove, used only for delayed drags
|
||||
// e: Event
|
||||
// mouse event
|
||||
if(Math.abs(e.pageX - this._lastX) > this.delay || Math.abs(e.pageY - this._lastY) > this.delay){
|
||||
// mouse/touch event
|
||||
var pos = e.touches ? e.touches[0] : e;
|
||||
if(Math.abs(pos.pageX - this._lastX) > this.delay || Math.abs(pos.pageY - this._lastY) > this.delay){
|
||||
this.onMouseUp(e);
|
||||
this.onDragDetected(e);
|
||||
}
|
||||
@@ -134,8 +139,8 @@ dojo.declare("dojo.dnd.Moveable", null, {
|
||||
// summary:
|
||||
// called before every move operation
|
||||
dojo.publish("/dnd/move/start", [mover]);
|
||||
dojo.addClass(dojo.body(), "dojoMove");
|
||||
dojo.addClass(this.node, "dojoMoveItem");
|
||||
dojo.addClass(dojo.body(), "dojoMove");
|
||||
dojo.addClass(this.node, "dojoMoveItem");
|
||||
},
|
||||
onMoveStop: function(/* dojo.dnd.Mover */ mover){
|
||||
// summary:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,14 +8,14 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Mover"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Mover"] = true;
|
||||
dojo.provide("dojo.dnd.Mover");
|
||||
|
||||
dojo.require("dojo.dnd.common");
|
||||
dojo.require("dojo.dnd.autoscroll");
|
||||
|
||||
|
||||
dojo.declare("dojo.dnd.Mover", null, {
|
||||
constructor: function(node, e, host){
|
||||
// summary:
|
||||
// an object, which makes a node follow the mouse.
|
||||
// an object which makes a node follow the mouse, or touch-drag on touch devices.
|
||||
// Used as a default mover, and as a base class for custom movers.
|
||||
// node: Node
|
||||
// a node (or node's id) to be moved
|
||||
@@ -26,17 +26,27 @@ dojo.declare("dojo.dnd.Mover", null, {
|
||||
// object which implements the functionality of the move,
|
||||
// and defines proper events (onMoveStart and onMoveStop)
|
||||
this.node = dojo.byId(node);
|
||||
this.marginBox = {l: e.pageX, t: e.pageY};
|
||||
var pos = e.touches ? e.touches[0] : e;
|
||||
this.marginBox = {l: pos.pageX, t: pos.pageY};
|
||||
this.mouseButton = e.button;
|
||||
var h = this.host = host, d = node.ownerDocument,
|
||||
firstEvent = dojo.connect(d, "onmousemove", this, "onFirstMove");
|
||||
var h = (this.host = host), d = node.ownerDocument;
|
||||
this.events = [
|
||||
// At the start of a drag, onFirstMove is called, and then the following two
|
||||
// connects are disconnected
|
||||
dojo.connect(d, "onmousemove", this, "onFirstMove"),
|
||||
dojo.connect(d, "ontouchmove", this, "onFirstMove"),
|
||||
|
||||
// These are called continually during the drag
|
||||
dojo.connect(d, "onmousemove", this, "onMouseMove"),
|
||||
dojo.connect(d, "ontouchmove", this, "onMouseMove"),
|
||||
|
||||
// And these are called at the end of the drag
|
||||
dojo.connect(d, "onmouseup", this, "onMouseUp"),
|
||||
dojo.connect(d, "ontouchend", this, "onMouseUp"),
|
||||
|
||||
// cancel text selection and text dragging
|
||||
dojo.connect(d, "ondragstart", dojo.stopEvent),
|
||||
dojo.connect(d.body, "onselectstart", dojo.stopEvent),
|
||||
firstEvent
|
||||
dojo.connect(d.body, "onselectstart", dojo.stopEvent)
|
||||
];
|
||||
// notify that the move has started
|
||||
if(h && h.onMoveStart){
|
||||
@@ -46,17 +56,18 @@ dojo.declare("dojo.dnd.Mover", null, {
|
||||
// mouse event processors
|
||||
onMouseMove: function(e){
|
||||
// summary:
|
||||
// event processor for onmousemove
|
||||
// event processor for onmousemove/ontouchmove
|
||||
// e: Event
|
||||
// mouse event
|
||||
// mouse/touch event
|
||||
dojo.dnd.autoScroll(e);
|
||||
var m = this.marginBox;
|
||||
this.host.onMove(this, {l: m.l + e.pageX, t: m.t + e.pageY}, e);
|
||||
var m = this.marginBox,
|
||||
pos = e.touches ? e.touches[0] : e;
|
||||
this.host.onMove(this, {l: m.l + pos.pageX, t: m.t + pos.pageY}, e);
|
||||
dojo.stopEvent(e);
|
||||
},
|
||||
onMouseUp: function(e){
|
||||
if(dojo.isWebKit && dojo.isMac && this.mouseButton == 2 ?
|
||||
e.button == 0 : this.mouseButton == e.button){
|
||||
if(dojo.isWebKit && dojo.isMac && this.mouseButton == 2 ?
|
||||
e.button == 0 : this.mouseButton == e.button){ // TODO Should condition be met for touch devices, too?
|
||||
this.destroy();
|
||||
}
|
||||
dojo.stopEvent(e);
|
||||
@@ -64,7 +75,7 @@ dojo.declare("dojo.dnd.Mover", null, {
|
||||
// utilities
|
||||
onFirstMove: function(e){
|
||||
// summary:
|
||||
// makes the node absolute; it is meant to be called only once.
|
||||
// makes the node absolute; it is meant to be called only once.
|
||||
// relative and absolutely positioned nodes are assumed to use pixel units
|
||||
var s = this.node.style, l, t, h = this.host;
|
||||
switch(s.position){
|
||||
@@ -84,7 +95,7 @@ dojo.declare("dojo.dnd.Mover", null, {
|
||||
// space into account - so we need to subtract the combined
|
||||
// padding and margin. We use getComputedStyle and
|
||||
// _getMarginBox/_getContentBox to avoid the extra lookup of
|
||||
// the computed style.
|
||||
// the computed style.
|
||||
var b = dojo.doc.body;
|
||||
var bs = dojo.getComputedStyle(b);
|
||||
var bm = dojo._getMarginBox(b, bs);
|
||||
@@ -98,7 +109,10 @@ dojo.declare("dojo.dnd.Mover", null, {
|
||||
if(h && h.onFirstMove){
|
||||
h.onFirstMove(this, e);
|
||||
}
|
||||
dojo.disconnect(this.events.pop());
|
||||
|
||||
// Disconnect onmousemove and ontouchmove events that call this function
|
||||
dojo.disconnect(this.events.shift());
|
||||
dojo.disconnect(this.events.shift());
|
||||
},
|
||||
destroy: function(){
|
||||
// summary:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,10 +8,10 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Selector"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Selector"] = true;
|
||||
dojo.provide("dojo.dnd.Selector");
|
||||
|
||||
dojo.require("dojo.dnd.common");
|
||||
dojo.require("dojo.dnd.Container");
|
||||
|
||||
|
||||
/*
|
||||
Container item states:
|
||||
"" - an item is not selected
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,10 +8,10 @@
|
||||
if(!dojo._hasResource["dojo.dnd.Source"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.Source"] = true;
|
||||
dojo.provide("dojo.dnd.Source");
|
||||
|
||||
dojo.require("dojo.dnd.Selector");
|
||||
dojo.require("dojo.dnd.Manager");
|
||||
|
||||
|
||||
/*
|
||||
Container property:
|
||||
"Horizontal"- if this is the horizontal container
|
||||
@@ -89,11 +89,11 @@ dojo.declare("dojo.dnd.Source", dojo.dnd.Selector, {
|
||||
generateText: true,
|
||||
|
||||
constructor: function(/*DOMNode|String*/node, /*dojo.dnd.__SourceArgs?*/params){
|
||||
// summary:
|
||||
// summary:
|
||||
// a constructor of the Source
|
||||
// node:
|
||||
// node or node's id to build the source on
|
||||
// params:
|
||||
// params:
|
||||
// any property of this class may be configured via the params
|
||||
// object which is mixed-in to the `dojo.dnd.Source` instance
|
||||
dojo.mixin(this, dojo.mixin({}, params));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,9 +8,9 @@
|
||||
if(!dojo._hasResource["dojo.dnd.TimedMoveable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.TimedMoveable"] = true;
|
||||
dojo.provide("dojo.dnd.TimedMoveable");
|
||||
|
||||
dojo.require("dojo.dnd.Moveable");
|
||||
|
||||
|
||||
/*=====
|
||||
dojo.declare("dojo.dnd.__TimedMoveableArgs", [dojo.dnd.__MoveableArgs], {
|
||||
// timeout: Number
|
||||
@@ -27,7 +27,7 @@ dojo.declare("dojo.dnd.__TimedMoveableArgs", [dojo.dnd.__MoveableArgs], {
|
||||
dojo.declare("dojo.dnd.TimedMoveable", dojo.dnd.Moveable, {
|
||||
// summary:
|
||||
// A specialized version of Moveable to support an FPS throttling.
|
||||
// This class puts an upper restriction on FPS, which may reduce
|
||||
// This class puts an upper restriction on FPS, which may reduce
|
||||
// the CPU load. The additional parameter "timeout" regulates
|
||||
// the delay before actually moving the moveable object.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,26 +8,11 @@
|
||||
if(!dojo._hasResource["dojo.dnd.autoscroll"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.autoscroll"] = true;
|
||||
dojo.provide("dojo.dnd.autoscroll");
|
||||
dojo.require("dojo.window");
|
||||
|
||||
dojo.dnd.getViewport = function(){
|
||||
// summary:
|
||||
// Returns a viewport size (visible part of the window)
|
||||
dojo.getObject("dnd", true, dojo);
|
||||
|
||||
// TODO: remove this when getViewport() moved to dojo core, see #7028
|
||||
|
||||
// FIXME: need more docs!!
|
||||
var d = dojo.doc, dd = d.documentElement, w = window, b = dojo.body();
|
||||
if(dojo.isMozilla){
|
||||
return {w: dd.clientWidth, h: w.innerHeight}; // Object
|
||||
}else if(!dojo.isOpera && w.innerWidth){
|
||||
return {w: w.innerWidth, h: w.innerHeight}; // Object
|
||||
}else if (!dojo.isOpera && dd && dd.clientWidth){
|
||||
return {w: dd.clientWidth, h: dd.clientHeight}; // Object
|
||||
}else if (b.clientWidth){
|
||||
return {w: b.clientWidth, h: b.clientHeight}; // Object
|
||||
}
|
||||
return null; // Object
|
||||
};
|
||||
dojo.dnd.getViewport = dojo.window.getBox;
|
||||
|
||||
dojo.dnd.V_TRIGGER_AUTOSCROLL = 32;
|
||||
dojo.dnd.H_TRIGGER_AUTOSCROLL = 32;
|
||||
@@ -43,7 +28,7 @@ dojo.dnd.autoScroll = function(e){
|
||||
// onmousemove event
|
||||
|
||||
// FIXME: needs more docs!
|
||||
var v = dojo.dnd.getViewport(), dx = 0, dy = 0;
|
||||
var v = dojo.window.getBox(), dx = 0, dy = 0;
|
||||
if(e.clientX < dojo.dnd.H_TRIGGER_AUTOSCROLL){
|
||||
dx = -dojo.dnd.H_AUTOSCROLL_VALUE;
|
||||
}else if(e.clientX > v.w - dojo.dnd.H_TRIGGER_AUTOSCROLL){
|
||||
@@ -74,14 +59,15 @@ dojo.dnd.autoScrollNodes = function(e){
|
||||
if(s.overflow.toLowerCase() in dojo.dnd._validOverflow){
|
||||
var b = dojo._getContentBox(n, s), t = dojo.position(n, true);
|
||||
//console.log(b.l, b.t, t.x, t.y, n.scrollLeft, n.scrollTop);
|
||||
var w = Math.min(dojo.dnd.H_TRIGGER_AUTOSCROLL, b.w / 2),
|
||||
var w = Math.min(dojo.dnd.H_TRIGGER_AUTOSCROLL, b.w / 2),
|
||||
h = Math.min(dojo.dnd.V_TRIGGER_AUTOSCROLL, b.h / 2),
|
||||
rx = e.pageX - t.x, ry = e.pageY - t.y, dx = 0, dy = 0;
|
||||
if(dojo.isWebKit || dojo.isOpera){
|
||||
// FIXME: this code should not be here, it should be taken into account
|
||||
// FIXME: this code should not be here, it should be taken into account
|
||||
// either by the event fixing code, or the dojo.position()
|
||||
// FIXME: this code doesn't work on Opera 9.5 Beta
|
||||
rx += dojo.body().scrollLeft, ry += dojo.body().scrollTop;
|
||||
rx += dojo.body().scrollLeft;
|
||||
ry += dojo.body().scrollTop;
|
||||
}
|
||||
if(rx > 0 && rx < b.w){
|
||||
if(rx < w){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -9,6 +9,8 @@ if(!dojo._hasResource["dojo.dnd.common"]){ //_hasResource checks added by build.
|
||||
dojo._hasResource["dojo.dnd.common"] = true;
|
||||
dojo.provide("dojo.dnd.common");
|
||||
|
||||
dojo.getObject("dnd", true, dojo);
|
||||
|
||||
dojo.dnd.getCopyKeyState = dojo.isCopyKey;
|
||||
|
||||
dojo.dnd._uniqueId = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
@@ -8,10 +8,10 @@
|
||||
if(!dojo._hasResource["dojo.dnd.move"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.dnd.move"] = true;
|
||||
dojo.provide("dojo.dnd.move");
|
||||
|
||||
dojo.require("dojo.dnd.Mover");
|
||||
dojo.require("dojo.dnd.Moveable");
|
||||
|
||||
|
||||
/*=====
|
||||
dojo.declare("dojo.dnd.move.__constrainedMoveableArgs", [dojo.dnd.__MoveableArgs], {
|
||||
// constraints: Function
|
||||
@@ -55,7 +55,7 @@ dojo.declare("dojo.dnd.move.constrainedMoveable", dojo.dnd.Moveable, {
|
||||
c.r = c.l + c.w;
|
||||
c.b = c.t + c.h;
|
||||
if(this.within){
|
||||
var mb = dojo.marginBox(mover.node);
|
||||
var mb = dojo._getMarginSize(mover.node);
|
||||
c.r -= mb.w;
|
||||
c.b -= mb.h;
|
||||
}
|
||||
@@ -65,8 +65,12 @@ dojo.declare("dojo.dnd.move.constrainedMoveable", dojo.dnd.Moveable, {
|
||||
// called during every move notification;
|
||||
// should actually move the node; can be overwritten.
|
||||
var c = this.constraintBox, s = mover.node.style;
|
||||
s.left = (leftTop.l < c.l ? c.l : c.r < leftTop.l ? c.r : leftTop.l) + "px";
|
||||
s.top = (leftTop.t < c.t ? c.t : c.b < leftTop.t ? c.b : leftTop.t) + "px";
|
||||
this.onMoving(mover, leftTop);
|
||||
leftTop.l = leftTop.l < c.l ? c.l : c.r < leftTop.l ? c.r : leftTop.l;
|
||||
leftTop.t = leftTop.t < c.t ? c.t : c.b < leftTop.t ? c.b : leftTop.t;
|
||||
s.left = leftTop.l + "px";
|
||||
s.top = leftTop.t + "px";
|
||||
this.onMoved(mover, leftTop);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -128,8 +132,8 @@ dojo.declare("dojo.dnd.move.parentConstrainedMoveable", dojo.dnd.move.constraine
|
||||
// an optional object with parameters
|
||||
var area = params && params.area;
|
||||
this.constraints = function(){
|
||||
var n = this.node.parentNode,
|
||||
s = dojo.getComputedStyle(n),
|
||||
var n = this.node.parentNode,
|
||||
s = dojo.getComputedStyle(n),
|
||||
mb = dojo._getMarginBox(n, s);
|
||||
if(area == "margin"){
|
||||
return mb; // Object
|
||||
@@ -151,100 +155,6 @@ dojo.declare("dojo.dnd.move.parentConstrainedMoveable", dojo.dnd.move.constraine
|
||||
}
|
||||
});
|
||||
|
||||
// WARNING: below are obsolete objects, instead of custom movers use custom moveables (above)
|
||||
|
||||
dojo.dnd.move.constrainedMover = function(fun, within){
|
||||
// summary:
|
||||
// returns a constrained version of dojo.dnd.Mover
|
||||
// description:
|
||||
// this function produces n object, which will put a constraint on
|
||||
// the margin box of dragged object in absolute coordinates
|
||||
// fun: Function
|
||||
// called on drag, and returns a constraint box
|
||||
// within: Boolean
|
||||
// if true, constraints the whole dragged object withtin the rectangle,
|
||||
// otherwise the constraint is applied to the left-top corner
|
||||
|
||||
dojo.deprecated("dojo.dnd.move.constrainedMover, use dojo.dnd.move.constrainedMoveable instead");
|
||||
var mover = function(node, e, notifier){
|
||||
dojo.dnd.Mover.call(this, node, e, notifier);
|
||||
};
|
||||
dojo.extend(mover, dojo.dnd.Mover.prototype);
|
||||
dojo.extend(mover, {
|
||||
onMouseMove: function(e){
|
||||
// summary: event processor for onmousemove
|
||||
// e: Event: mouse event
|
||||
dojo.dnd.autoScroll(e);
|
||||
var m = this.marginBox, c = this.constraintBox,
|
||||
l = m.l + e.pageX, t = m.t + e.pageY;
|
||||
l = l < c.l ? c.l : c.r < l ? c.r : l;
|
||||
t = t < c.t ? c.t : c.b < t ? c.b : t;
|
||||
this.host.onMove(this, {l: l, t: t});
|
||||
},
|
||||
onFirstMove: function(){
|
||||
// summary: called once to initialize things; it is meant to be called only once
|
||||
dojo.dnd.Mover.prototype.onFirstMove.call(this);
|
||||
var c = this.constraintBox = fun.call(this);
|
||||
c.r = c.l + c.w;
|
||||
c.b = c.t + c.h;
|
||||
if(within){
|
||||
var mb = dojo.marginBox(this.node);
|
||||
c.r -= mb.w;
|
||||
c.b -= mb.h;
|
||||
}
|
||||
}
|
||||
});
|
||||
return mover; // Object
|
||||
};
|
||||
|
||||
dojo.dnd.move.boxConstrainedMover = function(box, within){
|
||||
// summary:
|
||||
// a specialization of dojo.dnd.constrainedMover, which constrains to the specified box
|
||||
// box: Object
|
||||
// a constraint box (l, t, w, h)
|
||||
// within: Boolean
|
||||
// if true, constraints the whole dragged object withtin the rectangle,
|
||||
// otherwise the constraint is applied to the left-top corner
|
||||
|
||||
dojo.deprecated("dojo.dnd.move.boxConstrainedMover, use dojo.dnd.move.boxConstrainedMoveable instead");
|
||||
return dojo.dnd.move.constrainedMover(function(){ return box; }, within); // Object
|
||||
};
|
||||
|
||||
dojo.dnd.move.parentConstrainedMover = function(area, within){
|
||||
// summary:
|
||||
// a specialization of dojo.dnd.constrainedMover, which constrains to the parent node
|
||||
// area: String
|
||||
// "margin" to constrain within the parent's margin box, "border" for the border box,
|
||||
// "padding" for the padding box, and "content" for the content box; "content" is the default value.
|
||||
// within: Boolean
|
||||
// if true, constraints the whole dragged object within the rectangle,
|
||||
// otherwise the constraint is applied to the left-top corner
|
||||
|
||||
dojo.deprecated("dojo.dnd.move.parentConstrainedMover, use dojo.dnd.move.parentConstrainedMoveable instead");
|
||||
var fun = function(){
|
||||
var n = this.node.parentNode,
|
||||
s = dojo.getComputedStyle(n),
|
||||
mb = dojo._getMarginBox(n, s);
|
||||
if(area == "margin"){
|
||||
return mb; // Object
|
||||
}
|
||||
var t = dojo._getMarginExtents(n, s);
|
||||
mb.l += t.l, mb.t += t.t, mb.w -= t.w, mb.h -= t.h;
|
||||
if(area == "border"){
|
||||
return mb; // Object
|
||||
}
|
||||
t = dojo._getBorderExtents(n, s);
|
||||
mb.l += t.l, mb.t += t.t, mb.w -= t.w, mb.h -= t.h;
|
||||
if(area == "padding"){
|
||||
return mb; // Object
|
||||
}
|
||||
t = dojo._getPadExtents(n, s);
|
||||
mb.l += t.l, mb.t += t.t, mb.w -= t.w, mb.h -= t.h;
|
||||
return mb; // Object
|
||||
};
|
||||
return dojo.dnd.move.constrainedMover(fun, within); // Object
|
||||
};
|
||||
|
||||
// patching functions one level up for compatibility
|
||||
|
||||
dojo.dnd.constrainedMover = dojo.dnd.move.constrainedMover;
|
||||
|
||||
Reference in New Issue
Block a user