mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-18 11:11:29 +00:00
upgrade dojo to 1.8.3 (refs #570)
This commit is contained in:
64
lib/dojo/dnd/TimedMoveable.js.uncompressed.js
Normal file
64
lib/dojo/dnd/TimedMoveable.js.uncompressed.js
Normal file
@@ -0,0 +1,64 @@
|
||||
define("dojo/dnd/TimedMoveable", ["../_base/declare", "./Moveable" /*=====, "./Mover" =====*/], function(declare, Moveable /*=====, Mover =====*/){
|
||||
// module:
|
||||
// dojo/dnd/TimedMoveable
|
||||
|
||||
/*=====
|
||||
var __TimedMoveableArgs = declare([Moveable.__MoveableArgs], {
|
||||
// timeout: Number
|
||||
// delay move by this number of ms,
|
||||
// accumulating position changes during the timeout
|
||||
timeout: 0
|
||||
});
|
||||
=====*/
|
||||
|
||||
// precalculate long expressions
|
||||
var oldOnMove = Moveable.prototype.onMove;
|
||||
|
||||
return declare("dojo.dnd.TimedMoveable", 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: __TimedMoveableArgs
|
||||
// object with additional parameters.
|
||||
|
||||
// sanitize parameters
|
||||
if(!params){ params = {}; }
|
||||
if(params.timeout && typeof params.timeout == "number" && params.timeout >= 0){
|
||||
this.timeout = params.timeout;
|
||||
}
|
||||
},
|
||||
|
||||
onMoveStop: function(/*Mover*/ mover){
|
||||
if(mover._timer){
|
||||
// stop timer
|
||||
clearTimeout(mover._timer);
|
||||
// reflect the last received position
|
||||
oldOnMove.call(this, mover, mover._leftTop);
|
||||
}
|
||||
Moveable.prototype.onMoveStop.apply(this, arguments);
|
||||
},
|
||||
onMove: function(/*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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user