CCLayerPanZoom extension and isometric tilemap

CCLayerPanZoom extension and isometric tilemap
0.0 0


I have problems with getting tile coordinates from touch location when I’m using CCLayerPanZoom extension. It works good without zoom (when scale is 1.0f), but if I zoom in or out it returns weird coordinates. Here is my tilePosFromLocation method:

@ CCPoint pos = ccpSub(location, _panZoomLayer~~>getPosition);
float halfMapWidth = tileMap~~>getMapSize().width * 0.5f;
float mapHeight = tileMap~~>getMapSize.height;
float tileWidth = tileMap~~>getTileSize().width;
float tileHeight = tileMap~~>getTileSize.height;
CCPoint tilePosDiv = CCPointMake;
float inverseTileY = mapHeight~~ tilePosDiv.y;
float posX = (int)(inverseTileY + tilePosDiv.x - halfMapWidth);
float posY = (int)(inverseTileY - tilePosDiv.x + halfMapWidth);
posX = MAX (0, posX);
posX = MIN (tileMap->getMapSize().width - 1, posX);
posY = MAX (0, posY);
posY = MIN (tileMap->getMapSize().height- 1, posY);
pos=ccp(posX, posY);
return pos;@

If I use directyl tileMap->setScale() instead of the extension, code above works if I multiply tile dimensions with current map scale amount. I would use it instead of CCLayerPanZoom but I can not make smooth and nice zooming without this extension. Any advices how to make it works?