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

Issue with checkmark animation and quick clicking #3

Open
aksh1t opened this issue Sep 4, 2014 · 5 comments
Open

Issue with checkmark animation and quick clicking #3

aksh1t opened this issue Sep 4, 2014 · 5 comments

Comments

@aksh1t
Copy link

aksh1t commented Sep 4, 2014

temp

Hi bfeher!

You have done a wonderful job with the material design controls. I'm a fan! Here's one issue that I spotted with the checkmark animation.

This issue will be more noticeable if you increase the bfPaperCheckbox_animationDurationConstant so that the animations will be slower. When I click on the control, the circular ripple effect is asynchronous - meaning that I can click the button again before the first ripple has finished animating and still, a second animation will occur. But the checkmark -> empty box animation is not asynchronous. If I click fast on the button before the checkmark has finished animating, the state of the switch will not change.

Also, sometimes I see that on clicking the "animate change" button repeatedly very fast the state of control and "BFPaperCheckbox [ON]" text will become out of sync. The checkbox will be empty box, but the text will show [ON] or vice versa.

I will look into these issues and try to solve them and hopefully send a pull request.

Thanks again for the wonderful controls...

@bfeher
Copy link
Owner

bfeher commented Sep 4, 2014

Hi aksh1t,

Thank you for your kind words!
You are correct that for each "state change" there can be many tap-circles but only one box/check animation. This is by design. All BFPaper components allow for multiple tap-circle animations. However, given the nature of most of the other components, one tap-circle typically is tied to one state change (for example, BFPaperButton).
With BFPaperCheckbox, one state change is tied to the completion of one check or uncheck animation. I can see how this might be confusing or misleading and will consider dropping the many tap-circle support for just one single circle in the future if more users report similar feelings.

As for the states dropping out of sync, this is a potentially serious issue that I am looking into. However, I have not yet been able to replicate it. Even with an abnormally slow animation duration and rapidly tapping as fast as I can, I cannot get them to drop out of synch. I can report that there are expected interim animations that happen to try and compensate for such strange and unintended use of this control, but when the final animation finishes, everything is in order.

Could you provide some kind of evidence of this occurring so that I may see what is going on and how to fix it?

Thank you!

@aksh1t
Copy link
Author

aksh1t commented Sep 5, 2014

Well, I tried to replicate the states dropping out of sync issue and here's how it occurs:

  • bfPaperCheckbox_animationDurationConstant = 0.12f (that's the default)
  • Occurs only when changing the state using animateChange button.
  • The switch needs to be in the ON state for it to occur. When the switch is in OFF state, it stays in sync no matter how fast I click.
  • So, first set the state to ON by either clicking on the switch or using the animateChange button. Then, tap the animateChange twice in very quick succession. You might not be able to reproduce the bug every time, but on clicking very fast, I'd say about 1 in 5 times the states drop out of sync.

temp

My observations:

  • The button tap (animateChange) gets called every time I click no matter how fast, so that seems to be ok. Also, the delegate method gets called too every time without fail.
  • The problem could be that the second animation (OFF -> ON) changes the internal state of the switch and calls the delegate method, but fails to animate the switch to its proper state.

@bfeher
Copy link
Owner

bfeher commented Sep 5, 2014

Thank you, this is exactly what I was hoping for! I will work on a fix for this asap and let you know when I release the next version.

Thanks!

@bfeher
Copy link
Owner

bfeher commented Sep 11, 2014

I pushed version 1.2.3 which I believe fixed the bug. I tried a lot to break it with rapid tapping etc., but could not. Please test it if you would be so kind and report any bugs again :)

@aksh1t
Copy link
Author

aksh1t commented Sep 15, 2014

Hi again, bfeher! Sorry it took me so long to respond. I tested out the latest version of the project, and the bug remains. It does not occur when randomly tapping the switch very fast. It occurs under the following conditions:

  • To reproduce the bug, you'll need to keep the switch state on.
  • Then just do a quick double click on the animate change button. Keep double clicking until the bug appears.
  • Sometimes (1 in 5 times), the switch state and text will be out of sync.

I don't know how exactly this is occurring, but I suspect that the button click event firing during half-finished animations has got something to do with this.

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

2 participants