Improve 2 touches
Hi growingdever, Thanks for your code, it's so cool. I think cocoa should add it in next version of Cocos2dx.
But it had a small issue: When touch 2 points NOT at the same time, the layer will be jerked.
I read your code and know the reason is:
In ccTouchesMoved, prevPosTouch2 will not right if touch2 LATER than touch1.
The solution is:
- Add (after line 166 in PanZoomLayer.cpp):
if (prevPosTouch2.x < 1 || prevPosTouch2.y < 1) { return; } - Remove line
if( _isHolding ) return;inccTouchesEndedThen it works fine.
Please reply me if this modify have many negatively affected.
Hi @VAdaihiep . I'm really thank you for your advice. I should fix code right now, but I'm very busy now because there are many exam on this week. (yes, I'm student.) I'll fix that as soon as possible. Thank you again!
OK, have a good test!
Please Test in iOS Platform. I had test in iOS it not work. But in Android work ok. Please fix this issue. Thank so much!
@thientinh I already tested on iOS, it works. Please check this video https://www.youtube.com/watch?v=bgbE1gJp5js
With:
pzLayer->setScale( 1.0 ); pzLayer->SetMaxScale(4); pzLayer->SetMinScale(0.5);
Ok, thanks. It's work ok when I reset macbook. May be problem with my macbook.