Author Topic: ScrollView receive Centering event when become active  (Read 4434 times)

Petr

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
ScrollView receive Centering event when become active
« on: March 31, 2014, 09:53:37 AM »
I have  UIScrollView with WrapContent and CenterOnChild attached in my interface( for changing players weapons, its a list of weapon images).
I have chat button.
when I press Chat button, UIPanel which contains ScrollView  becomes inactive.
If I make swipes in chat mode at ANY place of screen, and close chat mode (UIPanel, UIScrollView, ... becomes active again), UICenterOnChild.onFinished fires, and players weapon changed.
How should I fix this?
Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollView receive Centering event when become active
« Reply #1 on: April 01, 2014, 10:24:22 AM »
UICenterOnChild triggers the Recenter() function when it's enabled. It's done intentionally so that it's always centered on some object. Change your logic to take this into consideration. I don't know why you'd be changing weapons as a result of OnFinished logic. Clicking I can understand. But recenter? And even if you were, why does it matter? The weapon should be the same, so choosing the same weapon a second time should have no effect. Again -- account for this in your code.