31 lines
813 B
JavaScript
31 lines
813 B
JavaScript
|
|
|
|
// usage assumption: currentStyle values have already been rendered but it says
|
|
// nothing of whether currentStyle is stale (see unreadPropStyle)
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports['default'] = shouldStopAnimation;
|
|
|
|
function shouldStopAnimation(currentStyle, style, currentVelocity) {
|
|
for (var key in style) {
|
|
if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
|
continue;
|
|
}
|
|
|
|
if (currentVelocity[key] !== 0) {
|
|
return false;
|
|
}
|
|
|
|
var styleValue = typeof style[key] === 'number' ? style[key] : style[key].val;
|
|
// stepper will have already taken care of rounding precision errors, so
|
|
// won't have such thing as 0.9999 !=== 1
|
|
if (currentStyle[key] !== styleValue) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
module.exports = exports['default']; |