Oridomi folds to back rather staying in front
besi opened this issue · comments
Whenever I completely unfold my div the outer bit then folds behind the inner part thus hiding behind it.
This can be reproduced like so:
- Use an accordion fold
- Completely unfold it
- Now rather than folding back to where "it came from" the fold goes behind.
It's also possible with the example in the website:
Is there a way to prevent this behavior?
In order to fold to the correct angle based on the movement of the mouse/finger, oriDomi has to know which side of zero the last operation was on. When you fold the element back to zero with your mouse/touch, the last operation is saved as being positive and subsequent mouse movements will fold with the angle on the positive side of zero.
In the current version this is decided here:
https://github.com/dmotz/oriDomi/blob/master/oridomi.coffee#L609
In the next version I'm adding a way to constrain the range of angles, so the user can only fold a certain amount with the mouse/touch. Until then, you could add a hack to get your desired outcome (not folding back when zero is hit) by changing the conditional here:
https://github.com/dmotz/oriDomi/blob/master/oridomi.coffee#L814
I am using the oridomi.coffee
now, rather than the minified version and I was able to fix my problem by chaniging
this
@lastOp = method: method, options: options, negative: angle < 0
to this
@lastOp = method: method, options: options, negative: true
Thanks for your help!