mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 17:21:50 +03:00
modifying public property names in spring.js, currentValue and currentTime are now current.point and current.time
This commit is contained in:
parent
55f1e47156
commit
878269e0e9
@ -3060,18 +3060,23 @@ $.Spring = function( options ) {
|
||||
$.extend( true, this, options);
|
||||
|
||||
|
||||
this.currentValue = typeof ( this.initial ) == "number" ? this.initial : 0;
|
||||
this.startValue = this.currentValue;
|
||||
this.targetValue = this.currentValue;
|
||||
this.current = {
|
||||
point: typeof ( this.initial ) == "number" ?
|
||||
this.initial :
|
||||
0,
|
||||
time: new Date().getTime() // always work in milliseconds
|
||||
}
|
||||
|
||||
this.currentTime = new Date().getTime(); // always work in milliseconds
|
||||
this.startTime = this.currentTime;
|
||||
this.targetTime = this.currentTime;
|
||||
this.startValue = this.current.point;
|
||||
this.startTime = this.current.time;
|
||||
|
||||
this.targetValue = this.current.point;
|
||||
this.targetTime = this.current.time;
|
||||
};
|
||||
|
||||
$.Spring.prototype = {
|
||||
getCurrent: function() {
|
||||
return this.currentValue;
|
||||
return this.current.point;
|
||||
},
|
||||
|
||||
getTarget: function() {
|
||||
@ -3080,14 +3085,14 @@ $.Spring.prototype = {
|
||||
|
||||
resetTo: function(target) {
|
||||
this.targetValue = target;
|
||||
this.targetTime = this.currentTime;
|
||||
this.targetTime = this.current.time;
|
||||
this.startValue = this.targetValue;
|
||||
this.startTime = this.targetTime;
|
||||
},
|
||||
|
||||
springTo: function(target) {
|
||||
this.startValue = this.currentValue;
|
||||
this.startTime = this.currentTime;
|
||||
this.startValue = this.current.point;
|
||||
this.startTime = this.current.time;
|
||||
this.targetValue = target;
|
||||
this.targetTime = this.startTime + 1000 * this.animationTime;
|
||||
},
|
||||
@ -3098,14 +3103,14 @@ $.Spring.prototype = {
|
||||
},
|
||||
|
||||
update: function() {
|
||||
this.currentTime = new Date().getTime();
|
||||
this.currentValue = (this.currentTime >= this.targetTime) ?
|
||||
this.current.time = new Date().getTime();
|
||||
this.current.point = (this.current.time >= this.targetTime) ?
|
||||
this.targetValue :
|
||||
this.startValue +
|
||||
(this.targetValue - this.startValue) *
|
||||
transform(
|
||||
this.springStiffness,
|
||||
(this.currentTime - this.startTime) /
|
||||
(this.current.time - this.startTime) /
|
||||
(this.targetTime - this.startTime)
|
||||
);
|
||||
}
|
||||
|
@ -23,18 +23,23 @@ $.Spring = function( options ) {
|
||||
$.extend( true, this, options);
|
||||
|
||||
|
||||
this.currentValue = typeof ( this.initial ) == "number" ? this.initial : 0;
|
||||
this.startValue = this.currentValue;
|
||||
this.targetValue = this.currentValue;
|
||||
this.current = {
|
||||
point: typeof ( this.initial ) == "number" ?
|
||||
this.initial :
|
||||
0,
|
||||
time: new Date().getTime() // always work in milliseconds
|
||||
}
|
||||
|
||||
this.currentTime = new Date().getTime(); // always work in milliseconds
|
||||
this.startTime = this.currentTime;
|
||||
this.targetTime = this.currentTime;
|
||||
this.startValue = this.current.point;
|
||||
this.startTime = this.current.time;
|
||||
|
||||
this.targetValue = this.current.point;
|
||||
this.targetTime = this.current.time;
|
||||
};
|
||||
|
||||
$.Spring.prototype = {
|
||||
getCurrent: function() {
|
||||
return this.currentValue;
|
||||
return this.current.point;
|
||||
},
|
||||
|
||||
getTarget: function() {
|
||||
@ -43,14 +48,14 @@ $.Spring.prototype = {
|
||||
|
||||
resetTo: function(target) {
|
||||
this.targetValue = target;
|
||||
this.targetTime = this.currentTime;
|
||||
this.targetTime = this.current.time;
|
||||
this.startValue = this.targetValue;
|
||||
this.startTime = this.targetTime;
|
||||
},
|
||||
|
||||
springTo: function(target) {
|
||||
this.startValue = this.currentValue;
|
||||
this.startTime = this.currentTime;
|
||||
this.startValue = this.current.point;
|
||||
this.startTime = this.current.time;
|
||||
this.targetValue = target;
|
||||
this.targetTime = this.startTime + 1000 * this.animationTime;
|
||||
},
|
||||
@ -61,14 +66,14 @@ $.Spring.prototype = {
|
||||
},
|
||||
|
||||
update: function() {
|
||||
this.currentTime = new Date().getTime();
|
||||
this.currentValue = (this.currentTime >= this.targetTime) ?
|
||||
this.current.time = new Date().getTime();
|
||||
this.current.point = (this.current.time >= this.targetTime) ?
|
||||
this.targetValue :
|
||||
this.startValue +
|
||||
(this.targetValue - this.startValue) *
|
||||
transform(
|
||||
this.springStiffness,
|
||||
(this.currentTime - this.startTime) /
|
||||
(this.current.time - this.startTime) /
|
||||
(this.targetTime - this.startTime)
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user