MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / onTouchStart_

Method onTouchStart_

source/MRViewer/MRTouchesController.cpp:11–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9{
10
11bool TouchesController::onTouchStart_( int id, int x, int y )
12{
13 if ( !multiInfo_.update( { id, Vector2f( float(x), float(y) ) } ) )
14 return true;
15 auto* viewer = &getViewerInstance();
16 auto numPressed = multiInfo_.getNumPressed();
17 auto finger = *multiInfo_.getFingerById( id );
18 if ( finger == MultiInfo::Finger::First && numPressed == 1 )
19 {
20 mouseMode_ = true;
21 viewer->emplaceEvent( "First touch imitates left mouse down", [x,y,viewer] ()
22 {
23 viewer->mouseMove( x, y ); // to setup position in MouseController
24 viewer->draw();
25 viewer->mouseDown( MouseButton::Left, 0 );
26 } );
27 return true;
28 }
29 if ( mouseMode_ )
30 {
31 mouseMode_ = false;
32 viewer->emplaceEvent( "First touch imitates left mouse up", [viewer] ()
33 {
34 viewer->mouseUp( MouseButton::Left, 0 );
35 } );
36 }
37 return true;
38}
39
40bool TouchesController::onTouchMove_( int id, int x, int y )
41{

Callers

nothing calls this directly

Calls 8

getNumPressedMethod · 0.80
getFingerByIdMethod · 0.80
emplaceEventMethod · 0.80
mouseMoveMethod · 0.80
mouseDownMethod · 0.80
mouseUpMethod · 0.80
updateMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected