Skip to content

Commit

Permalink
Avoid double drawing for obtaining the tooltip element. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent e4df864 commit 7c49a75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/gui/windows/GUISUMOAbstractView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ GUISUMOAbstractView::paintGL() {
if (getTrackedID() != GUIGlObject::INVALID_ID) {
centerTo(getTrackedID(), false);
}
// get id tooltip
const GUIGlID idToolTip = getObjectUnderCursor();
// draw
glClearColor(
myVisualizationSettings->backgroundColor.red() / 255.f,
Expand Down Expand Up @@ -337,7 +335,7 @@ GUISUMOAbstractView::paintGL() {
}
// check if show tooltip
if (myGlChildWindowParent->getGUIMainWindowParent()->getStaticTooltipView()->isStaticToolTipEnabled()) {
showToolTipFor(idToolTip);
showToolTipFor(getToolTipID());
} else {
myGlChildWindowParent->getGUIMainWindowParent()->getStaticTooltipView()->hideStaticToolTip();
}
Expand Down Expand Up @@ -381,6 +379,12 @@ GUISUMOAbstractView::getLaneUnderCursor() {
}


GUIGlID
GUISUMOAbstractView::getToolTipID() {
return getObjectUnderCursor();
}


GUIGlID
GUISUMOAbstractView::getObjectUnderCursor() {
return getObjectAtPosition(getPositionInformation());
Expand Down
3 changes: 3 additions & 0 deletions src/utils/gui/windows/GUISUMOAbstractView.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ class GUISUMOAbstractView : public FXGLCanvas {
/// @brief returns the GUILane at cursor position (implementation depends on view)
virtual GUILane* getLaneUnderCursor();

/// @brief returns the id of object under cursor to show their tooltip
virtual GUIGlID getToolTipID();

/// @brief returns the id of the front object under the cursor using GL_SELECT
GUIGlID getObjectUnderCursor();

Expand Down

0 comments on commit 7c49a75

Please sign in to comment.