Skip to content

Commit

Permalink
Engage left mouse button for restoring cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Jul 17, 2023
1 parent d9c5529 commit c3cb2ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/SectorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,8 @@ void SectorView::Update()
if (InputBindings.mapViewPitch->IsActive()) m_rotXMovingTo += 0.5f * moveSpeed * InputBindings.mapViewPitch->GetValue();

// to capture mouse when button was pressed and release when released
if (Pi::input->MouseButtonState(SDL_BUTTON_MIDDLE) != m_rotateWithMouseButton) {
const int mouseButton = (Pi::input->GetMouseMiddleButton() ? SDL_BUTTON_LEFT : SDL_BUTTON_MIDDLE);
if (Pi::input->MouseButtonState(mouseButton) != m_rotateWithMouseButton) {
m_rotateWithMouseButton = !m_rotateWithMouseButton;
Pi::input->SetCapturingMouse(m_rotateWithMouseButton);
}
Expand Down
3 changes: 2 additions & 1 deletion src/SystemView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,8 @@ void SystemView::Update()
}

// to capture mouse when button was pressed and release when released
if (Pi::input->MouseButtonState(SDL_BUTTON_MIDDLE) != m_rotateWithMouseButton) {
const int mouseButton = (Pi::input->GetMouseMiddleButton() ? SDL_BUTTON_LEFT : SDL_BUTTON_MIDDLE);
if (Pi::input->MouseButtonState(mouseButton) != m_rotateWithMouseButton) {
m_rotateWithMouseButton = !m_rotateWithMouseButton;
Pi::input->SetCapturingMouse(m_rotateWithMouseButton);
}
Expand Down
3 changes: 2 additions & 1 deletion src/ship/ShipViewController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ void ShipViewController::Update()
Pi::input->GetMouseMotion(mouseMotion);

// external camera mouselook
bool mouse_down = Pi::input->MouseButtonState(SDL_BUTTON_MIDDLE);
const int mouseButton = (Pi::input->GetMouseMiddleButton() ? SDL_BUTTON_LEFT : SDL_BUTTON_MIDDLE);
bool mouse_down = Pi::input->MouseButtonState(mouseButton);
if (mouse_down && !headtracker_input_priority) {
if (!m_mouseActive) {
m_mouseActive = true;
Expand Down

0 comments on commit c3cb2ee

Please sign in to comment.