cocos2d-x-panzoomlayer icon indicating copy to clipboard operation
cocos2d-x-panzoomlayer copied to clipboard

Improve 2 touches

Open VAdaihiep opened this issue 11 years ago • 5 comments

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:

  1. Add (after line 166 in PanZoomLayer.cpp): if (prevPosTouch2.x < 1 || prevPosTouch2.y < 1) { return; }
  2. Remove line if( _isHolding ) return; in ccTouchesEnded Then it works fine.

Please reply me if this modify have many negatively affected.

VAdaihiep avatar Jun 16 '14 11:06 VAdaihiep

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!

toughrogrammer avatar Jun 16 '14 14:06 toughrogrammer

OK, have a good test!

VAdaihiep avatar Jun 18 '14 02:06 VAdaihiep

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 avatar Jun 18 '14 09:06 thientinh

@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);

VAdaihiep avatar Jun 18 '14 12:06 VAdaihiep

Ok, thanks. It's work ok when I reset macbook. May be problem with my macbook.

thientinh avatar Jun 20 '14 06:06 thientinh