init
This commit is contained in:
8
jssource/src_files/include/javascript/yui3/build/dd/dd-constrain-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-constrain-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-constrain",function(B){var K="dragNode",M="offsetHeight",F="offsetWidth",Q="host",P="constrain2region",H="constrain2node",G="tickXArray",O="tickYArray",N=B.DD.DDM,E="top",J="right",L="bottom",D="left",I=null;var A=function(C){A.superclass.constructor.apply(this,arguments);};A.NAME="DragConstrained";A.NS="con";A.ATTRS={host:{},stickX:{value:false},stickY:{value:false},tickX:{value:false},tickY:{value:false},tickXArray:{value:false},tickYArray:{value:false},constrain2region:{value:false,getter:function(C){if(B.Lang.isObject(C)){var R={};B.mix(R,C);return R;}else{return false;}},setter:function(C){if(B.Lang.isObject(C)){if(B.Lang.isNumber(C[E])&&B.Lang.isNumber(C[J])&&B.Lang.isNumber(C[D])&&B.Lang.isNumber(C[L])){var R={};B.mix(R,C);return R;}else{return false;}}else{if(C!==false){return false;}}return C;}},gutter:{value:"0",setter:function(C){return B.DD.DDM.cssSizestoObject(C);}},constrain2node:{value:false,setter:function(R){if(!this.get(P)){var C=B.Node.get(R);if(C){return C;}}else{if(this.get(P)!==false){}}return false;}},constrain2view:{value:false}};I={initializer:function(){this.get(Q).on("drag:start",B.bind(this._handleStart,this));this.get(Q).after("drag:align",B.bind(this.align,this));},_handleStart:function(){this._regionCache=null;},_regionCache:null,_cacheRegion:function(){this._regionCache=this.get(H).get("region");},getRegion:function(V){var T={},U=null,C=null,S=this.get("gutter"),R=this.get(Q);if(this.get(H)){if(!this._regionCache){B.on("resize",B.bind(this._cacheRegion,this),window);this._cacheRegion();}T=B.clone(this._regionCache);}else{if(this.get(P)){T=this.get(P);}else{if(this.get("constrain2view")){T=R.get(K).get("viewportRegion");}else{return false;}}}B.each(S,function(W,X){if((X==J)||(X==L)){T[X]-=W;}else{T[X]+=W;}});if(V){U=R.get(K).get(M);C=R.get(K).get(F);T[J]=T[J]-C;T[L]=T[L]-U;}return T;},_checkRegion:function(C){var S=C,U=this.getRegion(),T=this.get(Q),V=T.get(K).get(M),R=T.get(K).get(F);if(S[1]>(U[L]-V)){C[1]=(U[L]-V);}if(U[E]>S[1]){C[1]=U[E];}if(S[0]>(U[J]-R)){C[0]=(U[J]-R);}if(U[D]>S[0]){C[0]=U[D];}return C;},inRegion:function(S){S=S||this.get(Q).get(K).getXY();var R=this._checkRegion([S[0],S[1]]),C=false;if((S[0]===R[0])&&(S[1]===R[1])){C=true;}return C;},align:function(){var S=this.get(Q),C=S.actXY,R=this.getRegion(true);if(this.get("stickX")){C[1]=(S.startXY[1]-S.deltaXY[1]);}if(this.get("stickY")){C[0]=(S.startXY[0]-S.deltaXY[0]);}if(R){C=this._checkRegion(C);}C=this._checkTicks(C,R);S.actXY=C;},_checkTicks:function(W,U){var T=this.get(Q),V=(T.startXY[0]-T.deltaXY[0]),S=(T.startXY[1]-T.deltaXY[1]),C=this.get("tickX"),R=this.get("tickY");if(C&&!this.get(G)){W[0]=N._calcTicks(W[0],V,C,U[D],U[J]);}if(R&&!this.get(O)){W[1]=N._calcTicks(W[1],S,R,U[E],U[L]);}if(this.get(G)){W[0]=N._calcTickArray(W[0],this.get(G),U[D],U[J]);}if(this.get(O)){W[1]=N._calcTickArray(W[1],this.get(O),U[E],U[L]);}return W;}};B.namespace("Plugin");B.extend(A,B.Base,I);B.Plugin.DDConstrained=A;B.mix(N,{_calcTicks:function(X,W,T,V,U){var R=((X-W)/T),S=Math.floor(R),C=Math.ceil(R);if((S!==0)||(C!==0)){if((R>=S)&&(R<=C)){X=(W+(T*S));if(V&&U){if(X<V){X=(W+(T*(S+1)));}if(X>U){X=(W+(T*(S-1)));}}}}return X;},_calcTickArray:function(Y,Z,X,U){var R=0,V=Z.length,T=0,S,C,W;if(!Z||(Z.length===0)){return Y;}else{if(Z[0]>=Y){return Z[0];}else{for(R=0;R<V;R++){T=(R+1);if(Z[T]&&Z[T]>=Y){S=Y-Z[R];C=Z[T]-Y;W=(C>S)?Z[R]:Z[T];if(X&&U){if(W>U){if(Z[R]){W=Z[R];}else{W=Z[V-1];}}}return W;}}return Z[Z.length-1];}}}});},"3.0.0",{requires:["dd-drag"],skinnable:false});
|
||||
425
jssource/src_files/include/javascript/yui3/build/dd/dd-constrain.js
vendored
Normal file
425
jssource/src_files/include/javascript/yui3/build/dd/dd-constrain.js
vendored
Normal file
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-constrain', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* The Drag & Drop Utility allows you to create a draggable interface efficiently, buffering you from browser-level abnormalities and enabling you to focus on the interesting logic surrounding your particular implementation. This component enables you to create a variety of standard draggable objects with just a few lines of code and then, using its extensive API, add your own specific implementation logic.
|
||||
* @module dd
|
||||
* @submodule dd-constrain
|
||||
*/
|
||||
/**
|
||||
* This is a plugin for the dd-drag module to add the constraining methods to it. It supports constraining to a renodenode or viewport. It anode* supports tick based moves and XY axis constraints.
|
||||
* @class DragConstrained
|
||||
* @extends Base
|
||||
* @constructor
|
||||
* @namespace Plugin
|
||||
*/
|
||||
|
||||
var DRAG_NODE = 'dragNode',
|
||||
OFFSET_HEIGHT = 'offsetHeight',
|
||||
OFFSET_WIDTH = 'offsetWidth',
|
||||
HOST = 'host',
|
||||
CON_2_REGION = 'constrain2region',
|
||||
CON_2_NODE = 'constrain2node',
|
||||
TICK_X_ARRAY = 'tickXArray',
|
||||
TICK_Y_ARRAY = 'tickYArray',
|
||||
DDM = Y.DD.DDM,
|
||||
TOP = 'top',
|
||||
RIGHT = 'right',
|
||||
BOTTOM = 'bottom',
|
||||
LEFT = 'left',
|
||||
proto = null;
|
||||
|
||||
var C = function(config) {
|
||||
C.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
|
||||
C.NAME = 'DragConstrained';
|
||||
/**
|
||||
* @property con
|
||||
* @description The Constrained instance will be placed on the Drag instance under the con namespace.
|
||||
* @type {String}
|
||||
*/
|
||||
C.NS = 'con';
|
||||
|
||||
C.ATTRS = {
|
||||
host: {
|
||||
},
|
||||
/**
|
||||
* @attribute stickX
|
||||
* @description Stick the drag movement to the X-Axis. Default: false
|
||||
* @type Boolean
|
||||
*/
|
||||
stickX: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute stickY
|
||||
* @description Stick the drag movement to the Y-Axis
|
||||
* @type Boolean
|
||||
*/
|
||||
stickY: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute tickX
|
||||
* @description The X tick offset the drag node should snap to on each drag move. False for no ticks. Default: false
|
||||
* @type Number/false
|
||||
*/
|
||||
tickX: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute tickY
|
||||
* @description The Y tick offset the drag node should snap to on each drag move. False for no ticks. Default: false
|
||||
* @type Number/false
|
||||
*/
|
||||
tickY: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute tickXArray
|
||||
* @description An array of page coordinates to use as X ticks for drag movement.
|
||||
* @type Array
|
||||
*/
|
||||
tickXArray: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute tickYArray
|
||||
* @description An array of page coordinates to use as Y ticks for drag movement.
|
||||
* @type Array
|
||||
*/
|
||||
tickYArray: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute constrain2region
|
||||
* @description An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to.
|
||||
* @type Object
|
||||
*/
|
||||
constrain2region: {
|
||||
value: false,
|
||||
getter: function(r) {
|
||||
if (Y.Lang.isObject(r)) {
|
||||
var o = {};
|
||||
Y.mix(o, r);
|
||||
return o;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
setter: function (r) {
|
||||
if (Y.Lang.isObject(r)) {
|
||||
if (Y.Lang.isNumber(r[TOP]) && Y.Lang.isNumber(r[RIGHT]) && Y.Lang.isNumber(r[LEFT]) && Y.Lang.isNumber(r[BOTTOM])) {
|
||||
var o = {};
|
||||
Y.mix(o, r);
|
||||
return o;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (r !== false) {
|
||||
return false;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute gutter
|
||||
* @description CSS style string for the gutter of a region (supports negative values): '5 0' (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px)
|
||||
* @type String
|
||||
*/
|
||||
gutter: {
|
||||
value: '0',
|
||||
setter: function(gutter) {
|
||||
return Y.DD.DDM.cssSizestoObject(gutter);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute constrain2node
|
||||
* @description Will attempt to constrain the drag node to the boundaries of this node.
|
||||
* @type Object
|
||||
*/
|
||||
constrain2node: {
|
||||
value: false,
|
||||
setter: function(n) {
|
||||
if (!this.get(CON_2_REGION)) {
|
||||
var node = Y.Node.get(n);
|
||||
if (node) {
|
||||
return node;
|
||||
}
|
||||
} else if (this.get(CON_2_REGION) !== false) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute constrain2view
|
||||
* @description Will attempt to constrain the drag node to the boundaries of the viewport region.
|
||||
* @type Object
|
||||
*/
|
||||
constrain2view: {
|
||||
value: false
|
||||
}
|
||||
};
|
||||
|
||||
proto = {
|
||||
initializer: function() {
|
||||
this.get(HOST).on('drag:start', Y.bind(this._handleStart, this));
|
||||
this.get(HOST).after('drag:align', Y.bind(this.align, this));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _handleStart
|
||||
* @description Fires on drag:start and clears the _regionCache
|
||||
*/
|
||||
_handleStart: function() {
|
||||
this._regionCache = null;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @property _regionCache
|
||||
* @description Store a cache of the region that we are constraining to
|
||||
* @type Object
|
||||
*/
|
||||
_regionCache: null,
|
||||
/**
|
||||
* @private
|
||||
* @method _cacheRegion
|
||||
* @description Get's the region and caches it, called from window.resize and when the cache is null
|
||||
*/
|
||||
_cacheRegion: function() {
|
||||
this._regionCache = this.get(CON_2_NODE).get('region');
|
||||
},
|
||||
/**
|
||||
* @method getRegion
|
||||
* @description Get the active region: viewport, node, custom region
|
||||
* @param {Boolean} inc Include the node's height and width
|
||||
* @return {Object}
|
||||
*/
|
||||
getRegion: function(inc) {
|
||||
var r = {}, oh = null, ow = null,
|
||||
g = this.get('gutter'),
|
||||
host = this.get(HOST);
|
||||
|
||||
if (this.get(CON_2_NODE)) {
|
||||
if (!this._regionCache) {
|
||||
Y.on('resize', Y.bind(this._cacheRegion, this), window);
|
||||
this._cacheRegion();
|
||||
}
|
||||
r = Y.clone(this._regionCache);
|
||||
} else if (this.get(CON_2_REGION)) {
|
||||
r = this.get(CON_2_REGION);
|
||||
} else if (this.get('constrain2view')) {
|
||||
r = host.get(DRAG_NODE).get('viewportRegion');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
Y.each(g, function(i, n) {
|
||||
if ((n == RIGHT) || (n == BOTTOM)) {
|
||||
r[n] -= i;
|
||||
} else {
|
||||
r[n] += i;
|
||||
}
|
||||
});
|
||||
if (inc) {
|
||||
oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT);
|
||||
ow = host.get(DRAG_NODE).get(OFFSET_WIDTH);
|
||||
r[RIGHT] = r[RIGHT] - ow;
|
||||
r[BOTTOM] = r[BOTTOM] - oh;
|
||||
}
|
||||
return r;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _checkRegion
|
||||
* @description Check if xy is inside a given region, if not change to it be inside.
|
||||
* @param {Array} _xy The XY to check if it's in the current region, if it isn't inside the region, it will reset the xy array to be inside the region.
|
||||
* @return {Array} The new XY that is inside the region
|
||||
*/
|
||||
_checkRegion: function(_xy) {
|
||||
var oxy = _xy,
|
||||
r = this.getRegion(),
|
||||
host = this.get(HOST),
|
||||
oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT),
|
||||
ow = host.get(DRAG_NODE).get(OFFSET_WIDTH);
|
||||
|
||||
if (oxy[1] > (r[BOTTOM] - oh)) {
|
||||
_xy[1] = (r[BOTTOM] - oh);
|
||||
}
|
||||
if (r[TOP] > oxy[1]) {
|
||||
_xy[1] = r[TOP];
|
||||
|
||||
}
|
||||
if (oxy[0] > (r[RIGHT] - ow)) {
|
||||
_xy[0] = (r[RIGHT] - ow);
|
||||
}
|
||||
if (r[LEFT] > oxy[0]) {
|
||||
_xy[0] = r[LEFT];
|
||||
}
|
||||
|
||||
return _xy;
|
||||
},
|
||||
/**
|
||||
* @method inRegion
|
||||
* @description Checks if the XY passed or the dragNode is inside the active region.
|
||||
* @param {Array} xy Optional XY to check, if not supplied this.get('dragNode').getXY() is used.
|
||||
* @return {Boolean} True if the XY is inside the region, false otherwise.
|
||||
*/
|
||||
inRegion: function(xy) {
|
||||
xy = xy || this.get(HOST).get(DRAG_NODE).getXY();
|
||||
|
||||
var _xy = this._checkRegion([xy[0], xy[1]]),
|
||||
inside = false;
|
||||
if ((xy[0] === _xy[0]) && (xy[1] === _xy[1])) {
|
||||
inside = true;
|
||||
}
|
||||
return inside;
|
||||
},
|
||||
/**
|
||||
* @method align
|
||||
* @description Modifies the Drag.actXY method from the after drag:align event. This is where the constraining happens.
|
||||
*/
|
||||
align: function() {
|
||||
var host = this.get(HOST),
|
||||
_xy = host.actXY,
|
||||
r = this.getRegion(true);
|
||||
|
||||
if (this.get('stickX')) {
|
||||
_xy[1] = (host.startXY[1] - host.deltaXY[1]);
|
||||
}
|
||||
if (this.get('stickY')) {
|
||||
_xy[0] = (host.startXY[0] - host.deltaXY[0]);
|
||||
}
|
||||
|
||||
if (r) {
|
||||
_xy = this._checkRegion(_xy);
|
||||
}
|
||||
|
||||
_xy = this._checkTicks(_xy, r);
|
||||
host.actXY = _xy;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _checkTicks
|
||||
* @description This method delegates the proper helper method for tick calculations
|
||||
* @param {Array} xy The XY coords for the Drag
|
||||
* @param {Object} r The optional region that we are bound to.
|
||||
* @return {Array} The calced XY coords
|
||||
*/
|
||||
_checkTicks: function(xy, r) {
|
||||
var host = this.get(HOST),
|
||||
lx = (host.startXY[0] - host.deltaXY[0]),
|
||||
ly = (host.startXY[1] - host.deltaXY[1]),
|
||||
xt = this.get('tickX'),
|
||||
yt = this.get('tickY');
|
||||
if (xt && !this.get(TICK_X_ARRAY)) {
|
||||
xy[0] = DDM._calcTicks(xy[0], lx, xt, r[LEFT], r[RIGHT]);
|
||||
}
|
||||
if (yt && !this.get(TICK_Y_ARRAY)) {
|
||||
xy[1] = DDM._calcTicks(xy[1], ly, yt, r[TOP], r[BOTTOM]);
|
||||
}
|
||||
if (this.get(TICK_X_ARRAY)) {
|
||||
xy[0] = DDM._calcTickArray(xy[0], this.get(TICK_X_ARRAY), r[LEFT], r[RIGHT]);
|
||||
}
|
||||
if (this.get(TICK_Y_ARRAY)) {
|
||||
xy[1] = DDM._calcTickArray(xy[1], this.get(TICK_Y_ARRAY), r[TOP], r[BOTTOM]);
|
||||
}
|
||||
|
||||
return xy;
|
||||
}
|
||||
};
|
||||
|
||||
Y.namespace('Plugin');
|
||||
Y.extend(C, Y.Base, proto);
|
||||
Y.Plugin.DDConstrained = C;
|
||||
|
||||
Y.mix(DDM, {
|
||||
/**
|
||||
* @for DDM
|
||||
* @namespace DD
|
||||
* @private
|
||||
* @method _calcTicks
|
||||
* @description Helper method to calculate the tick offsets for a given position
|
||||
* @param {Number} pos The current X or Y position
|
||||
* @param {Number} start The start X or Y position
|
||||
* @param {Number} tick The X or Y tick increment
|
||||
* @param {Number} off1 The min offset that we can't pass (region)
|
||||
* @param {Number} off2 The max offset that we can't pass (region)
|
||||
* @return {Number} The new position based on the tick calculation
|
||||
*/
|
||||
_calcTicks: function(pos, start, tick, off1, off2) {
|
||||
var ix = ((pos - start) / tick),
|
||||
min = Math.floor(ix),
|
||||
max = Math.ceil(ix);
|
||||
if ((min !== 0) || (max !== 0)) {
|
||||
if ((ix >= min) && (ix <= max)) {
|
||||
pos = (start + (tick * min));
|
||||
if (off1 && off2) {
|
||||
if (pos < off1) {
|
||||
pos = (start + (tick * (min + 1)));
|
||||
}
|
||||
if (pos > off2) {
|
||||
pos = (start + (tick * (min - 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
},
|
||||
/**
|
||||
* @for DDM
|
||||
* @namespace DD
|
||||
* @private
|
||||
* @method _calcTickArray
|
||||
* @description This method is used with the tickXArray and tickYArray config options
|
||||
* @param {Number} pos The current X or Y position
|
||||
* @param {Number} ticks The array containing our custom tick positions.
|
||||
* @param {Number} off1 The min offset that we can't pass (region)
|
||||
* @param {Number} off2 The max offset that we can't pass (region)
|
||||
* @return The tick position
|
||||
*/
|
||||
_calcTickArray: function(pos, ticks, off1, off2) {
|
||||
var i = 0, len = ticks.length, next = 0,
|
||||
diff1, diff2, ret;
|
||||
|
||||
if (!ticks || (ticks.length === 0)) {
|
||||
return pos;
|
||||
} else if (ticks[0] >= pos) {
|
||||
return ticks[0];
|
||||
} else {
|
||||
for (i = 0; i < len; i++) {
|
||||
next = (i + 1);
|
||||
if (ticks[next] && ticks[next] >= pos) {
|
||||
diff1 = pos - ticks[i];
|
||||
diff2 = ticks[next] - pos;
|
||||
ret = (diff2 > diff1) ? ticks[i] : ticks[next];
|
||||
if (off1 && off2) {
|
||||
if (ret > off2) {
|
||||
if (ticks[i]) {
|
||||
ret = ticks[i];
|
||||
} else {
|
||||
ret = ticks[len - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
return ticks[ticks.length - 1];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['dd-drag'], skinnable:false});
|
||||
8
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-base-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-base-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-ddm-base",function(B){var A=function(){A.superclass.constructor.apply(this,arguments);};A.NAME="ddm";A.ATTRS={dragCursor:{value:"move"},clickPixelThresh:{value:3},clickTimeThresh:{value:1000},dragMode:{value:"point",setter:function(C){this._setDragMode(C);return C;}}};B.extend(A,B.Base,{_active:null,_setDragMode:function(C){if(C===null){C=B.DD.DDM.get("dragMode");}switch(C){case 1:case"intersect":return 1;case 2:case"strict":return 2;case 0:case"point":return 0;}return 0;},CSS_PREFIX:"yui-dd",_activateTargets:function(){},_drags:[],activeDrag:false,_regDrag:function(C){if(this.getDrag(C.get("node"))){return false;}if(!this._active){this._setupListeners();}this._drags.push(C);return true;},_unregDrag:function(D){var C=[];B.each(this._drags,function(F,E){if(F!==D){C[C.length]=F;}});this._drags=C;},_setupListeners:function(){this._active=true;var C=B.get(document);C.on("mousemove",B.bind(this._move,this));C.on("mouseup",B.bind(this._end,this));},_start:function(){this.fire("ddm:start");this._startDrag();},_startDrag:function(){},_endDrag:function(){},_dropMove:function(){},_end:function(){if(this.activeDrag){this._endDrag();this.fire("ddm:end");this.activeDrag.end.call(this.activeDrag);this.activeDrag=null;}},stopDrag:function(){if(this.activeDrag){this._end();}return this;},_move:function(C){if(this.activeDrag){this.activeDrag._move.call(this.activeDrag,C);this._dropMove();}},cssSizestoObject:function(D){var C=D.split(" ");switch(C.length){case 1:C[1]=C[2]=C[3]=C[0];break;case 2:C[2]=C[0];C[3]=C[1];break;case 3:C[3]=C[1];break;}return{top:parseInt(C[0],10),right:parseInt(C[1],10),bottom:parseInt(C[2],10),left:parseInt(C[3],10)};},getDrag:function(D){var C=false,E=B.get(D);if(E instanceof B.Node){B.each(this._drags,function(G,F){if(E.compareTo(G.get("node"))){C=G;}});}return C;}});B.namespace("DD");B.DD.DDM=new A();},"3.0.0",{requires:["node","base"],skinnable:false});
|
||||
289
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-base.js
vendored
Normal file
289
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-base.js
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-ddm-base', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* Provides the base Drag Drop Manger required for making a Node draggable.
|
||||
* @module dd
|
||||
* @submodule dd-ddm-base
|
||||
*/
|
||||
/**
|
||||
* Provides the base Drag Drop Manger required for making a Node draggable.
|
||||
* @class DDM
|
||||
* @extends Base
|
||||
* @constructor
|
||||
* @namespace DD
|
||||
*/
|
||||
|
||||
var DDMBase = function() {
|
||||
DDMBase.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
|
||||
DDMBase.NAME = 'ddm';
|
||||
|
||||
DDMBase.ATTRS = {
|
||||
/**
|
||||
* @attribute dragCursor
|
||||
* @description The cursor to apply when dragging, if shimmed the shim will get the cursor.
|
||||
* @type String
|
||||
*/
|
||||
dragCursor: {
|
||||
value: 'move'
|
||||
},
|
||||
/**
|
||||
* @attribute clickPixelThresh
|
||||
* @description The number of pixels to move to start a drag operation, default is 3.
|
||||
* @type Number
|
||||
*/
|
||||
clickPixelThresh: {
|
||||
value: 3
|
||||
},
|
||||
/**
|
||||
* @attribute clickTimeThresh
|
||||
* @description The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.
|
||||
* @type Number
|
||||
*/
|
||||
clickTimeThresh: {
|
||||
value: 1000
|
||||
},
|
||||
/**
|
||||
* @attribute dragMode
|
||||
* @description This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of all future Drag instances.
|
||||
* @type String
|
||||
*/
|
||||
dragMode: {
|
||||
value: 'point',
|
||||
setter: function(mode) {
|
||||
this._setDragMode(mode);
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Y.extend(DDMBase, Y.Base, {
|
||||
/**
|
||||
* @property _active
|
||||
* @description flag set when we activate our first drag, so DDM can start listening for events.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
_active: null,
|
||||
/**
|
||||
* @private
|
||||
* @method _setDragMode
|
||||
* @description Handler for dragMode attribute setter.
|
||||
* @param String/Number The Number value or the String for the DragMode to default all future drag instances to.
|
||||
* @return Number The Mode to be set
|
||||
*/
|
||||
_setDragMode: function(mode) {
|
||||
if (mode === null) {
|
||||
mode = Y.DD.DDM.get('dragMode');
|
||||
}
|
||||
switch (mode) {
|
||||
case 1:
|
||||
case 'intersect':
|
||||
return 1;
|
||||
case 2:
|
||||
case 'strict':
|
||||
return 2;
|
||||
case 0:
|
||||
case 'point':
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
/**
|
||||
* @property CSS_PREFIX
|
||||
* @description The PREFIX to attach to all DD CSS class names
|
||||
* @type {String}
|
||||
*/
|
||||
CSS_PREFIX: 'yui-dd',
|
||||
_activateTargets: function() {},
|
||||
/**
|
||||
* @private
|
||||
* @property _drags
|
||||
* @description Holder for all registered drag elements.
|
||||
* @type {Array}
|
||||
*/
|
||||
_drags: [],
|
||||
/**
|
||||
* @property activeDrag
|
||||
* @description A reference to the currently active draggable object.
|
||||
* @type {Drag}
|
||||
*/
|
||||
activeDrag: false,
|
||||
/**
|
||||
* @private
|
||||
* @method _regDrag
|
||||
* @description Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag.
|
||||
* @param {Drag} d The Drag object
|
||||
*/
|
||||
_regDrag: function(d) {
|
||||
if (this.getDrag(d.get('node'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this._active) {
|
||||
this._setupListeners();
|
||||
}
|
||||
this._drags.push(d);
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _unregDrag
|
||||
* @description Remove this drag object from the DDM._drags array.
|
||||
* @param {Drag} d The drag object.
|
||||
*/
|
||||
_unregDrag: function(d) {
|
||||
var tmp = [];
|
||||
Y.each(this._drags, function(n, i) {
|
||||
if (n !== d) {
|
||||
tmp[tmp.length] = n;
|
||||
}
|
||||
});
|
||||
this._drags = tmp;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _setupListeners
|
||||
* @description Add the document listeners.
|
||||
*/
|
||||
_setupListeners: function() {
|
||||
this._active = true;
|
||||
var doc = Y.get(document);
|
||||
doc.on('mousemove', Y.bind(this._move, this));
|
||||
//Y.Event.nativeAdd(document, 'mousemove', Y.bind(this._move, this));
|
||||
doc.on('mouseup', Y.bind(this._end, this));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _start
|
||||
* @description Internal method used by Drag to signal the start of a drag operation
|
||||
*/
|
||||
_start: function() {
|
||||
this.fire('ddm:start');
|
||||
this._startDrag();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _startDrag
|
||||
* @description Factory method to be overwritten by other DDM's
|
||||
* @param {Number} x The x position of the drag element
|
||||
* @param {Number} y The y position of the drag element
|
||||
* @param {Number} w The width of the drag element
|
||||
* @param {Number} h The height of the drag element
|
||||
*/
|
||||
_startDrag: function() {},
|
||||
/**
|
||||
* @private
|
||||
* @method _endDrag
|
||||
* @description Factory method to be overwritten by other DDM's
|
||||
*/
|
||||
_endDrag: function() {},
|
||||
_dropMove: function() {},
|
||||
/**
|
||||
* @private
|
||||
* @method _end
|
||||
* @description Internal method used by Drag to signal the end of a drag operation
|
||||
*/
|
||||
_end: function() {
|
||||
if (this.activeDrag) {
|
||||
this._endDrag();
|
||||
this.fire('ddm:end');
|
||||
this.activeDrag.end.call(this.activeDrag);
|
||||
this.activeDrag = null;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @method stopDrag
|
||||
* @description Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.
|
||||
* @return {Self}
|
||||
* @chainable
|
||||
*/
|
||||
stopDrag: function() {
|
||||
if (this.activeDrag) {
|
||||
this._end();
|
||||
}
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _move
|
||||
* @description Internal listener for the mousemove DOM event to pass to the Drag's move method.
|
||||
* @param {Event.Facade} ev The Dom mousemove Event
|
||||
*/
|
||||
_move: function(ev) {
|
||||
if (this.activeDrag) {
|
||||
this.activeDrag._move.call(this.activeDrag, ev);
|
||||
this._dropMove();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* //TODO Private, rename??...
|
||||
* @private
|
||||
* @method cssSizestoObject
|
||||
* @description Helper method to use to set the gutter from the attribute setter.
|
||||
* @param {String} gutter CSS style string for gutter: '5 0' (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px)
|
||||
* @return {Object} The gutter Object Literal.
|
||||
*/
|
||||
cssSizestoObject: function(gutter) {
|
||||
var x = gutter.split(' ');
|
||||
|
||||
switch (x.length) {
|
||||
case 1: x[1] = x[2] = x[3] = x[0]; break;
|
||||
case 2: x[2] = x[0]; x[3] = x[1]; break;
|
||||
case 3: x[3] = x[1]; break;
|
||||
}
|
||||
|
||||
return {
|
||||
top : parseInt(x[0],10),
|
||||
right : parseInt(x[1],10),
|
||||
bottom: parseInt(x[2],10),
|
||||
left : parseInt(x[3],10)
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @method getDrag
|
||||
* @description Get a valid Drag instance back from a Node or a selector string, false otherwise
|
||||
* @param {String/Object} node The Node instance or Selector string to check for a valid Drag Object
|
||||
* @return {Object}
|
||||
*/
|
||||
getDrag: function(node) {
|
||||
var drag = false,
|
||||
n = Y.get(node);
|
||||
if (n instanceof Y.Node) {
|
||||
Y.each(this._drags, function(v, k) {
|
||||
if (n.compareTo(v.get('node'))) {
|
||||
drag = v;
|
||||
}
|
||||
});
|
||||
}
|
||||
return drag;
|
||||
}
|
||||
});
|
||||
|
||||
Y.namespace('DD');
|
||||
Y.DD.DDM = new DDMBase();
|
||||
|
||||
/**
|
||||
* @event ddm:start
|
||||
* @description Fires from the DDM before all drag events fire.
|
||||
* @type {Event.Custom}
|
||||
*/
|
||||
/**
|
||||
* @event ddm:end
|
||||
* @description Fires from the DDM after the DDM finishes, before the drag end events.
|
||||
* @type {Event.Custom}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['node', 'base'], skinnable:false});
|
||||
8
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-drop-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-drop-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-ddm-drop",function(A){A.mix(A.DD.DDM,{_noShim:false,_activeShims:[],_hasActiveShim:function(){if(this._noShim){return true;}return this._activeShims.length;},_addActiveShim:function(B){this._activeShims[this._activeShims.length]=B;},_removeActiveShim:function(C){var B=[];A.each(this._activeShims,function(E,D){if(E._yuid!==C._yuid){B[B.length]=E;}});this._activeShims=B;},syncActiveShims:function(B){A.later(0,this,function(C){var D=((C)?this.targets:this._lookup());A.each(D,function(F,E){F.sizeShim.call(F);},this);},B);},mode:0,POINT:0,INTERSECT:1,STRICT:2,useHash:true,activeDrop:null,validDrops:[],otherDrops:{},targets:[],_addValid:function(B){this.validDrops[this.validDrops.length]=B;return this;},_removeValid:function(B){var C=[];A.each(this.validDrops,function(E,D){if(E!==B){C[C.length]=E;}});this.validDrops=C;return this;},isOverTarget:function(C){if(this.activeDrag&&C){var F=this.activeDrag.mouseXY,E,B=this.activeDrag.get("dragMode"),D;if(F&&this.activeDrag){D=this.activeDrag.region;if(B==this.STRICT){return this.activeDrag.get("dragNode").inRegion(C.region,true,D);}else{if(C&&C.shim){if((B==this.INTERSECT)&&this._noShim){E=((D)?D:this.activeDrag.get("node"));return C.get("node").intersect(E).inRegion;}else{return C.shim.intersect({top:F[1],bottom:F[1],left:F[0],right:F[0]},C.region).inRegion;}}else{return false;}}}else{return false;}}else{return false;}},clearCache:function(){this.validDrops=[];this.otherDrops={};this._activeShims=[];},_activateTargets:function(){this.clearCache();A.each(this.targets,function(C,B){C._activateShim.apply(C,[]);},this);this._handleTargetOver();},getBestMatch:function(F,D){var C=null,E=0,B;A.each(F,function(I,H){var G=this.activeDrag.get("dragNode").intersect(I.get("node"));I.region.area=G.area;if(G.inRegion){if(G.area>E){E=G.area;C=I;}}},this);if(D){B=[];A.each(F,function(H,G){if(H!==C){B[B.length]=H;}},this);return[C,B];}else{return C;}},_deactivateTargets:function(){var B=[],C,E=this.activeDrag,D=this.activeDrop;if(E&&D&&this.otherDrops[D]){if(!E.get("dragMode")){B=this.otherDrops;delete B[D];}else{C=this.getBestMatch(this.otherDrops,true);D=C[0];B=C[1];}E.get("node").removeClass(this.CSS_PREFIX+"-drag-over");if(D){D.fire("drop:hit",{drag:E,drop:D,others:B});E.fire("drag:drophit",{drag:E,drop:D,others:B});}}else{if(E){E.get("node").removeClass(this.CSS_PREFIX+"-drag-over");E.fire("drag:dropmiss",{pageX:E.lastXY[0],pageY:E.lastXY[1]});}else{}}this.activeDrop=null;A.each(this.targets,function(G,F){G._deactivateShim.apply(G,[]);},this);},_dropMove:function(){if(this._hasActiveShim()){this._handleTargetOver();}else{A.each(this.otherDrops,function(C,B){C._handleOut.apply(C,[]);});}},_lookup:function(){if(!this.useHash||this._noShim){return this.validDrops;}var B=[];A.each(this.validDrops,function(D,C){if(D.shim&&D.shim.inViewportRegion(false,D.region)){B[B.length]=D;}});return B;},_handleTargetOver:function(){var B=this._lookup();A.each(B,function(D,C){D._handleTargetOver.call(D);},this);},_regTarget:function(B){this.targets[this.targets.length]=B;},_unregTarget:function(C){var B=[],D;A.each(this.targets,function(F,E){if(F!=C){B[B.length]=F;}},this);this.targets=B;D=[];A.each(this.validDrops,function(F,E){if(F!==C){D[D.length]=F;}});this.validDrops=D;},getDrop:function(C){var B=false,D=A.Node.get(C);if(D instanceof A.Node){A.each(this.targets,function(F,E){if(D.compareTo(F.get("node"))){B=F;}});}return B;}},true);},"3.0.0",{requires:["dd-ddm"],skinnable:false});
|
||||
411
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-drop.js
vendored
Normal file
411
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-drop.js
vendored
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-ddm-drop', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* Extends the dd-ddm Class to add support for the placement of Drop Target shims inside the viewport shim. It also handles all Drop Target related events and interactions.
|
||||
* @module dd
|
||||
* @submodule dd-ddm-drop
|
||||
* @for DDM
|
||||
* @namespace DD
|
||||
*/
|
||||
|
||||
//TODO CSS class name for the bestMatch..
|
||||
Y.mix(Y.DD.DDM, {
|
||||
/**
|
||||
* @private
|
||||
* @property _noShim
|
||||
* @description This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
_noShim: false,
|
||||
/**
|
||||
* @private
|
||||
* @property _activeShims
|
||||
* @description Placeholder for all active shims on the page
|
||||
* @type {Array}
|
||||
*/
|
||||
_activeShims: [],
|
||||
/**
|
||||
* @private
|
||||
* @method _hasActiveShim
|
||||
* @description This method checks the _activeShims Object to see if there is a shim active.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
_hasActiveShim: function() {
|
||||
if (this._noShim) {
|
||||
return true;
|
||||
}
|
||||
return this._activeShims.length;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _addActiveShim
|
||||
* @description Adds a Drop Target to the list of active shims
|
||||
* @param {Object} d The Drop instance to add to the list.
|
||||
*/
|
||||
_addActiveShim: function(d) {
|
||||
this._activeShims[this._activeShims.length] = d;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _removeActiveShim
|
||||
* @description Removes a Drop Target to the list of active shims
|
||||
* @param {Object} d The Drop instance to remove from the list.
|
||||
*/
|
||||
_removeActiveShim: function(d) {
|
||||
var s = [];
|
||||
Y.each(this._activeShims, function(v, k) {
|
||||
if (v._yuid !== d._yuid) {
|
||||
s[s.length] = v;
|
||||
}
|
||||
|
||||
});
|
||||
this._activeShims = s;
|
||||
},
|
||||
/**
|
||||
* @method syncActiveShims
|
||||
* @description This method will sync the position of the shims on the Drop Targets that are currently active.
|
||||
* @param {Boolean} force Resize/sync all Targets.
|
||||
*/
|
||||
syncActiveShims: function(force) {
|
||||
Y.later(0, this, function(force) {
|
||||
var drops = ((force) ? this.targets : this._lookup());
|
||||
Y.each(drops, function(v, k) {
|
||||
v.sizeShim.call(v);
|
||||
}, this);
|
||||
}, force);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @property mode
|
||||
* @description The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict
|
||||
* @type Number
|
||||
*/
|
||||
mode: 0,
|
||||
/**
|
||||
* @private
|
||||
* @property POINT
|
||||
* @description In point mode, a Drop is targeted by the cursor being over the Target
|
||||
* @type Number
|
||||
*/
|
||||
POINT: 0,
|
||||
/**
|
||||
* @private
|
||||
* @property INTERSECT
|
||||
* @description In intersect mode, a Drop is targeted by "part" of the drag node being over the Target
|
||||
* @type Number
|
||||
*/
|
||||
INTERSECT: 1,
|
||||
/**
|
||||
* @private
|
||||
* @property STRICT
|
||||
* @description In strict mode, a Drop is targeted by the "entire" drag node being over the Target
|
||||
* @type Number
|
||||
*/
|
||||
STRICT: 2,
|
||||
/**
|
||||
* @property useHash
|
||||
* @description Should we only check targets that are in the viewport on drags (for performance), default: true
|
||||
* @type {Boolean}
|
||||
*/
|
||||
useHash: true,
|
||||
/**
|
||||
* @property activeDrop
|
||||
* @description A reference to the active Drop Target
|
||||
* @type {Object}
|
||||
*/
|
||||
activeDrop: null,
|
||||
/**
|
||||
* @property validDrops
|
||||
* @description An array of the valid Drop Targets for this interaction.
|
||||
* @type {Array}
|
||||
*/
|
||||
//TODO Change array/object literals to be in sync..
|
||||
validDrops: [],
|
||||
/**
|
||||
* @property otherDrops
|
||||
* @description An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets)
|
||||
* @type {Object}
|
||||
*/
|
||||
otherDrops: {},
|
||||
/**
|
||||
* @property targets
|
||||
* @description All of the Targets
|
||||
* @type {Array}
|
||||
*/
|
||||
targets: [],
|
||||
/**
|
||||
* @private
|
||||
* @method _addValid
|
||||
* @description Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation.
|
||||
* @param {Object} drop
|
||||
* @return {Self}
|
||||
* @chainable
|
||||
*/
|
||||
_addValid: function(drop) {
|
||||
this.validDrops[this.validDrops.length] = drop;
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _removeValid
|
||||
* @description Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation.
|
||||
* @param {Object} drop
|
||||
* @return {Self}
|
||||
* @chainable
|
||||
*/
|
||||
_removeValid: function(drop) {
|
||||
var drops = [];
|
||||
Y.each(this.validDrops, function(v, k) {
|
||||
if (v !== drop) {
|
||||
drops[drops.length] = v;
|
||||
}
|
||||
});
|
||||
|
||||
this.validDrops = drops;
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* @method isOverTarget
|
||||
* @description Check to see if the Drag element is over the target, method varies on current mode
|
||||
* @param {Object} drop The drop to check against
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isOverTarget: function(drop) {
|
||||
if (this.activeDrag && drop) {
|
||||
var xy = this.activeDrag.mouseXY, r, dMode = this.activeDrag.get('dragMode'),
|
||||
aRegion;
|
||||
if (xy && this.activeDrag) {
|
||||
aRegion = this.activeDrag.region;
|
||||
if (dMode == this.STRICT) {
|
||||
return this.activeDrag.get('dragNode').inRegion(drop.region, true, aRegion);
|
||||
} else {
|
||||
if (drop && drop.shim) {
|
||||
if ((dMode == this.INTERSECT) && this._noShim) {
|
||||
r = ((aRegion) ? aRegion : this.activeDrag.get('node'));
|
||||
return drop.get('node').intersect(r).inRegion;
|
||||
} else {
|
||||
return drop.shim.intersect({
|
||||
top: xy[1],
|
||||
bottom: xy[1],
|
||||
left: xy[0],
|
||||
right: xy[0]
|
||||
}, drop.region).inRegion;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @method clearCache
|
||||
* @description Clears the cache data used for this interaction.
|
||||
*/
|
||||
clearCache: function() {
|
||||
this.validDrops = [];
|
||||
this.otherDrops = {};
|
||||
this._activeShims = [];
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _activateTargets
|
||||
* @description Clear the cache and activate the shims of all the targets
|
||||
*/
|
||||
_activateTargets: function() {
|
||||
this.clearCache();
|
||||
Y.each(this.targets, function(v, k) {
|
||||
v._activateShim.apply(v, []);
|
||||
}, this);
|
||||
this._handleTargetOver();
|
||||
|
||||
},
|
||||
/**
|
||||
* @method getBestMatch
|
||||
* @description This method will gather the area for all potential targets and see which has the hightest covered area and return it.
|
||||
* @param {Array} drops An Array of drops to scan for the best match.
|
||||
* @param {Boolean} all If present, it returns an Array. First item is best match, second is an Array of the other items in the original Array.
|
||||
* @return {Object or Array}
|
||||
*/
|
||||
getBestMatch: function(drops, all) {
|
||||
var biggest = null, area = 0, out;
|
||||
|
||||
Y.each(drops, function(v, k) {
|
||||
var inter = this.activeDrag.get('dragNode').intersect(v.get('node'));
|
||||
v.region.area = inter.area;
|
||||
|
||||
if (inter.inRegion) {
|
||||
if (inter.area > area) {
|
||||
area = inter.area;
|
||||
biggest = v;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
if (all) {
|
||||
out = [];
|
||||
//TODO Sort the others in numeric order by area covered..
|
||||
Y.each(drops, function(v, k) {
|
||||
if (v !== biggest) {
|
||||
out[out.length] = v;
|
||||
}
|
||||
}, this);
|
||||
return [biggest, out];
|
||||
} else {
|
||||
return biggest;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _deactivateTargets
|
||||
* @description This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims..
|
||||
*/
|
||||
_deactivateTargets: function() {
|
||||
var other = [], tmp,
|
||||
activeDrag = this.activeDrag,
|
||||
activeDrop = this.activeDrop;
|
||||
|
||||
//TODO why is this check so hard??
|
||||
if (activeDrag && activeDrop && this.otherDrops[activeDrop]) {
|
||||
if (!activeDrag.get('dragMode')) {
|
||||
//TODO otherDrops -- private..
|
||||
other = this.otherDrops;
|
||||
delete other[activeDrop];
|
||||
} else {
|
||||
tmp = this.getBestMatch(this.otherDrops, true);
|
||||
activeDrop = tmp[0];
|
||||
other = tmp[1];
|
||||
}
|
||||
activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over');
|
||||
if (activeDrop) {
|
||||
activeDrop.fire('drop:hit', { drag: activeDrag, drop: activeDrop, others: other });
|
||||
activeDrag.fire('drag:drophit', { drag: activeDrag, drop: activeDrop, others: other });
|
||||
}
|
||||
} else if (activeDrag) {
|
||||
activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over');
|
||||
activeDrag.fire('drag:dropmiss', { pageX: activeDrag.lastXY[0], pageY: activeDrag.lastXY[1] });
|
||||
} else {
|
||||
}
|
||||
|
||||
this.activeDrop = null;
|
||||
|
||||
Y.each(this.targets, function(v, k) {
|
||||
v._deactivateShim.apply(v, []);
|
||||
}, this);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _dropMove
|
||||
* @description This method is called when the move method is called on the Drag Object.
|
||||
*/
|
||||
_dropMove: function() {
|
||||
if (this._hasActiveShim()) {
|
||||
this._handleTargetOver();
|
||||
} else {
|
||||
Y.each(this.otherDrops, function(v, k) {
|
||||
v._handleOut.apply(v, []);
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _lookup
|
||||
* @description Filters the list of Drops down to those in the viewport.
|
||||
* @return {Array} The valid Drop Targets that are in the viewport.
|
||||
*/
|
||||
_lookup: function() {
|
||||
if (!this.useHash || this._noShim) {
|
||||
return this.validDrops;
|
||||
}
|
||||
var drops = [];
|
||||
//Only scan drop shims that are in the Viewport
|
||||
Y.each(this.validDrops, function(v, k) {
|
||||
if (v.shim && v.shim.inViewportRegion(false, v.region)) {
|
||||
drops[drops.length] = v;
|
||||
}
|
||||
});
|
||||
return drops;
|
||||
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _handleTargetOver
|
||||
* @description This method execs _handleTargetOver on all valid Drop Targets
|
||||
*/
|
||||
_handleTargetOver: function() {
|
||||
var drops = this._lookup();
|
||||
Y.each(drops, function(v, k) {
|
||||
v._handleTargetOver.call(v);
|
||||
}, this);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _regTarget
|
||||
* @description Add the passed in Target to the targets collection
|
||||
* @param {Object} t The Target to add to the targets collection
|
||||
*/
|
||||
_regTarget: function(t) {
|
||||
this.targets[this.targets.length] = t;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _unregTarget
|
||||
* @description Remove the passed in Target from the targets collection
|
||||
* @param {Object} drop The Target to remove from the targets collection
|
||||
*/
|
||||
_unregTarget: function(drop) {
|
||||
var targets = [], vdrops;
|
||||
Y.each(this.targets, function(v, k) {
|
||||
if (v != drop) {
|
||||
targets[targets.length] = v;
|
||||
}
|
||||
}, this);
|
||||
this.targets = targets;
|
||||
|
||||
vdrops = [];
|
||||
Y.each(this.validDrops, function(v, k) {
|
||||
if (v !== drop) {
|
||||
vdrops[vdrops.length] = v;
|
||||
}
|
||||
});
|
||||
|
||||
this.validDrops = vdrops;
|
||||
},
|
||||
/**
|
||||
* @method getDrop
|
||||
* @description Get a valid Drop instance back from a Node or a selector string, false otherwise
|
||||
* @param {String/Object} node The Node instance or Selector string to check for a valid Drop Object
|
||||
* @return {Object}
|
||||
*/
|
||||
getDrop: function(node) {
|
||||
var drop = false,
|
||||
n = Y.Node.get(node);
|
||||
if (n instanceof Y.Node) {
|
||||
Y.each(this.targets, function(v, k) {
|
||||
if (n.compareTo(v.get('node'))) {
|
||||
drop = v;
|
||||
}
|
||||
});
|
||||
}
|
||||
return drop;
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['dd-ddm'], skinnable:false});
|
||||
8
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-ddm",function(A){A.mix(A.DD.DDM,{_pg:null,_debugShim:false,_activateTargets:function(){},_deactivateTargets:function(){},_startDrag:function(){if(this.activeDrag.get("useShim")){this._pg_activate();this._activateTargets();}},_endDrag:function(){this._pg_deactivate();this._deactivateTargets();},_pg_deactivate:function(){this._pg.setStyle("display","none");},_pg_activate:function(){var B=this.activeDrag.get("activeHandle"),C="auto";if(B){C=B.getStyle("cursor");}if(C=="auto"){C=this.get("dragCursor");}this._pg_size();this._pg.setStyles({top:0,left:0,display:"block",opacity:((this._debugShim)?".5":"0"),cursor:C});},_pg_size:function(){if(this.activeDrag){var B=A.get("body"),D=B.get("docHeight"),C=B.get("docWidth");this._pg.setStyles({height:D+"px",width:C+"px"});}},_createPG:function(){var D=A.Node.create("<div></div>"),B=A.get("body");D.setStyles({top:"0",left:"0",position:"absolute",zIndex:"9999",overflow:"hidden",backgroundColor:"red",display:"none",height:"5px",width:"5px"});D.set("id",A.stamp(D));D.addClass("yui-dd-shim");if(B.get("firstChild")){B.insertBefore(D,B.get("firstChild"));}else{B.appendChild(D);}this._pg=D;this._pg.on("mouseup",A.bind(this._end,this));this._pg.on("mousemove",A.bind(this._move,this));var C=A.get(window);A.on("window:resize",A.bind(this._pg_size,this));C.on("scroll",A.bind(this._pg_size,this));}},true);A.on("domready",A.bind(A.DD.DDM._createPG,A.DD.DDM));},"3.0.0",{requires:["dd-ddm-base","event-resize"],skinnable:false});
|
||||
135
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm.js
vendored
Normal file
135
jssource/src_files/include/javascript/yui3/build/dd/dd-ddm.js
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-ddm', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* Extends the dd-ddm-base Class to add support for the viewport shim to allow a draggable node to drag to be dragged over an iframe or any other node that traps mousemove events.
|
||||
* It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets.
|
||||
* @module dd
|
||||
* @submodule dd-ddm
|
||||
* @for DDM
|
||||
* @namespace DD
|
||||
*/
|
||||
Y.mix(Y.DD.DDM, {
|
||||
/**
|
||||
* @private
|
||||
* @property _pg
|
||||
* @description The shim placed over the screen to track the mousemove event.
|
||||
* @type {Node}
|
||||
*/
|
||||
_pg: null,
|
||||
/**
|
||||
* @private
|
||||
* @property _debugShim
|
||||
* @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
_debugShim: false,
|
||||
_activateTargets: function() {},
|
||||
_deactivateTargets: function() {},
|
||||
_startDrag: function() {
|
||||
if (this.activeDrag.get('useShim')) {
|
||||
this._pg_activate();
|
||||
this._activateTargets();
|
||||
}
|
||||
},
|
||||
_endDrag: function() {
|
||||
this._pg_deactivate();
|
||||
this._deactivateTargets();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _pg_deactivate
|
||||
* @description Deactivates the shim
|
||||
*/
|
||||
_pg_deactivate: function() {
|
||||
this._pg.setStyle('display', 'none');
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _pg_activate
|
||||
* @description Activates the shim
|
||||
*/
|
||||
_pg_activate: function() {
|
||||
var ah = this.activeDrag.get('activeHandle'), cur = 'auto';
|
||||
if (ah) {
|
||||
cur = ah.getStyle('cursor');
|
||||
}
|
||||
if (cur == 'auto') {
|
||||
cur = this.get('dragCursor');
|
||||
}
|
||||
|
||||
this._pg_size();
|
||||
this._pg.setStyles({
|
||||
top: 0,
|
||||
left: 0,
|
||||
display: 'block',
|
||||
opacity: ((this._debugShim) ? '.5' : '0'),
|
||||
cursor: cur
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _pg_size
|
||||
* @description Sizes the shim on: activatation, window:scroll, window:resize
|
||||
*/
|
||||
_pg_size: function() {
|
||||
if (this.activeDrag) {
|
||||
var b = Y.get('body'),
|
||||
h = b.get('docHeight'),
|
||||
w = b.get('docWidth');
|
||||
this._pg.setStyles({
|
||||
height: h + 'px',
|
||||
width: w + 'px'
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _createPG
|
||||
* @description Creates the shim and adds it's listeners to it.
|
||||
*/
|
||||
_createPG: function() {
|
||||
var pg = Y.Node.create('<div></div>'),
|
||||
bd = Y.get('body');
|
||||
pg.setStyles({
|
||||
top: '0',
|
||||
left: '0',
|
||||
position: 'absolute',
|
||||
zIndex: '9999',
|
||||
overflow: 'hidden',
|
||||
backgroundColor: 'red',
|
||||
display: 'none',
|
||||
height: '5px',
|
||||
width: '5px'
|
||||
});
|
||||
pg.set('id', Y.stamp(pg));
|
||||
pg.addClass('yui-dd-shim');
|
||||
if (bd.get('firstChild')) {
|
||||
bd.insertBefore(pg, bd.get('firstChild'));
|
||||
} else {
|
||||
bd.appendChild(pg);
|
||||
}
|
||||
this._pg = pg;
|
||||
this._pg.on('mouseup', Y.bind(this._end, this));
|
||||
this._pg.on('mousemove', Y.bind(this._move, this));
|
||||
|
||||
var win = Y.get(window);
|
||||
Y.on('window:resize', Y.bind(this._pg_size, this));
|
||||
win.on('scroll', Y.bind(this._pg_size, this));
|
||||
}
|
||||
}, true);
|
||||
|
||||
Y.on('domready', Y.bind(Y.DD.DDM._createPG, Y.DD.DDM));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['dd-ddm-base', 'event-resize'], skinnable:false});
|
||||
9
jssource/src_files/include/javascript/yui3/build/dd/dd-drag-min.js
vendored
Normal file
9
jssource/src_files/include/javascript/yui3/build/dd/dd-drag-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1100
jssource/src_files/include/javascript/yui3/build/dd/dd-drag.js
vendored
Normal file
1100
jssource/src_files/include/javascript/yui3/build/dd/dd-drag.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
jssource/src_files/include/javascript/yui3/build/dd/dd-drop-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-drop-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-drop",function(A){var B="node",G=A.DD.DDM,F="offsetHeight",C="offsetWidth",I="drop:over",H="drop:enter",D="drop:exit",E=function(){this._lazyAddAttrs=false;E.superclass.constructor.apply(this,arguments);A.on("domready",A.bind(function(){A.later(100,this,this._createShim);},this));G._regTarget(this);};E.NAME="drop";E.ATTRS={node:{setter:function(J){var K=A.Node.get(J);if(!K){A.error("DD.Drop: Invalid Node Given: "+J);}return K;}},groups:{value:["default"],setter:function(J){this._groups={};A.each(J,function(L,K){this._groups[L]=true;},this);return J;}},padding:{value:"0",setter:function(J){return G.cssSizestoObject(J);}},lock:{value:false,setter:function(J){if(J){this.get(B).addClass(G.CSS_PREFIX+"-drop-locked");}else{this.get(B).removeClass(G.CSS_PREFIX+"-drop-locked");}return J;}},bubbles:{writeOnce:true,value:A.DD.DDM}};A.extend(E,A.Base,{_createEvents:function(){var J=[I,H,D,"drop:hit"];A.each(J,function(L,K){this.publish(L,{type:L,emitFacade:true,preventable:false,bubbles:true,queuable:false,prefix:"drop"});},this);if(this.get("bubbles")){this.addTarget(this.get("bubbles"));}},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(J){this._valid=false;var K=false;A.each(J,function(M,L){if(this._groups[M]){K=true;this._valid=true;}},this);return K;},initializer:function(){A.later(100,this,this._createEvents);var J=this.get(B),K;if(!J.get("id")){K=A.stamp(J);J.set("id",K);}J.addClass(G.CSS_PREFIX+"-drop");this.set("groups",this.get("groups"));},destructor:function(){G._unregTarget(this);if(this.shim){this.shim.detachAll();this.shim.get("parentNode").removeChild(this.shim);this.shim=null;}this.get(B).removeClass(G.CSS_PREFIX+"-drop");this.detachAll();},_deactivateShim:function(){if(!this.shim){return false;}this.get(B).removeClass(G.CSS_PREFIX+"-drop-active-valid");this.get(B).removeClass(G.CSS_PREFIX+"-drop-active-invalid");this.get(B).removeClass(G.CSS_PREFIX+"-drop-over");this.shim.setStyles({top:"-999px",left:"-999px",zIndex:"1"});this.overTarget=false;},_activateShim:function(){if(!G.activeDrag){return false;}if(this.get(B)===G.activeDrag.get(B)){return false;}if(this.get("lock")){return false;}var J=this.get(B);if(this.inGroup(G.activeDrag.get("groups"))){J.removeClass(G.CSS_PREFIX+"-drop-active-invalid");J.addClass(G.CSS_PREFIX+"-drop-active-valid");G._addValid(this);this.overTarget=false;this.sizeShim();}else{G._removeValid(this);J.removeClass(G.CSS_PREFIX+"-drop-active-valid");J.addClass(G.CSS_PREFIX+"-drop-active-invalid");}},sizeShim:function(){if(!G.activeDrag){return false;}if(this.get(B)===G.activeDrag.get(B)){return false;}if(this.get("lock")){return false;}if(!this.shim){A.later(100,this,this.sizeShim);return false;}var O=this.get(B),M=O.get(F),K=O.get(C),Q=O.getXY(),P=this.get("padding"),J,N,L;K=K+P.left+P.right;M=M+P.top+P.bottom;Q[0]=Q[0]-P.left;Q[1]=Q[1]-P.top;if(G.activeDrag.get("dragMode")===G.INTERSECT){J=G.activeDrag;N=J.get(B).get(F);L=J.get(B).get(C);M=(M+N);K=(K+L);Q[0]=Q[0]-(L-J.deltaXY[0]);Q[1]=Q[1]-(N-J.deltaXY[1]);}this.shim.setStyles({height:M+"px",width:K+"px",top:Q[1]+"px",left:Q[0]+"px"});this.region={"0":Q[0],"1":Q[1],area:0,top:Q[1],right:Q[0]+K,bottom:Q[1]+M,left:Q[0]};},_createShim:function(){if(!G._pg){A.later(10,this,this._createShim);return;}if(this.shim){return;}var J=A.Node.create('<div id="'+this.get(B).get("id")+'_shim"></div>');J.setStyles({height:this.get(B).get(F)+"px",width:this.get(B).get(C)+"px",backgroundColor:"yellow",opacity:".5",zIndex:"1",overflow:"hidden",top:"-900px",left:"-900px",position:"absolute"});G._pg.appendChild(J);this.shim=J;J.on("mouseover",A.bind(this._handleOverEvent,this));J.on("mouseout",A.bind(this._handleOutEvent,this));},_handleTargetOver:function(){if(G.isOverTarget(this)){this.get(B).addClass(G.CSS_PREFIX+"-drop-over");G.activeDrop=this;G.otherDrops[this]=this;if(this.overTarget){G.activeDrag.fire("drag:over",{drop:this,drag:G.activeDrag});this.fire(I,{drop:this,drag:G.activeDrag});}else{this.overTarget=true;this.fire(H,{drop:this,drag:G.activeDrag});G.activeDrag.fire("drag:enter",{drop:this,drag:G.activeDrag});G.activeDrag.get(B).addClass(G.CSS_PREFIX+"-drag-over");}}else{this._handleOut();}},_handleOverEvent:function(){this.shim.setStyle("zIndex","999");G._addActiveShim(this);},_handleOutEvent:function(){this.shim.setStyle("zIndex","1");G._removeActiveShim(this);},_handleOut:function(J){if(!G.isOverTarget(this)||J){if(this.overTarget){this.overTarget=false;if(!J){G._removeActiveShim(this);}if(G.activeDrag){this.get(B).removeClass(G.CSS_PREFIX+"-drop-over");G.activeDrag.get(B).removeClass(G.CSS_PREFIX+"-drag-over");this.fire(D);G.activeDrag.fire("drag:exit",{drop:this});delete G.otherDrops[this];}}}}});A.DD.Drop=E;},"3.0.0",{requires:["dd-ddm-drop","dd-drag"],skinnable:false});
|
||||
8
jssource/src_files/include/javascript/yui3/build/dd/dd-drop-plugin-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-drop-plugin-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-drop-plugin",function(A){var B=function(C){C.node=C.host;B.superclass.constructor.apply(this,arguments);};B.NAME="dd-drop-plugin";B.NS="drop";A.extend(B,A.DD.Drop);A.namespace("Plugin");A.Plugin.Drop=B;},"3.0.0",{requires:["dd-drop"],skinnable:false});
|
||||
52
jssource/src_files/include/javascript/yui3/build/dd/dd-drop-plugin.js
vendored
Normal file
52
jssource/src_files/include/javascript/yui3/build/dd/dd-drop-plugin.js
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-drop-plugin', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* This is a simple Drop plugin that can be attached to a Node via the plug method.
|
||||
* @module dd
|
||||
* @submodule dd-drop-plugin
|
||||
*/
|
||||
/**
|
||||
* This is a simple Drop plugin that can be attached to a Node via the plug method.
|
||||
* @class Drop
|
||||
* @extends DD.Drop
|
||||
* @constructor
|
||||
* @namespace Plugin
|
||||
*/
|
||||
|
||||
|
||||
var Drop = function(config) {
|
||||
config.node = config.host;
|
||||
Drop.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
|
||||
/**
|
||||
* @property NAME
|
||||
* @description dd-drop-plugin
|
||||
* @type {String}
|
||||
*/
|
||||
Drop.NAME = "dd-drop-plugin";
|
||||
/**
|
||||
* @property NS
|
||||
* @description The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop;
|
||||
* @type {String}
|
||||
*/
|
||||
Drop.NS = "drop";
|
||||
|
||||
|
||||
Y.extend(Drop, Y.DD.Drop);
|
||||
Y.namespace('Plugin');
|
||||
Y.Plugin.Drop = Drop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['dd-drop'], skinnable:false});
|
||||
485
jssource/src_files/include/javascript/yui3/build/dd/dd-drop.js
vendored
Normal file
485
jssource/src_files/include/javascript/yui3/build/dd/dd-drop.js
vendored
Normal file
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-drop', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* The Drag & Drop Utility allows you to create a draggable interface efficiently, buffering you from browser-level abnormalities and enabling you to focus on the interesting logic surrounding your particular implementation. This component enables you to create a variety of standard draggable objects with just a few lines of code and then, using its extensive API, add your own specific implementation logic.
|
||||
* @module dd
|
||||
* @submodule dd-drop
|
||||
*/
|
||||
/**
|
||||
* This class provides the ability to create a Drop Target.
|
||||
* @class Drop
|
||||
* @extends Base
|
||||
* @constructor
|
||||
* @namespace DD
|
||||
*/
|
||||
|
||||
var NODE = 'node',
|
||||
DDM = Y.DD.DDM,
|
||||
OFFSET_HEIGHT = 'offsetHeight',
|
||||
OFFSET_WIDTH = 'offsetWidth',
|
||||
/**
|
||||
* @event drop:over
|
||||
* @description Fires when a drag element is over this target.
|
||||
* @bubbles DDM
|
||||
* @type {Event.Custom}
|
||||
*/
|
||||
EV_DROP_OVER = 'drop:over',
|
||||
/**
|
||||
* @event drop:enter
|
||||
* @description Fires when a drag element enters this target.
|
||||
* @bubbles DDM
|
||||
* @type {Event.Custom}
|
||||
*/
|
||||
EV_DROP_ENTER = 'drop:enter',
|
||||
/**
|
||||
* @event drop:exit
|
||||
* @description Fires when a drag element exits this target.
|
||||
* @bubbles DDM
|
||||
* @type {Event.Custom}
|
||||
*/
|
||||
EV_DROP_EXIT = 'drop:exit',
|
||||
|
||||
/**
|
||||
* @event drop:hit
|
||||
* @description Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop)
|
||||
* @bubbles DDM
|
||||
* @type {Event.Custom}
|
||||
*/
|
||||
|
||||
|
||||
Drop = function() {
|
||||
this._lazyAddAttrs = false;
|
||||
Drop.superclass.constructor.apply(this, arguments);
|
||||
|
||||
|
||||
//DD init speed up.
|
||||
Y.on('domready', Y.bind(function() {
|
||||
Y.later(100, this, this._createShim);
|
||||
}, this));
|
||||
DDM._regTarget(this);
|
||||
|
||||
/* TODO
|
||||
if (Dom.getStyle(this.el, 'position') == 'fixed') {
|
||||
Event.on(window, 'scroll', function() {
|
||||
this.activateShim();
|
||||
}, this, true);
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
Drop.NAME = 'drop';
|
||||
|
||||
Drop.ATTRS = {
|
||||
/**
|
||||
* @attribute node
|
||||
* @description Y.Node instanace to use as the element to make a Drop Target
|
||||
* @type Node
|
||||
*/
|
||||
node: {
|
||||
setter: function(node) {
|
||||
var n = Y.Node.get(node);
|
||||
if (!n) {
|
||||
Y.error('DD.Drop: Invalid Node Given: ' + node);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute groups
|
||||
* @description Array of groups to add this drop into.
|
||||
* @type Array
|
||||
*/
|
||||
groups: {
|
||||
value: ['default'],
|
||||
setter: function(g) {
|
||||
this._groups = {};
|
||||
Y.each(g, function(v, k) {
|
||||
this._groups[v] = true;
|
||||
}, this);
|
||||
return g;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute padding
|
||||
* @description CSS style padding to make the Drop Target bigger than the node.
|
||||
* @type String
|
||||
*/
|
||||
padding: {
|
||||
value: '0',
|
||||
setter: function(p) {
|
||||
return DDM.cssSizestoObject(p);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute lock
|
||||
* @description Set to lock this drop element.
|
||||
* @type Boolean
|
||||
*/
|
||||
lock: {
|
||||
value: false,
|
||||
setter: function(lock) {
|
||||
if (lock) {
|
||||
this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-locked');
|
||||
} else {
|
||||
this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-locked');
|
||||
}
|
||||
return lock;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute bubbles
|
||||
* @description Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling.
|
||||
* @type Object
|
||||
*/
|
||||
bubbles: {
|
||||
writeOnce: true,
|
||||
value: Y.DD.DDM
|
||||
}
|
||||
};
|
||||
|
||||
Y.extend(Drop, Y.Base, {
|
||||
/**
|
||||
* @private
|
||||
* @method _createEvents
|
||||
* @description This method creates all the events for this Event Target and publishes them so we get Event Bubbling.
|
||||
*/
|
||||
_createEvents: function() {
|
||||
|
||||
var ev = [
|
||||
EV_DROP_OVER,
|
||||
EV_DROP_ENTER,
|
||||
EV_DROP_EXIT,
|
||||
'drop:hit'
|
||||
];
|
||||
|
||||
Y.each(ev, function(v, k) {
|
||||
this.publish(v, {
|
||||
type: v,
|
||||
emitFacade: true,
|
||||
preventable: false,
|
||||
bubbles: true,
|
||||
queuable: false,
|
||||
prefix: 'drop'
|
||||
});
|
||||
}, this);
|
||||
|
||||
if (this.get('bubbles')) {
|
||||
this.addTarget(this.get('bubbles'));
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @property _valid
|
||||
* @description Flag for determining if the target is valid in this operation.
|
||||
* @type Boolean
|
||||
*/
|
||||
_valid: null,
|
||||
/**
|
||||
* @private
|
||||
* @property _groups
|
||||
* @description The groups this target belongs to.
|
||||
* @type Array
|
||||
*/
|
||||
_groups: null,
|
||||
/**
|
||||
* @property shim
|
||||
* @description Node reference to the targets shim
|
||||
* @type {Object}
|
||||
*/
|
||||
shim: null,
|
||||
/**
|
||||
* @property region
|
||||
* @description A region object associated with this target, used for checking regions while dragging.
|
||||
* @type Object
|
||||
*/
|
||||
region: null,
|
||||
/**
|
||||
* @property overTarget
|
||||
* @description This flag is tripped when a drag element is over this target.
|
||||
* @type Boolean
|
||||
*/
|
||||
overTarget: null,
|
||||
/**
|
||||
* @method inGroup
|
||||
* @description Check if this target is in one of the supplied groups.
|
||||
* @param {Array} groups The groups to check against
|
||||
* @return Boolean
|
||||
*/
|
||||
inGroup: function(groups) {
|
||||
this._valid = false;
|
||||
var ret = false;
|
||||
Y.each(groups, function(v, k) {
|
||||
if (this._groups[v]) {
|
||||
ret = true;
|
||||
this._valid = true;
|
||||
}
|
||||
}, this);
|
||||
return ret;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method initializer
|
||||
* @description Private lifecycle method
|
||||
*/
|
||||
initializer: function() {
|
||||
//this._createEvents();
|
||||
Y.later(100, this, this._createEvents);
|
||||
|
||||
var node = this.get(NODE), id;
|
||||
if (!node.get('id')) {
|
||||
id = Y.stamp(node);
|
||||
node.set('id', id);
|
||||
}
|
||||
node.addClass(DDM.CSS_PREFIX + '-drop');
|
||||
//Shouldn't have to do this..
|
||||
this.set('groups', this.get('groups'));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method destructor
|
||||
* @description Lifecycle destructor, unreg the drag from the DDM and remove listeners
|
||||
*/
|
||||
destructor: function() {
|
||||
DDM._unregTarget(this);
|
||||
if (this.shim) {
|
||||
this.shim.detachAll();
|
||||
this.shim.get('parentNode').removeChild(this.shim);
|
||||
this.shim = null;
|
||||
}
|
||||
this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop');
|
||||
this.detachAll();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _deactivateShim
|
||||
* @description Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999]
|
||||
*/
|
||||
_deactivateShim: function() {
|
||||
if (!this.shim) {
|
||||
return false;
|
||||
}
|
||||
this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-valid');
|
||||
this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');
|
||||
this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');
|
||||
this.shim.setStyles({
|
||||
top: '-999px',
|
||||
left: '-999px',
|
||||
zIndex: '1'
|
||||
});
|
||||
this.overTarget = false;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _activateShim
|
||||
* @description Activates the shim and adds some interaction CSS classes
|
||||
*/
|
||||
_activateShim: function() {
|
||||
if (!DDM.activeDrag) {
|
||||
return false; //Nothing is dragging, no reason to activate.
|
||||
}
|
||||
if (this.get(NODE) === DDM.activeDrag.get(NODE)) {
|
||||
return false;
|
||||
}
|
||||
if (this.get('lock')) {
|
||||
return false;
|
||||
}
|
||||
var node = this.get(NODE);
|
||||
//TODO Visibility Check..
|
||||
//if (this.inGroup(DDM.activeDrag.get('groups')) && this.get(NODE).isVisible()) {
|
||||
if (this.inGroup(DDM.activeDrag.get('groups'))) {
|
||||
node.removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');
|
||||
node.addClass(DDM.CSS_PREFIX + '-drop-active-valid');
|
||||
DDM._addValid(this);
|
||||
this.overTarget = false;
|
||||
this.sizeShim();
|
||||
} else {
|
||||
DDM._removeValid(this);
|
||||
node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid');
|
||||
node.addClass(DDM.CSS_PREFIX + '-drop-active-invalid');
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @method sizeShim
|
||||
* @description Positions and sizes the shim with the raw data from the node, this can be used to programatically adjust the Targets shim for Animation..
|
||||
*/
|
||||
sizeShim: function() {
|
||||
if (!DDM.activeDrag) {
|
||||
return false; //Nothing is dragging, no reason to activate.
|
||||
}
|
||||
if (this.get(NODE) === DDM.activeDrag.get(NODE)) {
|
||||
return false;
|
||||
}
|
||||
if (this.get('lock')) {
|
||||
return false;
|
||||
}
|
||||
if (!this.shim) {
|
||||
Y.later(100, this, this.sizeShim);
|
||||
return false;
|
||||
}
|
||||
var node = this.get(NODE),
|
||||
nh = node.get(OFFSET_HEIGHT),
|
||||
nw = node.get(OFFSET_WIDTH),
|
||||
xy = node.getXY(),
|
||||
p = this.get('padding'),
|
||||
dd, dH, dW;
|
||||
|
||||
|
||||
//Apply padding
|
||||
nw = nw + p.left + p.right;
|
||||
nh = nh + p.top + p.bottom;
|
||||
xy[0] = xy[0] - p.left;
|
||||
xy[1] = xy[1] - p.top;
|
||||
|
||||
|
||||
if (DDM.activeDrag.get('dragMode') === DDM.INTERSECT) {
|
||||
//Intersect Mode, make the shim bigger
|
||||
dd = DDM.activeDrag;
|
||||
dH = dd.get(NODE).get(OFFSET_HEIGHT);
|
||||
dW = dd.get(NODE).get(OFFSET_WIDTH);
|
||||
|
||||
nh = (nh + dH);
|
||||
nw = (nw + dW);
|
||||
xy[0] = xy[0] - (dW - dd.deltaXY[0]);
|
||||
xy[1] = xy[1] - (dH - dd.deltaXY[1]);
|
||||
|
||||
}
|
||||
|
||||
//Set the style on the shim
|
||||
this.shim.setStyles({
|
||||
height: nh + 'px',
|
||||
width: nw + 'px',
|
||||
top: xy[1] + 'px',
|
||||
left: xy[0] + 'px'
|
||||
});
|
||||
|
||||
//Create the region to be used by intersect when a drag node is over us.
|
||||
this.region = {
|
||||
'0': xy[0],
|
||||
'1': xy[1],
|
||||
area: 0,
|
||||
top: xy[1],
|
||||
right: xy[0] + nw,
|
||||
bottom: xy[1] + nh,
|
||||
left: xy[0]
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _createShim
|
||||
* @description Creates the Target shim and adds it to the DDM's playground..
|
||||
*/
|
||||
_createShim: function() {
|
||||
//No playground, defer
|
||||
if (!DDM._pg) {
|
||||
Y.later(10, this, this._createShim);
|
||||
return;
|
||||
}
|
||||
//Shim already here, cancel
|
||||
if (this.shim) {
|
||||
return;
|
||||
}
|
||||
var s = Y.Node.create('<div id="' + this.get(NODE).get('id') + '_shim"></div>');
|
||||
|
||||
s.setStyles({
|
||||
height: this.get(NODE).get(OFFSET_HEIGHT) + 'px',
|
||||
width: this.get(NODE).get(OFFSET_WIDTH) + 'px',
|
||||
backgroundColor: 'yellow',
|
||||
opacity: '.5',
|
||||
zIndex: '1',
|
||||
overflow: 'hidden',
|
||||
top: '-900px',
|
||||
left: '-900px',
|
||||
position: 'absolute'
|
||||
});
|
||||
DDM._pg.appendChild(s);
|
||||
this.shim = s;
|
||||
|
||||
s.on('mouseover', Y.bind(this._handleOverEvent, this));
|
||||
s.on('mouseout', Y.bind(this._handleOutEvent, this));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _handleOverTarget
|
||||
* @description This handles the over target call made from this object or from the DDM
|
||||
*/
|
||||
_handleTargetOver: function() {
|
||||
if (DDM.isOverTarget(this)) {
|
||||
this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-over');
|
||||
DDM.activeDrop = this;
|
||||
DDM.otherDrops[this] = this;
|
||||
if (this.overTarget) {
|
||||
DDM.activeDrag.fire('drag:over', { drop: this, drag: DDM.activeDrag });
|
||||
this.fire(EV_DROP_OVER, { drop: this, drag: DDM.activeDrag });
|
||||
} else {
|
||||
this.overTarget = true;
|
||||
this.fire(EV_DROP_ENTER, { drop: this, drag: DDM.activeDrag });
|
||||
DDM.activeDrag.fire('drag:enter', { drop: this, drag: DDM.activeDrag });
|
||||
DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX + '-drag-over');
|
||||
//TODO - Is this needed??
|
||||
//DDM._handleTargetOver();
|
||||
}
|
||||
} else {
|
||||
this._handleOut();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _handleOverEvent
|
||||
* @description Handles the mouseover DOM event on the Target Shim
|
||||
*/
|
||||
_handleOverEvent: function() {
|
||||
this.shim.setStyle('zIndex', '999');
|
||||
DDM._addActiveShim(this);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _handleOutEvent
|
||||
* @description Handles the mouseout DOM event on the Target Shim
|
||||
*/
|
||||
_handleOutEvent: function() {
|
||||
this.shim.setStyle('zIndex', '1');
|
||||
DDM._removeActiveShim(this);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _handleOut
|
||||
* @description Handles out of target calls/checks
|
||||
*/
|
||||
_handleOut: function(force) {
|
||||
if (!DDM.isOverTarget(this) || force) {
|
||||
if (this.overTarget) {
|
||||
this.overTarget = false;
|
||||
if (!force) {
|
||||
DDM._removeActiveShim(this);
|
||||
}
|
||||
if (DDM.activeDrag) {
|
||||
this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');
|
||||
DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX + '-drag-over');
|
||||
this.fire(EV_DROP_EXIT);
|
||||
DDM.activeDrag.fire('drag:exit', { drop: this });
|
||||
delete DDM.otherDrops[this];
|
||||
//if (DDM.activeDrop === this) {
|
||||
// DDM.activeDrop = null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Y.DD.Drop = Drop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['dd-ddm-drop', 'dd-drag'], skinnable:false});
|
||||
12
jssource/src_files/include/javascript/yui3/build/dd/dd-min.js
vendored
Normal file
12
jssource/src_files/include/javascript/yui3/build/dd/dd-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
jssource/src_files/include/javascript/yui3/build/dd/dd-plugin-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-plugin-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-plugin",function(B){var A=function(C){C.node=((B.Widget&&C.host instanceof B.Widget)?C.host.get("boundingBox"):C.host);A.superclass.constructor.apply(this,arguments);};A.NAME="dd-plugin";A.NS="dd";B.extend(A,B.DD.Drag);B.namespace("Plugin");B.Plugin.Drag=A;},"3.0.0",{skinnable:false,requires:["dd-drag"],optional:["dd-constrain","dd-proxy"]});
|
||||
53
jssource/src_files/include/javascript/yui3/build/dd/dd-plugin.js
vendored
Normal file
53
jssource/src_files/include/javascript/yui3/build/dd/dd-plugin.js
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-plugin', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* This is a simple Drag plugin that can be attached to a Node via the plug method.
|
||||
* @module dd
|
||||
* @submodule dd-plugin
|
||||
*/
|
||||
/**
|
||||
* This is a simple Drag plugin that can be attached to a Node via the plug method.
|
||||
* @class Drag
|
||||
* @extends DD.Drag
|
||||
* @constructor
|
||||
* @namespace Plugin
|
||||
*/
|
||||
|
||||
|
||||
var Drag = function(config) {
|
||||
config.node = ((Y.Widget && config.host instanceof Y.Widget) ? config.host.get('boundingBox') : config.host);
|
||||
Drag.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
|
||||
/**
|
||||
* @property NAME
|
||||
* @description dd-plugin
|
||||
* @type {String}
|
||||
*/
|
||||
Drag.NAME = "dd-plugin";
|
||||
|
||||
/**
|
||||
* @property NS
|
||||
* @description The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd;
|
||||
* @type {String}
|
||||
*/
|
||||
Drag.NS = "dd";
|
||||
|
||||
|
||||
Y.extend(Drag, Y.DD.Drag);
|
||||
Y.namespace('Plugin');
|
||||
Y.Plugin.Drag = Drag;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{skinnable:false, requires:['dd-drag'], optional:['dd-constrain', 'dd-proxy']});
|
||||
8
jssource/src_files/include/javascript/yui3/build/dd/dd-proxy-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-proxy-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-proxy",function(H){var F=H.DD.DDM,B="node",C="dragNode",A="host",D=true;var G=function(I){G.superclass.constructor.apply(this,arguments);};G.NAME="DDProxy";G.NS="proxy";G.ATTRS={host:{},moveOnEnd:{value:D},hideOnEnd:{value:D},resizeFrame:{value:D},positionProxy:{value:D},borderStyle:{value:"1px solid #808080"}};var E={_hands:null,_init:function(){if(!F._proxy){H.on("domready",H.bind(this._init,this));return;}if(!this._hands){this._hands=[];}var K,L,J,M=this.get(A),I=M.get(C);if(I.compareTo(M.get(B))){if(F._proxy){M.set(C,F._proxy);}}H.each(this._hands,function(N){N.detach();});L=F.on("ddm:start",H.bind(function(){if(F.activeDrag===M){F._setFrame(M);}},this));J=F.on("ddm:end",H.bind(function(){if(M.get("dragging")){if(this.get("moveOnEnd")){M.get(B).setXY(M.lastXY);}if(this.get("hideOnEnd")){M.get(C).setStyle("display","none");}}},this));this._hands=[L,J];},initializer:function(){this._init();},destructor:function(){var I=this.get(A);H.each(this._hands,function(J){J.detach();});I.set(C,I.get(B));}};H.namespace("Plugin");H.extend(G,H.Base,E);H.Plugin.DDProxy=G;H.mix(F,{_createFrame:function(){if(!F._proxy){F._proxy=D;var J=H.Node.create("<div></div>"),I=H.Node.get("body");J.setStyles({position:"absolute",display:"none",zIndex:"999",top:"-999px",left:"-999px"});I.insertBefore(J,I.get("firstChild"));J.set("id",H.stamp(J));J.addClass(F.CSS_PREFIX+"-proxy");F._proxy=J;}},_setFrame:function(J){var M=J.get(B),L=J.get(C),I,K="auto";if(J.proxy.get("resizeFrame")){F._proxy.setStyles({height:M.get("offsetHeight")+"px",width:M.get("offsetWidth")+"px"});}I=F.activeDrag.get("activeHandle");if(I){K=I.getStyle("cursor");}if(K=="auto"){K=F.get("dragCursor");}L.setStyles({visibility:"hidden",display:"block",cursor:K,border:J.proxy.get("borderStyle")});if(J.proxy.get("positionProxy")){L.setXY(J.nodeXY);}L.setStyle("visibility","visible");}});H.on("domready",H.bind(F._createFrame,F));},"3.0.0",{requires:["dd-ddm","dd-drag"],skinnable:false});
|
||||
225
jssource/src_files/include/javascript/yui3/build/dd/dd-proxy.js
vendored
Normal file
225
jssource/src_files/include/javascript/yui3/build/dd/dd-proxy.js
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-proxy', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* The Drag & Drop Utility allows you to create a draggable interface efficiently, buffering you from browser-level abnormalities and enabling you to focus on the interesting logic surrounding your particular implementation. This component enables you to create a variety of standard draggable objects with just a few lines of code and then, using its extensive API, add your own specific implementation logic.
|
||||
* @module dd
|
||||
* @submodule dd-proxy
|
||||
*/
|
||||
/**
|
||||
* This plugin for dd-drag is for creating a proxy drag node, instead of dragging the original node.
|
||||
* @class DDProxy
|
||||
* @extends Base
|
||||
* @constructor
|
||||
* @namespace Plugin
|
||||
*/
|
||||
var DDM = Y.DD.DDM,
|
||||
NODE = 'node',
|
||||
DRAG_NODE = 'dragNode',
|
||||
HOST = 'host',
|
||||
TRUE = true;
|
||||
|
||||
var P = function(config) {
|
||||
P.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
|
||||
P.NAME = 'DDProxy';
|
||||
/**
|
||||
* @property proxy
|
||||
* @description The Proxy instance will be placed on the Drag instance under the proxy namespace.
|
||||
* @type {String}
|
||||
*/
|
||||
P.NS = 'proxy';
|
||||
|
||||
P.ATTRS = {
|
||||
host: {
|
||||
},
|
||||
/**
|
||||
* @attribute moveOnEnd
|
||||
* @description Move the original node at the end of the drag. Default: true
|
||||
* @type Boolean
|
||||
*/
|
||||
moveOnEnd: {
|
||||
value: TRUE
|
||||
},
|
||||
/**
|
||||
* @attribute hideOnEnd
|
||||
* @description Hide the drag node at the end of the drag. Default: true
|
||||
* @type Boolean
|
||||
*/
|
||||
hideOnEnd: {
|
||||
value: TRUE
|
||||
},
|
||||
/**
|
||||
* @attribute resizeFrame
|
||||
* @description Make the Proxy node assume the size of the original node. Default: true
|
||||
* @type Boolean
|
||||
*/
|
||||
resizeFrame: {
|
||||
value: TRUE
|
||||
},
|
||||
/**
|
||||
* @attribute positionProxy
|
||||
* @description Make the Proxy node appear in the same place as the original node. Default: true
|
||||
* @type Boolean
|
||||
*/
|
||||
positionProxy: {
|
||||
value: TRUE
|
||||
},
|
||||
/**
|
||||
* @attribute borderStyle
|
||||
* @description The default border style for the border of the proxy. Default: 1px solid #808080
|
||||
* @type Boolean
|
||||
*/
|
||||
borderStyle: {
|
||||
value: '1px solid #808080'
|
||||
}
|
||||
};
|
||||
|
||||
var proto = {
|
||||
/**
|
||||
* @private
|
||||
* @property _hands
|
||||
* @description Holds the event handles for setting the proxy
|
||||
*/
|
||||
_hands: null,
|
||||
/**
|
||||
* @private
|
||||
* @method _init
|
||||
* @description Handler for the proxy config attribute
|
||||
*/
|
||||
_init: function() {
|
||||
if (!DDM._proxy) {
|
||||
Y.on('domready', Y.bind(this._init, this));
|
||||
return;
|
||||
}
|
||||
if (!this._hands) {
|
||||
this._hands = [];
|
||||
}
|
||||
var i, h, h1, host = this.get(HOST), dnode = host.get(DRAG_NODE);
|
||||
if (dnode.compareTo(host.get(NODE))) {
|
||||
if (DDM._proxy) {
|
||||
host.set(DRAG_NODE, DDM._proxy);
|
||||
}
|
||||
}
|
||||
Y.each(this._hands, function(v) {
|
||||
v.detach();
|
||||
});
|
||||
h = DDM.on('ddm:start', Y.bind(function() {
|
||||
if (DDM.activeDrag === host) {
|
||||
DDM._setFrame(host);
|
||||
}
|
||||
}, this));
|
||||
h1 = DDM.on('ddm:end', Y.bind(function() {
|
||||
if (host.get('dragging')) {
|
||||
if (this.get('moveOnEnd')) {
|
||||
host.get(NODE).setXY(host.lastXY);
|
||||
}
|
||||
if (this.get('hideOnEnd')) {
|
||||
host.get(DRAG_NODE).setStyle('display', 'none');
|
||||
}
|
||||
}
|
||||
}, this));
|
||||
this._hands = [h, h1];
|
||||
},
|
||||
initializer: function() {
|
||||
this._init();
|
||||
},
|
||||
destructor: function() {
|
||||
var host = this.get(HOST);
|
||||
Y.each(this._hands, function(v) {
|
||||
v.detach();
|
||||
});
|
||||
host.set(DRAG_NODE, host.get(NODE));
|
||||
}
|
||||
};
|
||||
|
||||
Y.namespace('Plugin');
|
||||
Y.extend(P, Y.Base, proto);
|
||||
Y.Plugin.DDProxy = P;
|
||||
|
||||
//Add a couple of methods to the DDM
|
||||
Y.mix(DDM, {
|
||||
/**
|
||||
* @private
|
||||
* @for DDM
|
||||
* @namespace DD
|
||||
* @method _createFrame
|
||||
* @description Create the proxy element if it doesn't already exist and set the DD.DDM._proxy value
|
||||
*/
|
||||
_createFrame: function() {
|
||||
if (!DDM._proxy) {
|
||||
DDM._proxy = TRUE;
|
||||
|
||||
var p = Y.Node.create('<div></div>'),
|
||||
b = Y.Node.get('body');
|
||||
|
||||
p.setStyles({
|
||||
position: 'absolute',
|
||||
display: 'none',
|
||||
zIndex: '999',
|
||||
top: '-999px',
|
||||
left: '-999px'
|
||||
});
|
||||
|
||||
b.insertBefore(p, b.get('firstChild'));
|
||||
p.set('id', Y.stamp(p));
|
||||
p.addClass(DDM.CSS_PREFIX + '-proxy');
|
||||
DDM._proxy = p;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @for DDM
|
||||
* @namespace DD
|
||||
* @method _setFrame
|
||||
* @description If resizeProxy is set to true (default) it will resize the proxy element to match the size of the Drag Element.
|
||||
* If positionProxy is set to true (default) it will position the proxy element in the same location as the Drag Element.
|
||||
*/
|
||||
_setFrame: function(drag) {
|
||||
var n = drag.get(NODE), d = drag.get(DRAG_NODE), ah, cur = 'auto';
|
||||
if (drag.proxy.get('resizeFrame')) {
|
||||
DDM._proxy.setStyles({
|
||||
height: n.get('offsetHeight') + 'px',
|
||||
width: n.get('offsetWidth') + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
ah = DDM.activeDrag.get('activeHandle');
|
||||
if (ah) {
|
||||
cur = ah.getStyle('cursor');
|
||||
}
|
||||
if (cur == 'auto') {
|
||||
cur = DDM.get('dragCursor');
|
||||
}
|
||||
|
||||
|
||||
d.setStyles({
|
||||
visibility: 'hidden',
|
||||
display: 'block',
|
||||
cursor: cur,
|
||||
border: drag.proxy.get('borderStyle')
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (drag.proxy.get('positionProxy')) {
|
||||
d.setXY(drag.nodeXY);
|
||||
}
|
||||
d.setStyle('visibility', 'visible');
|
||||
}
|
||||
});
|
||||
|
||||
//Create the frame when DOM is ready
|
||||
Y.on('domready', Y.bind(DDM._createFrame, DDM));
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{requires:['dd-ddm', 'dd-drag'], skinnable:false});
|
||||
8
jssource/src_files/include/javascript/yui3/build/dd/dd-scroll-min.js
vendored
Normal file
8
jssource/src_files/include/javascript/yui3/build/dd/dd-scroll-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("dd-scroll",function(C){var H=function(){H.superclass.constructor.apply(this,arguments);},L="host",A="buffer",J="parentScroll",G="windowScroll",I="scrollTop",F="scrollLeft",E="offsetWidth",K="offsetHeight";H.ATTRS={parentScroll:{value:false,setter:function(M){if(M){return M;}return false;}},buffer:{value:30},scrollDelay:{value:235},host:{value:null},windowScroll:{value:false},vertical:{value:true},horizontal:{value:true}};C.extend(H,C.Base,{_scrolling:null,_vpRegionCache:null,_dimCache:null,_scrollTimer:null,_getVPRegion:function(){var M={};var N=this.get(J),R=this.get(A),Q=this.get(G),U=((Q)?[]:N.getXY()),S=((Q)?"winWidth":E),P=((Q)?"winHeight":K),T=((Q)?N.get(I):U[1]),O=((Q)?N.get(F):U[0]);M={top:T+R,right:(N.get(S)+O)-R,bottom:(N.get(P)+T)-R,left:O+R};this._vpRegionCache=M;return M;},initializer:function(){var M=this.get(L);M.after("drag:start",C.bind(this.start,this));M.after("drag:end",C.bind(this.end,this));M.on("drag:align",C.bind(this.align,this));C.get(window).on("scroll",C.bind(function(){this._vpRegionCache=null;},this));},_checkWinScroll:function(Y){var X=this._getVPRegion(),M=this.get(L),O=this.get(G),S=M.lastXY,N=false,e=this.get(A),R=this.get(J),g=R.get(I),U=R.get(F),V=this._dimCache.w,a=this._dimCache.h,T=S[1]+a,W=S[1],d=S[0]+V,Q=S[0],f=W,P=Q,Z=g,c=U;if(this.get("horizontal")){if(Q<=X.left){N=true;P=S[0]-((O)?e:0);c=U-e;}if(d>=X.right){N=true;P=S[0]+((O)?e:0);c=U+e;}}if(this.get("vertical")){if(T>=X.bottom){N=true;f=S[1]+((O)?e:0);Z=g+e;}if(W<=X.top){N=true;f=S[1]-((O)?e:0);Z=g-e;}}if(Z<0){Z=0;f=S[1];}if(c<0){c=0;P=S[0];}if(f<0){f=S[1];}if(P<0){P=S[0];}if(Y){M.actXY=[P,f];M._moveNode({node:R,top:Z,left:c});if(!Z&&!c){this._cancelScroll();}}else{if(N){this._initScroll();}else{this._cancelScroll();}}},_initScroll:function(){this._cancelScroll();this._scrollTimer=C.Lang.later(this.get("scrollDelay"),this,this._checkWinScroll,[true],true);},_cancelScroll:function(){this._scrolling=false;if(this._scrollTimer){this._scrollTimer.cancel();delete this._scrollTimer;}},align:function(M){if(this._scrolling){this._cancelScroll();M.preventDefault();}if(!this._scrolling){this._checkWinScroll();}},_setDimCache:function(){var M=this.get(L).get("dragNode");this._dimCache={h:M.get(K),w:M.get(E)};},start:function(){this._setDimCache();},end:function(M){this._dimCache=null;this._cancelScroll();},toString:function(){return H.NAME+" #"+this.get("node").get("id");}});C.namespace("Plugin");var B=function(){B.superclass.constructor.apply(this,arguments);};B.ATTRS=C.merge(H.ATTRS,{windowScroll:{value:true,setter:function(M){if(M){this.set(J,C.get(window));}return M;}}});C.extend(B,H,{initializer:function(){this.set("windowScroll",this.get("windowScroll"));}});B.NAME=B.NS="winscroll";C.Plugin.DDWinScroll=B;var D=function(){D.superclass.constructor.apply(this,arguments);};D.ATTRS=C.merge(H.ATTRS,{node:{value:false,setter:function(M){var N=C.get(M);if(!N){if(M!==false){C.error("DDNodeScroll: Invalid Node Given: "+M);}}else{N=N.item(0);this.set(J,N);}return N;}}});C.extend(D,H,{initializer:function(){this.set("node",this.get("node"));}});D.NAME=D.NS="nodescroll";C.Plugin.DDNodeScroll=D;C.DD.Scroll=H;},"3.0.0",{skinnable:false,requires:["dd-drag"],optional:["dd-proxy"]});
|
||||
413
jssource/src_files/include/javascript/yui3/build/dd/dd-scroll.js
vendored
Normal file
413
jssource/src_files/include/javascript/yui3/build/dd/dd-scroll.js
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('dd-scroll', function(Y) {
|
||||
|
||||
|
||||
/**
|
||||
* The Drag & Drop Utility allows you to create a draggable interface efficiently, buffering you from browser-level abnormalities and enabling you to focus on the interesting logic surrounding your particular implementation. This component enables you to create a variety of standard draggable objects with just a few lines of code and then, using its extensive API, add your own specific implementation logic.
|
||||
* @module dd
|
||||
* @submodule dd-scroll
|
||||
*/
|
||||
/**
|
||||
* This class is the base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll.
|
||||
* This class should not be called on it's own, it's designed to be a plugin.
|
||||
* @class Scroll
|
||||
* @extends Base
|
||||
* @namespace DD
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
var S = function() {
|
||||
S.superclass.constructor.apply(this, arguments);
|
||||
|
||||
},
|
||||
HOST = 'host',
|
||||
BUFFER = 'buffer',
|
||||
PARENT_SCROLL = 'parentScroll',
|
||||
WINDOW_SCROLL = 'windowScroll',
|
||||
SCROLL_TOP = 'scrollTop',
|
||||
SCROLL_LEFT = 'scrollLeft',
|
||||
OFFSET_WIDTH = 'offsetWidth',
|
||||
OFFSET_HEIGHT = 'offsetHeight';
|
||||
|
||||
|
||||
S.ATTRS = {
|
||||
/**
|
||||
* @attribute parentScroll
|
||||
* @description Internal config option to hold the node that we are scrolling. Should not be set by the developer.
|
||||
* @type Node
|
||||
*/
|
||||
parentScroll: {
|
||||
value: false,
|
||||
setter: function(node) {
|
||||
if (node) {
|
||||
return node;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @attribute buffer
|
||||
* @description The number of pixels from the edge of the screen to turn on scrolling. Default: 30
|
||||
* @type Number
|
||||
*/
|
||||
buffer: {
|
||||
value: 30
|
||||
},
|
||||
/**
|
||||
* @attribute scrollDelay
|
||||
* @description The number of milliseconds delay to pass to the auto scroller. Default: 235
|
||||
* @type Number
|
||||
*/
|
||||
scrollDelay: {
|
||||
value: 235
|
||||
},
|
||||
/**
|
||||
* @attribute host
|
||||
* @description The host we are plugged into.
|
||||
* @type Object
|
||||
*/
|
||||
host: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* @attribute windowScroll
|
||||
* @description Turn on window scroll support, default: false
|
||||
* @type Boolean
|
||||
*/
|
||||
windowScroll: {
|
||||
value: false
|
||||
},
|
||||
/**
|
||||
* @attribute vertical
|
||||
* @description Allow vertical scrolling, default: true.
|
||||
* @type Boolean
|
||||
*/
|
||||
vertical: {
|
||||
value: true
|
||||
},
|
||||
/**
|
||||
* @attribute horizontal
|
||||
* @description Allow horizontal scrolling, default: true.
|
||||
* @type Boolean
|
||||
*/
|
||||
horizontal: {
|
||||
value: true
|
||||
}
|
||||
};
|
||||
|
||||
Y.extend(S, Y.Base, {
|
||||
/**
|
||||
* @private
|
||||
* @property _scrolling
|
||||
* @description Tells if we are actively scrolling or not.
|
||||
* @type Boolean
|
||||
*/
|
||||
_scrolling: null,
|
||||
/**
|
||||
* @private
|
||||
* @property _vpRegionCache
|
||||
* @description Cache of the Viewport dims.
|
||||
* @type Object
|
||||
*/
|
||||
_vpRegionCache: null,
|
||||
/**
|
||||
* @private
|
||||
* @property _dimCache
|
||||
* @description Cache of the dragNode dims.
|
||||
* @type Object
|
||||
*/
|
||||
_dimCache: null,
|
||||
/**
|
||||
* @private
|
||||
* @property _scrollTimer
|
||||
* @description Holder for the Timer object returned from Y.later.
|
||||
* @type {Y.later}
|
||||
*/
|
||||
_scrollTimer: null,
|
||||
/**
|
||||
* @private
|
||||
* @method _getVPRegion
|
||||
* @description Sets the _vpRegionCache property with an Object containing the dims from the viewport.
|
||||
*/
|
||||
_getVPRegion: function() {
|
||||
var r = {};
|
||||
//if (!this._vpRegionCache) {
|
||||
var n = this.get(PARENT_SCROLL),
|
||||
b = this.get(BUFFER),
|
||||
ws = this.get(WINDOW_SCROLL),
|
||||
xy = ((ws) ? [] : n.getXY()),
|
||||
w = ((ws) ? 'winWidth' : OFFSET_WIDTH),
|
||||
h = ((ws) ? 'winHeight' : OFFSET_HEIGHT),
|
||||
t = ((ws) ? n.get(SCROLL_TOP) : xy[1]),
|
||||
l = ((ws) ? n.get(SCROLL_LEFT) : xy[0]);
|
||||
|
||||
r = {
|
||||
top: t + b,
|
||||
right: (n.get(w) + l) - b,
|
||||
bottom: (n.get(h) + t) - b,
|
||||
left: l + b
|
||||
};
|
||||
this._vpRegionCache = r;
|
||||
//} else {
|
||||
// r = this._vpRegionCache;
|
||||
//}
|
||||
return r;
|
||||
},
|
||||
initializer: function() {
|
||||
var h = this.get(HOST);
|
||||
h.after('drag:start', Y.bind(this.start, this));
|
||||
h.after('drag:end', Y.bind(this.end, this));
|
||||
h.on('drag:align', Y.bind(this.align, this));
|
||||
|
||||
//TODO - This doesn't work yet??
|
||||
Y.get(window).on('scroll', Y.bind(function() {
|
||||
this._vpRegionCache = null;
|
||||
}, this));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _checkWinScroll
|
||||
* @description Check to see if we need to fire the scroll timer. If scroll timer is running this will scroll the window.
|
||||
* @param {Boolean} move Should we move the window. From Y.later
|
||||
*/
|
||||
_checkWinScroll: function(move) {
|
||||
var r = this._getVPRegion(),
|
||||
ho = this.get(HOST),
|
||||
ws = this.get(WINDOW_SCROLL),
|
||||
xy = ho.lastXY,
|
||||
scroll = false,
|
||||
b = this.get(BUFFER),
|
||||
win = this.get(PARENT_SCROLL),
|
||||
sTop = win.get(SCROLL_TOP),
|
||||
sLeft = win.get(SCROLL_LEFT),
|
||||
w = this._dimCache.w,
|
||||
h = this._dimCache.h,
|
||||
bottom = xy[1] + h,
|
||||
top = xy[1],
|
||||
right = xy[0] + w,
|
||||
left = xy[0],
|
||||
nt = top,
|
||||
nl = left,
|
||||
st = sTop,
|
||||
sl = sLeft;
|
||||
|
||||
if (this.get('horizontal')) {
|
||||
if (left <= r.left) {
|
||||
scroll = true;
|
||||
nl = xy[0] - ((ws) ? b : 0);
|
||||
sl = sLeft - b;
|
||||
}
|
||||
if (right >= r.right) {
|
||||
scroll = true;
|
||||
nl = xy[0] + ((ws) ? b : 0);
|
||||
sl = sLeft + b;
|
||||
}
|
||||
}
|
||||
if (this.get('vertical')) {
|
||||
if (bottom >= r.bottom) {
|
||||
scroll = true;
|
||||
nt = xy[1] + ((ws) ? b : 0);
|
||||
st = sTop + b;
|
||||
|
||||
}
|
||||
if (top <= r.top) {
|
||||
scroll = true;
|
||||
nt = xy[1] - ((ws) ? b : 0);
|
||||
st = sTop - b;
|
||||
}
|
||||
}
|
||||
|
||||
if (st < 0) {
|
||||
st = 0;
|
||||
nt = xy[1];
|
||||
}
|
||||
|
||||
if (sl < 0) {
|
||||
sl = 0;
|
||||
nl = xy[0];
|
||||
}
|
||||
|
||||
if (nt < 0) {
|
||||
nt = xy[1];
|
||||
}
|
||||
if (nl < 0) {
|
||||
nl = xy[0];
|
||||
}
|
||||
if (move) {
|
||||
ho.actXY = [nl, nt];
|
||||
ho._moveNode({ node: win, top: st, left: sl});
|
||||
if (!st && !sl) {
|
||||
this._cancelScroll();
|
||||
}
|
||||
} else {
|
||||
if (scroll) {
|
||||
this._initScroll();
|
||||
} else {
|
||||
this._cancelScroll();
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _initScroll
|
||||
* @description Cancel a previous scroll timer and init a new one.
|
||||
*/
|
||||
_initScroll: function() {
|
||||
this._cancelScroll();
|
||||
this._scrollTimer = Y.Lang.later(this.get('scrollDelay'), this, this._checkWinScroll, [true], true);
|
||||
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _cancelScroll
|
||||
* @description Cancel a currently running scroll timer.
|
||||
*/
|
||||
_cancelScroll: function() {
|
||||
this._scrolling = false;
|
||||
if (this._scrollTimer) {
|
||||
this._scrollTimer.cancel();
|
||||
delete this._scrollTimer;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @method align
|
||||
* @description Called from the drag:align event to determine if we need to scroll.
|
||||
*/
|
||||
align: function(e) {
|
||||
if (this._scrolling) {
|
||||
this._cancelScroll();
|
||||
e.preventDefault();
|
||||
}
|
||||
if (!this._scrolling) {
|
||||
this._checkWinScroll();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @method _setDimCache
|
||||
* @description Set the cache of the dragNode dims.
|
||||
*/
|
||||
_setDimCache: function() {
|
||||
var node = this.get(HOST).get('dragNode');
|
||||
this._dimCache = {
|
||||
h: node.get(OFFSET_HEIGHT),
|
||||
w: node.get(OFFSET_WIDTH)
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @method start
|
||||
* @description Called from the drag:start event
|
||||
*/
|
||||
start: function() {
|
||||
this._setDimCache();
|
||||
},
|
||||
/**
|
||||
* @method end
|
||||
* @description Called from the drag:end event
|
||||
*/
|
||||
end: function(xy) {
|
||||
this._dimCache = null;
|
||||
this._cancelScroll();
|
||||
},
|
||||
/**
|
||||
* @method toString
|
||||
* @description General toString method for logging
|
||||
* @return String name for the object
|
||||
*/
|
||||
toString: function() {
|
||||
return S.NAME + ' #' + this.get('node').get('id');
|
||||
}
|
||||
});
|
||||
|
||||
Y.namespace('Plugin');
|
||||
|
||||
|
||||
/**
|
||||
* Extends the Scroll class to make the window scroll while dragging.
|
||||
* @class DDWindowScroll
|
||||
* @extends DD.Scroll
|
||||
* @namespace Plugin
|
||||
* @constructor
|
||||
*/
|
||||
var WS = function() {
|
||||
WS.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
WS.ATTRS = Y.merge(S.ATTRS, {
|
||||
/**
|
||||
* @attribute windowScroll
|
||||
* @description Turn on window scroll support, default: true
|
||||
* @type Boolean
|
||||
*/
|
||||
windowScroll: {
|
||||
value: true,
|
||||
setter: function(scroll) {
|
||||
if (scroll) {
|
||||
this.set(PARENT_SCROLL, Y.get(window));
|
||||
}
|
||||
return scroll;
|
||||
}
|
||||
}
|
||||
});
|
||||
Y.extend(WS, S, {
|
||||
//Shouldn't have to do this..
|
||||
initializer: function() {
|
||||
this.set('windowScroll', this.get('windowScroll'));
|
||||
}
|
||||
});
|
||||
WS.NAME = WS.NS = 'winscroll';
|
||||
Y.Plugin.DDWinScroll = WS;
|
||||
|
||||
|
||||
/**
|
||||
* Extends the Scroll class to make a parent node scroll while dragging.
|
||||
* @class DDNodeScroll
|
||||
* @extends DD.Scroll
|
||||
* @namespace Plugin
|
||||
* @constructor
|
||||
*/
|
||||
var NS = function() {
|
||||
NS.superclass.constructor.apply(this, arguments);
|
||||
|
||||
};
|
||||
NS.ATTRS = Y.merge(S.ATTRS, {
|
||||
/**
|
||||
* @attribute node
|
||||
* @description The node we want to scroll. Used to set the internal parentScroll attribute.
|
||||
* @type Node
|
||||
*/
|
||||
node: {
|
||||
value: false,
|
||||
setter: function(node) {
|
||||
var n = Y.get(node);
|
||||
if (!n) {
|
||||
if (node !== false) {
|
||||
Y.error('DDNodeScroll: Invalid Node Given: ' + node);
|
||||
}
|
||||
} else {
|
||||
n = n.item(0);
|
||||
this.set(PARENT_SCROLL, n);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
});
|
||||
Y.extend(NS, S, {
|
||||
//Shouldn't have to do this..
|
||||
initializer: function() {
|
||||
this.set('node', this.get('node'));
|
||||
}
|
||||
});
|
||||
NS.NAME = NS.NS = 'nodescroll';
|
||||
Y.Plugin.DDNodeScroll = NS;
|
||||
|
||||
Y.DD.Scroll = S;
|
||||
|
||||
|
||||
|
||||
}, '3.0.0' ,{skinnable:false, requires:['dd-drag'], optional:['dd-proxy']});
|
||||
3529
jssource/src_files/include/javascript/yui3/build/dd/dd.js
vendored
Normal file
3529
jssource/src_files/include/javascript/yui3/build/dd/dd.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user