Restored previous behavior when moving node in scene

Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
This commit is contained in:
Arthur Brainville 2018-03-02 16:21:28 +01:00
parent df9003ea08
commit e832baf229
No known key found for this signature in database
GPG Key ID: BC05C4812A06BCF3

View File

@ -340,7 +340,7 @@ void mouseMoveCallback(float x, float y) {
if (gMouseLeftDown) {
if (ImGuizmo::IsOver() || ImGuizmo::IsUsing()) {
gSceneDirty = true;
RequestRender();
// RequestRender();
} else {
float w = static_cast<float>(gRenderConfig.width);
float h = static_cast<float>(gRenderConfig.height);
@ -360,8 +360,6 @@ void mouseMoveCallback(float x, float y) {
} else {
// Adjust y.
std::cout << "trackball in mouseMoveCallback\nmouseDown "
<< gMouseLeftDown << '\n';
trackball(gPrevQuat, (2.f * gMousePosX - w) / (float)w,
(h - 2.f * (gMousePosY - y_offset)) / (float)h,
(2.f * x - w) / (float)w,
@ -386,24 +384,24 @@ void mouseButtonCallback(int button, int state, float x, float y) {
ImGuiIO &io = ImGui::GetIO();
if (io.WantCaptureMouse || io.WantCaptureKeyboard) {
std::cout << "muse or keyboard used by imgui\n";
return;
}
// left button
if (button == 0) {
if (state) {
gMouseLeftDown = true;
if (ImGuizmo::IsOver() || ImGuizmo::IsUsing()) {
} else {
trackball(gPrevQuat, 0.0f, 0.0f, 0.0f, 0.0f);
}
} else {
if (ImGuizmo::IsOver() || ImGuizmo::IsUsing()) {
if (button == 0 && !state) {
if (ImGuizmo::IsUsing()) {
gSceneDirty = true;
RequestRender();
}
}
} else {
// left button
if (button == 0) {
if (state) {
gMouseLeftDown = true;
if (ImGuizmo::IsOver() || ImGuizmo::IsUsing()) {
} else {
trackball(gPrevQuat, 0.0f, 0.0f, 0.0f, 0.0f);
}
} else {
}
}
}
}