mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4857 Avoid crash in annotations picking whith distorted view
This commit is contained in:
@@ -1354,17 +1354,20 @@ void RiuViewerCommands::handleTextPicking( int winPosX, int winPosY, cvf::HitIte
|
|||||||
|
|
||||||
ref<Ray> ray = m_viewer->mainCamera()->rayFromWindowCoordinates( translatedMousePosX, translatedMousePosY );
|
ref<Ray> ray = m_viewer->mainCamera()->rayFromWindowCoordinates( translatedMousePosX, translatedMousePosY );
|
||||||
|
|
||||||
for ( size_t pIdx = 0; pIdx < partCollection.size(); ++pIdx )
|
if ( ray.notNull() )
|
||||||
{
|
{
|
||||||
DrawableText* textDrawable = dynamic_cast<DrawableText*>( partCollection[pIdx]->drawable() );
|
for ( size_t pIdx = 0; pIdx < partCollection.size(); ++pIdx )
|
||||||
if ( textDrawable )
|
|
||||||
{
|
{
|
||||||
cvf::Vec3d ppoint;
|
DrawableText* textDrawable = dynamic_cast<DrawableText*>(partCollection[pIdx]->drawable());
|
||||||
if ( textDrawable->rayIntersect( *ray, *( m_viewer->mainCamera() ), &ppoint ) )
|
if ( textDrawable )
|
||||||
{
|
{
|
||||||
cvf::ref<HitItem> hitItem = new HitItem( 0, ppoint );
|
cvf::Vec3d ppoint;
|
||||||
hitItem->setPart( partCollection[pIdx].p() );
|
if ( textDrawable->rayIntersect(*ray, *(m_viewer->mainCamera()), &ppoint) )
|
||||||
hitItems->add( hitItem.p() );
|
{
|
||||||
|
cvf::ref<HitItem> hitItem = new HitItem(0, ppoint);
|
||||||
|
hitItem->setPart(partCollection[pIdx].p());
|
||||||
|
hitItems->add(hitItem.p());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user