1
0
Fork 0

Fix for RMB/MMB interaction with picking

When RMB drag-to-look is active, ignore all other mouse downs, which
might otherwise trigger picks to start.

Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2108/
This commit is contained in:
James Turner 2020-10-29 23:20:48 +00:00
parent 6512783996
commit f4298d676f
2 changed files with 24 additions and 4 deletions

View file

@ -551,6 +551,12 @@ void FGMouseInput::doMouseClick (int b, int updown, int x, int y, bool mainWindo
return;
}
if (isRightDragLookActive() && (updown == MOUSE_BUTTON_DOWN)) {
// when spring-loaded mode is active, don't do scene selection for picks
// https://sourceforge.net/p/flightgear/codetickets/2108/
return;
}
// Pass on to PUI and the panel if
// requested, and return if one of
// them consumes the event.
@ -619,12 +625,10 @@ void FGMouseInput::processMotion(int x, int y, const osgGA::GUIEventAdapter* ea)
mouse &m = d->mice[0];
int modeIndex = m.current_mode;
// are we in spring-loaded look mode?
if (!d->rightClickModeCycle && m.nModes > 3) {
if (m.mouse_button_nodes[2]->getBoolValue()) {
if (isRightDragLookActive()) {
// right mouse is down, force look mode
modeIndex = 3;
}
}
if (modeIndex == 0) {
@ -725,6 +729,20 @@ bool FGMouseInput::isActiveModePassThrough() const
return m.modes[mode].pass_through;
}
bool FGMouseInput::isRightDragLookActive() const
{
if (!d) {
return false;
}
const auto& m = d->mice[0];
if (!d->rightClickModeCycle && m.nModes > 3) {
return m.mouse_button_nodes[2]->getBoolValue();
}
return false;
}
// Register the subsystem.
SGSubsystemMgr::Registrant<FGMouseInput> registrantFGMouseInput;

View file

@ -72,6 +72,8 @@ public:
private:
void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea);
bool isRightDragLookActive() const;
class FGMouseInputPrivate;
std::unique_ptr<FGMouseInputPrivate> d;
};