[SOLVED] multitouch(pinch and zoom) problem

[SOLVED] multitouch(pinch and zoom) problem
0.0 0


Im implementing a pinch and zoom functionality, everything is working until you stopped your 2nd finger from moving, this made my ccTouchesMoved to only receive 1 touch event(the other finger which is moving). Is this behavior normal? because this triggers my dragging functionality. I already tested cocos2d for ios and all touch events are handled correctly even if you do not move your finger. any help would be appreciated, thanks!


nevermind, i already found a solution :smiley:


Hi kyo ryu
It would be great if you could share your code here. I wanted to implement the same functionality but facing too many problems. THanks


i had save problem
see here:


Is this a BUG or not? I have exactly the same problem. I’m implementing pinch zoom with two fingers and drag with one finger. When I’m moving two fingers then ccTouchesMoved receives 2 touches and it recognize pinch but when I keep my first finger in the same position and then only move the second finger then ccTouchesMoved receives only 1 touch and recognize a drag but it should be pinch because i’m still holding two fingers on the touchscreen. I don’t see any solution in link posted by masu haji. It only shows how to enable multitouch but I have it working and this is not my problem. I think this is a nasty bug and ccTouchesMoved should receive 2 touches when I hold 2 fingers on my screen even if I’m moving only one finger. Kyo ryu said that cocos2d for ios handles this correctly so this is probably a bug and it still appears in v2.0.4. Kyo ryu how did you solve this problem? Could anyone help?


You can find links to codes of cocos2d-x CCLayerPanZoom in this thread: http://www.cocos2d-x.org/boards/6/topics/5430


Thanks Victor. I quickly looked at the code of CCLayerPanZoom and I see how it bypass this ccTouchesMoved limitations by keeping information about all touches in class member variable. I can’t find anywhere any documentation about ccTouchesMoved so I don’t know if authors wanted to return information about all active touches in it but I think that it would be better if it did automatically sent information about all current touches in ccTouchesMoved(CCSet pTouches, CCEventpEvent) especialy if it works that way in the original cocos2d for iphone as kyo ryu said. I noticed that currently this probably works differently on different platforms. At least on windows it looks like WM_TOUCH event in CCEGLView.cpp is always calling ccTouchesMoved separately for each touch in for loop even if it has information about let say 4 touches (which as I can see is differnt to ios implementation).