Skip to content
Snippets Groups Projects
Commit 94f6d769 authored by Philip Trettner's avatar Philip Trettner
Browse files

Added double [LMB] center-to-pos

parent 65e6fd1f
No related branches found
No related tags found
No related merge requests found
......@@ -207,8 +207,21 @@ bool GlfwApp::onMouseButton(double x, double y, int button, int action, int mods
if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS)
mMouseRight = true;
if (button == GLFW_MOUSE_BUTTON_MIDDLE && action == GLFW_PRESS && clickCount > 1)
onResetView(); // reset view
// Double [MMB] (no mods) -> reset view
if (button == GLFW_MOUSE_BUTTON_MIDDLE && action == GLFW_PRESS && clickCount > 1 && mods == 0)
onResetView();
// Double [LMB] (no mods) -> center on pos
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS && clickCount > 1 && mods == 0)
{
glm::vec3 pos;
float depth;
if (mUseDefaultRendering && mUseDefaultCameraHandling && mPipeline->queryPosition3D(x, y, &pos, &depth))
{
mCamera->setPosition(pos - mCamera->getForwardDirection() * mCamera->getLookAtDistance());
mCamera->setTarget(pos, {0, 1, 0});
}
}
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment