I am writing a ST2 application where I need to allow the user to toggle on/off the display of a panel in the UI. I am using a button that toggles on selection. When the user clicks the button it calls show() on the panel and when they click it again it calls hide() on the panel. The show/hide of the panel is animated using slideIn/slideOut.
This all works fine except when the user hits the button again quickly while the animation is still in progress for the panel. When a show is in progress and I call hide() before it is done, the hide takes over the the animation proceed to hide the panel. But when the opposite happens and I call show() while the panel is still hiding, the show is ignored and the panel stays hidden.
My current best idea is to solve it by disabling the button until the hide animation is complete. Problem is that I can't find a way to determine this. There is no completion callback on hide() or show() that I can tell.
Does anyone know how I can solve this problem and/or get a callback when hide/show completes?