Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::TouchEvent Class Reference

Touch event contains all touch points associated with the event. Touch events are usually generated by touch screens or touch pads, see TouchDevice. More...

#include <inviwo/core/interaction/events/touchevent.h>

+ Inheritance diagram for inviwo::TouchEvent:

Public Member Functions

double averageDepth () const
 Average depth of touch points, TouchPoint::depth() Defined in [-1 1], where -1 is the near plane and 1 is the far plane.
 
uvec2 canvasSize () const
 
dvec3 centerNDC () const
 Average of touch points in normalized device coordinates, TouchPoint::ndc() Defined in (-1,1) in a left handed coordinate system.
 
dvec2 centerPoint () const
 Computes average position. Returns dvec2(0) if no touch points exist.
 
dvec2 centerPointNormalized () const
 Computes average normalized position. Returns dvec2(0) if no touch points exist.
 
virtual TouchEventclone () const override
 
std::vector< const TouchPoint * > findClosestTwoTouchPoints () const
 Retrieve pointers to the two closest touch points.
 
const TouchDevicegetDevice () const
 Return TouchDevice that generated the event.
 
virtual uint64_t hash () const override
 
bool hasTouchPoints () const
 
dvec2 prevCenterPointNormalized () const
 Computes previous average normalized position. Returns dvec2(0) if no touch points exist.
 
virtual void print (fmt::memory_buffer &buff) const override
 
void setTouchPoints (std::vector< TouchPoint > val)
 
 TouchEvent (const std::vector< TouchPoint > &touchPoints, const TouchDevice *source, KeyModifiers modifiers)
 
std::vector< TouchPoint > & touchPoints ()
 
const std::vector< TouchPoint > & touchPoints () const
 
- Public Member Functions inherited from inviwo::InteractionEvent
const ContextMenuCallback & getContexMenuCallback () const
 
const ToolTipCallback & getToolTipCallback () const
 
 InteractionEvent (const InteractionEvent &rhs)=default
 
 InteractionEvent (KeyModifiers modifiers=KeyModifiers(flags::empty))
 
KeyModifiers modifiers () const
 
InteractionEventoperator= (const InteractionEvent &that)=default
 
void setContextMenuCallback (ContextMenuCallback callback)
 
void setModifiers (KeyModifiers modifiers)
 
void setToolTip (std::string_view tooltip) const
 
void setToolTipCallback (ToolTipCallback callback)
 
void showContextMenu (std::span< ContextMenuEntry > entries, ContextMenuCategories categories=ContextMenuCategory::Callback)
 
- Public Member Functions inherited from inviwo::Event
template<typename EventType >
EventType * getAs ()
 
template<typename EventType >
const EventType * getAs () const
 
const std::vector< Processor * > & getVisitedProcessors () const
 
bool hasBeenUsed () const
 
bool hasVisitedProcessor (Processor *) const
 
bool markAsUnused ()
 
bool markAsUsed ()
 
void markAsVisited (const Event &)
 
bool markAsVisited (Processor *)
 
bool setUsed (bool isUsed)
 
virtual bool shouldPropagateTo (Inport *inport, Processor *processor, Outport *source)
 

Static Public Member Functions

static constexpr uint64_t chash ()
 
static PickingState getPickingState (const std::vector< TouchPoint > &points)
 Get PickingState by analyzing all touch points.
 

Additional Inherited Members

- Public Types inherited from inviwo::InteractionEvent
using ContextMenuCallback
 
using ToolTipCallback = std::function<void(std::string_view)>
 
- Protected Member Functions inherited from inviwo::Event
 Event (const Event &rhs)=default
 
Eventoperator= (const Event &that)=default
 
- Protected Attributes inherited from inviwo::InteractionEvent
ContextMenuCallback contextMenuCallback_
 
KeyModifiers modifiers_
 
ToolTipCallback tooltip_
 

Detailed Description

Touch event contains all touch points associated with the event. Touch events are usually generated by touch screens or touch pads, see TouchDevice.

See also
TouchPoint

Member Function Documentation

◆ averageDepth()

double inviwo::TouchEvent::averageDepth ( ) const

Average depth of touch points, TouchPoint::depth() Defined in [-1 1], where -1 is the near plane and 1 is the far plane.

Returns
sum(touch points.depth()) / nPoints, or 1 if no touch points exist.

◆ centerNDC()

dvec3 inviwo::TouchEvent::centerNDC ( ) const

Average of touch points in normalized device coordinates, TouchPoint::ndc() Defined in (-1,1) in a left handed coordinate system.

Returns
sum(touch points.ndc()) / nPoints, or dvec3(0) if no touch points exist.

◆ centerPoint()

dvec2 inviwo::TouchEvent::centerPoint ( ) const

Computes average position. Returns dvec2(0) if no touch points exist.

Returns
dvec2 sum(touch points) / nPoints

◆ centerPointNormalized()

dvec2 inviwo::TouchEvent::centerPointNormalized ( ) const

Computes average normalized position. Returns dvec2(0) if no touch points exist.

Returns
dvec2 sum(touch points) / nPoints

◆ clone()

virtual TouchEvent * inviwo::TouchEvent::clone ( ) const
overridevirtual

◆ findClosestTwoTouchPoints()

std::vector< const TouchPoint * > inviwo::TouchEvent::findClosestTwoTouchPoints ( ) const

Retrieve pointers to the two closest touch points.

Returns
std::vector<const TouchPoint*>, pointers to the two closest touch points vector can have less then two elements, which indicate that not enough points exist

◆ getPickingState()

static PickingState inviwo::TouchEvent::getPickingState ( const std::vector< TouchPoint > & points)
static

Get PickingState by analyzing all touch points.

Returns
PickingState::Started or PickingState::Finished when all touch points started or finished. Return PickingState::Updated when any of the touch points updated or some started and some finished.

◆ hash()

virtual uint64_t inviwo::TouchEvent::hash ( ) const
overridevirtual

Implements inviwo::Event.

◆ prevCenterPointNormalized()

dvec2 inviwo::TouchEvent::prevCenterPointNormalized ( ) const

Computes previous average normalized position. Returns dvec2(0) if no touch points exist.

Returns
dvec2 sum(touch points) / nPoints

◆ print()

virtual void inviwo::TouchEvent::print ( fmt::memory_buffer & buff) const
overridevirtual

Implements inviwo::Event.


The documentation for this class was generated from the following file: