( currentStyle: PlainStyle, style: Style, currentVelocity: Velocity, )
| 4 | // usage assumption: currentStyle values have already been rendered but it says |
| 5 | // nothing of whether currentStyle is stale (see unreadPropStyle) |
| 6 | export default function shouldStopAnimation( |
| 7 | currentStyle: PlainStyle, |
| 8 | style: Style, |
| 9 | currentVelocity: Velocity, |
| 10 | ): boolean { |
| 11 | for (let key in style) { |
| 12 | if (!Object.prototype.hasOwnProperty.call(style, key)) { |
| 13 | continue; |
| 14 | } |
| 15 | |
| 16 | if (currentVelocity[key] !== 0) { |
| 17 | return false; |
| 18 | } |
| 19 | |
| 20 | const styleValue = typeof style[key] === 'number' |
| 21 | ? style[key] |
| 22 | : style[key].val; |
| 23 | // stepper will have already taken care of rounding precision errors, so |
| 24 | // won't have such thing as 0.9999 !=== 1 |
| 25 | if (currentStyle[key] !== styleValue) { |
| 26 | return false; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | return true; |
| 31 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…