Skip to content

Commit

Permalink
Added support for simulating right/middle clicks with shift/control
Browse files Browse the repository at this point in the history
This improves usability with input devices lacking a right or middle
mouse button.
  • Loading branch information
Marukyu committed Oct 14, 2016
1 parent 57e9435 commit fa3275c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Client/Editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,12 @@ void Editor::onProcess(const gui2::WidgetEvents& events)
{
sf::Vector2f mousePos = convertMousePosition(events.mousePosition);

bool leftMouseDown = isMouseDown(sf::Mouse::Left);
bool rightMouseDown = isMouseDown(sf::Mouse::Right);
bool middleMouseDown = isMouseDown(sf::Mouse::Middle);
bool shiftLeftMouseDown = isMouseDown(sf::Mouse::Left) && events.isShiftPressed();
bool ctrlLeftMouseDown = isMouseDown(sf::Mouse::Left) && events.isControlPressed();

bool leftMouseDown = isMouseDown(sf::Mouse::Left) && !shiftLeftMouseDown && !ctrlLeftMouseDown;
bool rightMouseDown = isMouseDown(sf::Mouse::Right) || shiftLeftMouseDown;
bool middleMouseDown = isMouseDown(sf::Mouse::Middle) || ctrlLeftMouseDown;

if (middleMouseDown)
{
Expand Down

0 comments on commit fa3275c

Please sign in to comment.