Touch issue v3.0

Hi,

I’m having a touch event discrepancy. The API is giving me a Y coordinate as if 0,0 was the TOP LEFT corner instead of BOTTOM LEFT.

auto listener = EventListenerTouchOneByOne::create();
listener->setSwallowTouches(true);
listener->onTouchBegan = [=](Touch* touch, Event* event) {
    Node *n = this->getChildByTag(1);
    Point loc = touch->getLocationInView();
    CCLOG("X,Y: %f,%f",loc.x + origin.x, loc.y + origin.y);
    return true;
};
this->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);

The CCLOG output will show higher Y numbers as I get close to the bottom (LANDSCAPE) of the scene, and smaller numbers as the touch gets closer to the top edge of the screen in landscape mode.

Am I missing some configuration?

More on the same issue:

@hcabral About this issue, maybe you can try

Point loc = touch->getLocation();

instead of

Point loc = touch->getLocationInView();

to see if this solves your problem.

@zyy8687 the problem is iOS. In a Mac, for example, I can do:

Point location = this->convertToNodeSpace(touch->getLocation());

And it will give me the correct, relative coordinates to my design size. In iOS, as I found out, the Y coordinate is screwed. The getLocationInView() method is a workaround for my problem, since I wasn’t able to find a better solution so far.