MCPcopy Create free account
hub / github.com/cinder/Cinder / mouseDown

Method mouseDown

test/WindowToWorldTest/src/WindowToWorldTestApp.cpp:130–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void WindowToWorldTestApp::mouseDown( MouseEvent event )
131{
132 // Check if mouse is inside rectangle, by converting the mouse coordinates
133 // to world space and then to object space. [ Excercising gl::windowToWorldCoord() ].
134 vec3 world = gl::windowToWorldCoord( event.getPos() );
135 vec4 object = glm::inverse( mRectangle.matrix() ) * vec4( world, 1 );
136
137 // Now we can simply use Area::contains() to find out if the mouse is inside.
138 mIsClicked = mRectangle.area.contains( vec2( object ) );
139 if( mIsClicked ) {
140 mMouseInitial = event.getPos();
141 mRectangleInitial = mRectangle;
142 }
143}
144
145void WindowToWorldTestApp::mouseDrag( MouseEvent event )
146{

Callers

nothing calls this directly

Calls 5

windowToWorldCoordFunction · 0.85
inverseFunction · 0.85
matrixMethod · 0.80
getPosMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected