mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#911 Fixed picking on category legend
This commit is contained in:
parent
da38067f66
commit
f03e2431f9
@ -720,6 +720,26 @@ caf::PdmObject* RiuViewer::lastPickedObject() const
|
||||
return m_viewerCommands->currentPickedObject();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::OverlayItem* RiuViewer::pickFixedPositionedLegend(int winPosX, int winPosY)
|
||||
{
|
||||
int translatedMousePosX = winPosX;
|
||||
int translatedMousePosY = height() - winPosY;
|
||||
|
||||
for (auto overlayItem : m_visibleLegends)
|
||||
{
|
||||
if (overlayItem->layoutScheme() == cvf::OverlayItem::FIXED_POSITION &&
|
||||
overlayItem->pick(translatedMousePosX, translatedMousePosY, overlayItem->fixedPosition(), overlayItem->sizeHint()))
|
||||
{
|
||||
return overlayItem.p();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -92,6 +92,8 @@ public:
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
caf::PdmObject* lastPickedObject() const;
|
||||
|
||||
cvf::OverlayItem* pickFixedPositionedLegend(int winPosX, int winPosY);
|
||||
|
||||
public slots:
|
||||
virtual void slotSetCurrentFrame(int frameIndex);
|
||||
virtual void slotEndAnimation();
|
||||
|
@ -804,6 +804,11 @@ void RiuViewerCommands::ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size
|
||||
bool RiuViewerCommands::handleOverlayItemPicking(int winPosX, int winPosY)
|
||||
{
|
||||
cvf::OverlayItem* pickedOverlayItem = m_viewer->overlayItem(winPosX, winPosY);
|
||||
if (!pickedOverlayItem)
|
||||
{
|
||||
pickedOverlayItem = m_viewer->pickFixedPositionedLegend(winPosX, winPosY);
|
||||
}
|
||||
|
||||
if (pickedOverlayItem)
|
||||
{
|
||||
caf::PdmObject* objToSelect = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user