AdevintaSpain / Parallax-Layer-Layout

Layered parallax effect to any Android views
957 stars 84 forks source link

Bug when phone is flipped #21

Open DenisMondon opened 6 years ago

DenisMondon commented 6 years ago

Hi, great library!

When using the phone like this: phone above my head with screen facing the ground, a bug appears. The layout is "jumping"...

Does anyone have the same problem? Thanks

Sloy commented 6 years ago

Hi @DenisMondon, thanks for reporting it. You're right, when the phone is facing down the parallax effect gets confused. It only happens when you start the parallax in a normal position and then move the phone to that orientation. It doesn't happen when you start the parallax when facing down already.

I'm only guessing it's because the roll value is jumping suddenly from 1.0 to -1.0.

I guess an easy fix could be to discard such jumps and avoid updating the parallax when the roll goes immediately from 1.0 to -1.0, so that only intermediate and more reasonable values are used for the effect.

Do you think that would solve the issue? We don't have the time for it at the moment, but if you'd like to open a PR for it we would be grateful and include it :)