unbinding mouse buttons

I'm trying to unbind the left-hand mouse button, but can't seem to get it to un-function! From my AIS_ViewController descendant class...

    myMouseGestureMap.Clear();

    myMouseGestureMap.UnBind(Aspect_VKeyMouse_LeftButton);
    myMouseGestureMap.UnBind(Aspect_VKeyMouse_RightButton);
    myMouseGestureMap.Bind(Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_RotateOrbit);

running up the code still has the left button performing rotation (looks like AIS_MouseGesture_RotateView)

Also tried...

    myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_NONE);

but doesn't make any difference.

This is fed into the mouse handler:

void occView::mousePressEvent(QMouseEvent* event)
{
    Graphic3d_Vec2i point;
    point.SetValues(event->position().x(), event->position().y());
    const Aspect_VKeyFlags flags = qtMouseModifiers2VKeys (event->modifiers());
    if (!_view.IsNull() && UpdateMouseButtons(point, qtMouseButtons2VKeys (event->buttons()), flags, false))
        updateView();

    _clickPos = point;
}

Can someone check my sanity here, or does this look like a bug?

gkv311 n's picture

There is another gesture map myMouseGestureMapDrag defining mouse buttons combination for dragging objects. AIS_ViewController constructor defines it to left mouse button:

myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);

As both dragging and rotation initiated by the same mouse gesture, these two conflict with each other and AIS_ViewController performs special treatment to try handling dragging first and then falling back to rotation if dragging event has been rejected by the object. Apparently, there is a bug in this logic, so that rotation is initiated by dragging myMouseGestureMapDrag, even when rotation gesture hasn't been assigned to the same mouse button in myMouseGestureMap.

So, to clean up all mouse gestures, clean up both maps:

myMouseGestureMap.Clear();
myMouseGestureMapDrag.Clear();

Note, that if you just want disabling view rotation by any gesture (temporarily), AIS_ViewController::SetAllowRotation(false) would be more convenient (and it doesn't trigger the same bug with the dragging gesture).

Mat M's picture

Sorted, thanks - disabling the second one did the trick