summaryrefslogtreecommitdiff
path: root/lib/dojo/dnd/TimedMoveable.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/dnd/TimedMoveable.js')
-rw-r--r--lib/dojo/dnd/TimedMoveable.js77
1 files changed, 2 insertions, 75 deletions
diff --git a/lib/dojo/dnd/TimedMoveable.js b/lib/dojo/dnd/TimedMoveable.js
index bd8e7d253..049ee5da1 100644
--- a/lib/dojo/dnd/TimedMoveable.js
+++ b/lib/dojo/dnd/TimedMoveable.js
@@ -4,78 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.dnd.TimedMoveable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.dnd.TimedMoveable"] = true;
-dojo.provide("dojo.dnd.TimedMoveable");
-dojo.require("dojo.dnd.Moveable");
-
-
-/*=====
-dojo.declare("dojo.dnd.__TimedMoveableArgs", [dojo.dnd.__MoveableArgs], {
- // timeout: Number
- // delay move by this number of ms,
- // accumulating position changes during the timeout
- timeout: 0
-});
-=====*/
-
-(function(){
- // precalculate long expressions
- var oldOnMove = dojo.dnd.Moveable.prototype.onMove;
-
- dojo.declare("dojo.dnd.TimedMoveable", dojo.dnd.Moveable, {
- // summary:
- // A specialized version of Moveable to support an FPS throttling.
- // This class puts an upper restriction on FPS, which may reduce
- // the CPU load. The additional parameter "timeout" regulates
- // the delay before actually moving the moveable object.
-
- // object attributes (for markup)
- timeout: 40, // in ms, 40ms corresponds to 25 fps
-
- constructor: function(node, params){
- // summary:
- // an object that makes a node moveable with a timer
- // node: Node||String
- // a node (or node's id) to be moved
- // params: dojo.dnd.__TimedMoveableArgs
- // object with additional parameters.
-
- // sanitize parameters
- if(!params){ params = {}; }
- if(params.timeout && typeof params.timeout == "number" && params.timeout >= 0){
- this.timeout = params.timeout;
- }
- },
-
- // markup methods
- markupFactory: function(params, node){
- return new dojo.dnd.TimedMoveable(node, params);
- },
-
- onMoveStop: function(/* dojo.dnd.Mover */ mover){
- if(mover._timer){
- // stop timer
- clearTimeout(mover._timer)
- // reflect the last received position
- oldOnMove.call(this, mover, mover._leftTop)
- }
- dojo.dnd.Moveable.prototype.onMoveStop.apply(this, arguments);
- },
- onMove: function(/* dojo.dnd.Mover */ mover, /* Object */ leftTop){
- mover._leftTop = leftTop;
- if(!mover._timer){
- var _t = this; // to avoid using dojo.hitch()
- mover._timer = setTimeout(function(){
- // we don't have any pending requests
- mover._timer = null;
- // reflect the last received position
- oldOnMove.call(_t, mover, mover._leftTop);
- }, this.timeout);
- }
- }
- });
-})();
-
-}
+//>>built
+define("dojo/dnd/TimedMoveable",["../main","./Moveable"],function(_1){var _2=_1.dnd.Moveable.prototype.onMove;_1.declare("dojo.dnd.TimedMoveable",_1.dnd.Moveable,{timeout:40,constructor:function(_3,_4){if(!_4){_4={};}if(_4.timeout&&typeof _4.timeout=="number"&&_4.timeout>=0){this.timeout=_4.timeout;}},onMoveStop:function(_5){if(_5._timer){clearTimeout(_5._timer);_2.call(this,_5,_5._leftTop);}_1.dnd.Moveable.prototype.onMoveStop.apply(this,arguments);},onMove:function(_6,_7){_6._leftTop=_7;if(!_6._timer){var _8=this;_6._timer=setTimeout(function(){_6._timer=null;_2.call(_8,_6,_6._leftTop);},this.timeout);}}});return _1.dnd.TimedMoveable;}); \ No newline at end of file