Merge pull request #2637 from fredj/kinetic-optim
Don't compute velocity if not needed
This commit is contained in:
+2
-2
@@ -115,7 +115,7 @@ ol.Kinetic.prototype.end = function() {
|
|||||||
ol.Kinetic.prototype.pan = function(source) {
|
ol.Kinetic.prototype.pan = function(source) {
|
||||||
var decay = this.decay_;
|
var decay = this.decay_;
|
||||||
var initialVelocity = this.initialVelocity_;
|
var initialVelocity = this.initialVelocity_;
|
||||||
var minVelocity = this.minVelocity_;
|
var velocity = this.minVelocity_ - initialVelocity;
|
||||||
var duration = this.getDuration_();
|
var duration = this.getDuration_();
|
||||||
var easingFunction = (
|
var easingFunction = (
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +124,7 @@ ol.Kinetic.prototype.pan = function(source) {
|
|||||||
*/
|
*/
|
||||||
function(t) {
|
function(t) {
|
||||||
return initialVelocity * (Math.exp((decay * t) * duration) - 1) /
|
return initialVelocity * (Math.exp((decay * t) * duration) - 1) /
|
||||||
(minVelocity - initialVelocity);
|
velocity;
|
||||||
});
|
});
|
||||||
return ol.animation.pan({
|
return ol.animation.pan({
|
||||||
source: source,
|
source: source,
|
||||||
|
|||||||
Reference in New Issue
Block a user