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

Method onMouseDown_

source/MRViewer/MRDirectionWidget.cpp:138–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138bool DirectionWidget::onMouseDown_( Viewer::MouseButton button, int mod )
139{
140 if ( button != Viewer::MouseButton::Left || mod != 0 || blockedMouse_ )
141 return false;
142
143 auto viewer = Viewer::instance();
144 viewer->select_hovered_viewport();
145 const auto [obj, pof] = viewer->viewport().pick_render_object();
146 if ( obj != directionObj_ )
147 return false;
148
149 mousePressed_ = true;
150 // Get picked point and corresponding arrow axis point
151 Vector3f worldStartPoint = directionObj_->worldXf()( pof.point );
152 Vector3f projectedStartPoint = Line3f( getBase(), getDirection() ).project( worldStartPoint );
153 // Set offset so that worldStartPoint corresponds to projectedStartPoint
154 draggingViewportStartPoint_ = viewer->viewport().projectToViewportSpace( worldStartPoint );
155 draggingViewportStartPointOffset_ = viewer->viewport().projectToViewportSpace( projectedStartPoint ) - draggingViewportStartPoint_;
156
157 return true;
158}
159
160bool DirectionWidget::onMouseMove_( int x, int y )
161{

Callers

nothing calls this directly

Calls 6

instanceFunction · 0.85
pick_render_objectMethod · 0.80
worldXfMethod · 0.80
projectMethod · 0.45

Tested by

no test coverage detected