Merge pull request #4179 from marcjansen/no-goog-now

Use Date.now() instead of goog.now()
This commit is contained in:
Marc Jansen
2015-09-28 16:00:49 +02:00
3 changed files with 8 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ goog.require('ol.easing');
*/
ol.animation.bounce = function(options) {
var resolution = options.resolution;
var start = options.start ? options.start : goog.now();
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.upAndDown;
@@ -52,7 +52,7 @@ ol.animation.bounce = function(options) {
*/
ol.animation.pan = function(options) {
var source = options.source;
var start = options.start ? options.start : goog.now();
var start = options.start ? options.start : Date.now();
var sourceX = source[0];
var sourceY = source[1];
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -92,7 +92,7 @@ ol.animation.pan = function(options) {
*/
ol.animation.rotate = function(options) {
var sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : goog.now();
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
@@ -138,7 +138,7 @@ ol.animation.rotate = function(options) {
*/
ol.animation.zoom = function(options) {
var sourceResolution = options.resolution;
var start = options.start ? options.start : goog.now();
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;

View File

@@ -91,11 +91,11 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
this.delta_ += mouseWheelEvent.deltaY;
if (this.startTime_ === undefined) {
this.startTime_ = goog.now();
this.startTime_ = Date.now();
}
var duration = ol.MOUSEWHEELZOOM_TIMEOUT_DURATION;
var timeLeft = Math.max(duration - (goog.now() - this.startTime_), 0);
var timeLeft = Math.max(duration - (Date.now() - this.startTime_), 0);
goog.global.clearTimeout(this.timeoutId_);
this.timeoutId_ = goog.global.setTimeout(

View File

@@ -73,7 +73,7 @@ ol.Kinetic.prototype.begin = function() {
* @param {number} y Y.
*/
ol.Kinetic.prototype.update = function(x, y) {
this.points_.push(x, y, goog.now());
this.points_.push(x, y, Date.now());
};
@@ -86,7 +86,7 @@ ol.Kinetic.prototype.end = function() {
// in the array)
return false;
}
var delay = goog.now() - this.delay_;
var delay = Date.now() - this.delay_;
var lastIndex = this.points_.length - 3;
if (this.points_[lastIndex + 2] < delay) {
// the last tracked point is too old, which means that the user stopped