mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Trying to round NaN
This commit is contained in:
parent
902b6f6486
commit
2c76508c92
1 changed files with 8 additions and 4 deletions
|
@ -86,10 +86,14 @@ class CrossFadeChangeHandler : AnimatorChangeHandler {
|
|||
animatorSet.duration = if (isPush) {
|
||||
200
|
||||
} else {
|
||||
from?.let {
|
||||
val startX = from.width.toFloat() * 0.2f
|
||||
((startX - it.x) / startX) * 150f
|
||||
}?.roundToLong() ?: 150
|
||||
try {
|
||||
from?.let {
|
||||
val startX = from.width.toFloat() * 0.2f
|
||||
((startX - it.x) / startX) * 150f
|
||||
}?.roundToLong()
|
||||
} catch (e: IllegalArgumentException) {
|
||||
null
|
||||
} ?: 150
|
||||
}
|
||||
animatorSet.doOnCancel { to?.x = 0f }
|
||||
animatorSet.doOnEnd { to?.x = 0f }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue