25 #include "WOnscreenSelectionHandler.h"
27 static const unsigned int SHIFT_DOWN = 65505;
28 static const unsigned int SHIFT_UP = 16777248;
32 m_mousePressed( false ),
33 m_shiftPressed( false )
39 float x = ( ea.getXnormalized() + 1.0 ) / 2.0;
40 float y = ( ea.getYnormalized() + 1.0 ) / 2.0;
42 if( ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN )
44 if( ea.getKey() == SHIFT_DOWN )
49 if( ea.getEventType() == osgGA::GUIEventAdapter::KEYUP )
51 if( ea.getKey() == SHIFT_UP )
60 if( ea.getEventType() == osgGA::GUIEventAdapter::DRAG )
67 if( ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON || ea.getButton() == osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON )
70 if( ea.getEventType() == osgGA::GUIEventAdapter::PUSH )
75 else if( ea.getEventType() == osgGA::GUIEventAdapter::RELEASE )
83 if(
m_mousePressed && ea.getEventType() == osgGA::GUIEventAdapter::DRAG )
bool m_shiftPressed
Whether shift is pressed or not.
bool m_mousePressed
Whether the mouse is pressed or not.
WOnscreenSelection * m_manager
The WOnscreenSelection this belongs to.
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
Handles the incoming events.
WOnscreenSelectionHandler(WOnscreenSelection *manager)
Construct a new WDrawHandler object.
Manages different types of selection.
void clear()
Clears the current selection.
void start(float x, float y)
Starts the selection.
void setClickType(bool clickType)
Sets the click type.
void move(float x, float y)
Handles mouse move while selecting.
void end(float x, float y)
Ends the selection.