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

Method pick_

source/MRViewer/MRViewportCornerController.cpp:881–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

879}
880
881CornerControllerObject::PickedIds CornerControllerObject::pick_( const Vector2f& mousePos ) const
882{
883 if ( !rootObj_ )
884 return {};
885
886 auto hId = getViewerInstance().getHoveredViewportId();
887 if ( !hId )
888 return {};
889
890 if ( !rootObj_->isVisible( hId ) )
891 return {};
892
893 const auto& vp = getViewerInstance().viewport( hId );
894 auto screenPos = to2dim( getViewerInstance().viewportToScreen( to3dim( vp.getAxesPosition() ), hId ) );
895
896 if ( distanceSq( mousePos, screenPos ) > sqr( vp.getAxesSize() * 2.0f ) )
897 return {};
898
899 const auto& children = rootObj_->children();
900 auto staticRenderParams = vp.getBaseRenderParamsOrthoFixedPos();
901 auto [obj, pick] = vp.pickRenderObject( { {
902 static_cast< VisualObject* >( children[0].get() ),
903 static_cast< VisualObject* >( children[1].get() ),
904 static_cast< VisualObject* >( children[2].get() )
905 } }, { .baseRenderParams = &staticRenderParams } );
906 if ( !obj )
907 return {};
908
909 if ( obj == children[0] )
910 return { hId, getCornerControllerRegionByFace( pick.face ) };
911 else if ( obj == children[1] )
912 return { hId, RegionId( int( SideRegions::CCWArrow ) ) };
913 else
914 return { hId, RegionId( int( SideRegions::CWArrow ) ) };
915}
916
917void CornerControllerObject::hover_( const Vector2f& mousePos )
918{

Callers

nothing calls this directly

Calls 12

to2dimFunction · 0.85
to3dimFunction · 0.85
getHoveredViewportIdMethod · 0.80
isVisibleMethod · 0.80
viewportToScreenMethod · 0.80
getAxesSizeMethod · 0.80
pickRenderObjectMethod · 0.80
distanceSqFunction · 0.50
sqrFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected