Commit 94f6d769 authored by Philip Trettner's avatar Philip Trettner

Added double [LMB] center-to-pos

parent 65e6fd1f
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment