From Stephan Huber, "attached you'll find a proposal for handling multi-touch-events with
osgGA. My approach is to bundle all touchpoints into one custom data structure which is attached to an GUIEventAdapter. The current approach simulates a moving mouse for the first touch-point, so basic manipulators do work, sort of. I created a MultiTouchTrackballManipulator-class, one touch-point does rotate the view, two touch-points pan and zoom the view as known from the iphone or other similar multi-touch-devices. A double-tap (similar to a double-click) resets the manipulator to its home-position. The multi-touch-trackball-implementation is not the best, see it as a first starting point. (there's a demo-video at http://vimeo.com/15017377 )"
This commit is contained in:
@@ -42,7 +42,8 @@ GUIEventAdapter::GUIEventAdapter():
|
||||
_modKeyMask(0),
|
||||
_mouseYOrientation(Y_INCREASING_DOWNWARDS),
|
||||
_scrolling(),
|
||||
_tabletPen()
|
||||
_tabletPen(),
|
||||
_touchData(NULL)
|
||||
{}
|
||||
|
||||
GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs,const osg::CopyOp& copyop):
|
||||
@@ -67,7 +68,8 @@ GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs,const osg::CopyOp& c
|
||||
_modKeyMask(rhs._modKeyMask),
|
||||
_mouseYOrientation(rhs._mouseYOrientation),
|
||||
_scrolling(rhs._scrolling),
|
||||
_tabletPen(rhs._tabletPen)
|
||||
_tabletPen(rhs._tabletPen),
|
||||
_touchData(rhs._touchData)
|
||||
{}
|
||||
|
||||
GUIEventAdapter::~GUIEventAdapter()
|
||||
@@ -107,3 +109,14 @@ const osg::Matrix GUIEventAdapter::getPenOrientation() const
|
||||
|
||||
return ( zrot * yrot * xrot );
|
||||
}
|
||||
|
||||
void GUIEventAdapter::addTouchPoint(unsigned int id, TouchPhase phase, float x, float y, unsigned int tapCount)
|
||||
{
|
||||
if (!_touchData.valid()) {
|
||||
_touchData = new TouchData();
|
||||
setX(x);
|
||||
setY(y);
|
||||
}
|
||||
|
||||
_touchData->addTouchPoint(id, phase, x, y, tapCount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user