Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL layout direction for AccordionTransformer #2

Open
alaa-abuzarifa opened this issue Jul 13, 2020 · 0 comments
Open

RTL layout direction for AccordionTransformer #2

alaa-abuzarifa opened this issue Jul 13, 2020 · 0 comments

Comments

@alaa-abuzarifa
Copy link

The AccordionTransformer doesn't support RTL direction.
I've tried to redo the math in order to support it, but no luck so far.
Any idea how to solve this.?

override fun onTransform(page: View, position: Float) {
      page.run {
          if (page.layoutDirection == 0) { // ltr
              pivotX = if (position < 0f) 0f else width.toFloat()
              scaleX = if (position < 0f) 1f + position else 1f - position
          } else {  // rtl

              // that's the closest that I've got, but it's not 100% correct, something needs adjustment..
              pivotX = if (position < 0f) 0f else width.toFloat()
              scaleX = if (position < 0f) 1f + position else 1f - position
          }
      }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant