| 136 | } |
| 137 | |
| 138 | bool 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 | |
| 160 | bool DirectionWidget::onMouseMove_( int x, int y ) |
| 161 | { |
nothing calls this directly
no test coverage detected