mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
ImGuizmo System OpenGL
This commit is contained in:
@@ -25,6 +25,14 @@ editormouse_input::position( double Horizontal, double Vertical ) {
|
||||
m_cursorposition.y = Vertical;
|
||||
return;
|
||||
}
|
||||
if( true == m_pickmodepanning_resync ) {
|
||||
// panning just started (cursor may have been grabbed/hidden); reset the reference so the
|
||||
// first frame doesn't produce a large, jarring camera jump
|
||||
m_cursorposition.x = Horizontal;
|
||||
m_cursorposition.y = Vertical;
|
||||
m_pickmodepanning_resync = false;
|
||||
return;
|
||||
}
|
||||
glm::dvec2 cursorposition { Horizontal, Vertical };
|
||||
auto const viewoffset = cursorposition - m_cursorposition;
|
||||
m_relay.post(
|
||||
@@ -47,7 +55,12 @@ editormouse_input::button( int const Button, int const Action ) {
|
||||
|
||||
// right button controls panning
|
||||
if( Button == GLFW_MOUSE_BUTTON_RIGHT ) {
|
||||
m_pickmodepanning = ( Action == GLFW_PRESS );
|
||||
bool const panning = ( Action == GLFW_PRESS );
|
||||
// when panning starts, request a one-frame resync so toggling the cursor grab doesn't jerk the view
|
||||
if( panning && ( false == m_pickmodepanning ) ) {
|
||||
m_pickmodepanning_resync = true;
|
||||
}
|
||||
m_pickmodepanning = panning;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ private:
|
||||
// members
|
||||
command_relay m_relay;
|
||||
bool m_pickmodepanning { false }; // indicates mouse is in view panning mode
|
||||
bool m_pickmodepanning_resync { false }; // skip the first delta after panning starts (avoids a jump when the cursor is grabbed/hidden)
|
||||
glm::dvec2 m_cursorposition { 0.0 }; // stored last cursor position, used for panning
|
||||
std::array<int, GLFW_MOUSE_BUTTON_LAST> m_buttons { GLFW_RELEASE };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user