Open GoogleCodeExporter opened 9 years ago
Not sure this is the actual cause, but the coordinates that are used in the
itemForTouch
function in Menu.java differ between the first and subsequent calls. Especially
the
coordinates in the line
CCPoint local = item.convertToNodeSpace(touchLocation.x, touchLocation.y);
are different and make no sense to me. The subsequent call to containsPoint
does never
return true after the first time.
Original comment by marcelo.emmerich@gmail.com
on 26 Feb 2010 at 12:15
[deleted comment]
silly workaround:
private MenuItem itemForTouch(MotionEvent event) {
CCPoint touchLocation =
Director.sharedDirector().convertCoordinate(event.getX(), event.getY());
float menuX = getPositionX();
float menuY = getPositionY();
for (int i = 0; i < children.size(); i++) {
MenuItem item = (MenuItem) children.get(i);
CCRect r = item.rect();
r.origin.x +=menuX;
r.origin.y +=menuY;
if (CCRect.containsPoint(r, touchLocation)) {
return item;
}
}
return null;
}
Original comment by webdev.p...@gmail.com
on 2 Apr 2010 at 3:13
The problem is the function:
private CCAffineTransform nodeToWorldTransform() {
CCAffineTransform t = nodeToParentTransform();
for (CocosNode p = parent; p != null; p = p.parent)
t.concatenate(p.nodeToParentTransform());
return t;
}
nodeToParentTransform returns a reference to the this.transform_ and the for
loop concatenate inside the variable. The second call concatenate again into
this.transform_ the nodeToParent transforms, so the final transform is fucked.
My solution:
CCAffineTransform t = new CCAffineTransform( nodeToParentTransform() );
Original comment by zhen.sy...@gmail.com
on 13 Aug 2010 at 3:30
Original issue reported on code.google.com by
marcelo.emmerich@gmail.com
on 26 Feb 2010 at 10:03