Changeset 6013 for geovis


Ignore:
Timestamp:
Feb 15, 2016 11:38:15 AM (8 years ago)
Author:
ldelgass
Message:

Don't initiate a pick if the mouse was dragged more than 2 pixels. Prevents a
dragging pan from causing a selection.

Location:
geovis/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Picker.cpp

    r6005 r6013  
    238238bool SelectCallback::accept(const osgGA::GUIEventAdapter& ea, const osgGA::GUIActionAdapter& aa)
    239239{
    240     _renderer->mapMouseCoords(ea.getX(), ea.getY(), _pickPoint, false);
    241     // Pick on click
    242     return ea.getEventType() == ea.RELEASE;
     240    if (ea.getEventType() == ea.PUSH) {
     241        _x = ea.getX();
     242        _y = ea.getY();
     243        return false;
     244    } else if (ea.getEventType() == ea.RELEASE) {
     245        // Don't pick if mouse was dragged more than 2 pixels
     246        if (fabsf(ea.getX()-_x) > 2 || fabsf(ea.getY()-_y) > 2) {
     247            return false;
     248        } else {
     249            _renderer->mapMouseCoords(ea.getX(), ea.getY(), _pickPoint, false);
     250            return true;
     251        }
     252    }
     253    return false;
    243254}
    244255
  • geovis/trunk/Picker.h

    r6002 r6013  
    3737private:
    3838    Renderer *_renderer;
     39    float _x, _y;
    3940    osgEarth::GeoPoint _pickPoint;
    4041};
Note: See TracChangeset for help on using the changeset viewer.