mirror of https://github.com/axmolengine/axmol.git
Update CCGLViewImpl.cpp
fix GLViewImpl::onGLFWMouseScrollCallback forger transform cursor position.
This commit is contained in:
parent
88a80495df
commit
8f11dd7f8b
|
@ -650,8 +650,10 @@ void GLViewImpl::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double
|
|||
{
|
||||
EventMouse event(EventMouse::MouseEventType::MOUSE_SCROLL);
|
||||
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
|
||||
float cursorX = (_mouseX - _viewPortRect.origin.x) / _scaleX;
|
||||
float cursorY = (_viewPortRect.origin.y + _viewPortRect.size.height - _mouseY) / _scaleY;
|
||||
event.setScrollData((float)x, -(float)y);
|
||||
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
|
||||
event.setCursorPosition(cursorX, cursorY);
|
||||
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue