1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 09:32:45 +00:00

Update the tooltip when the focusObject is set

This commit is contained in:
scrawl 2017-07-20 20:59:36 +02:00
parent 0e2e23e9f8
commit c9f8a220dc
3 changed files with 13 additions and 2 deletions

View File

@ -40,6 +40,7 @@ namespace MWGui
, mEnabled(true) , mEnabled(true)
, mFullHelp(false) , mFullHelp(false)
, mShowOwned(0) , mShowOwned(0)
, mFrameDuration(0.f)
{ {
getWidget(mDynamicToolTipBox, "DynamicToolTipBox"); getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
@ -67,6 +68,11 @@ namespace MWGui
} }
void ToolTips::onFrame(float frameDuration) void ToolTips::onFrame(float frameDuration)
{
mFrameDuration = frameDuration;
}
void ToolTips::update(float frameDuration)
{ {
while (mDynamicToolTipBox->getChildCount()) while (mDynamicToolTipBox->getChildCount())
@ -320,6 +326,8 @@ namespace MWGui
void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus) void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus)
{ {
mFocusObject = focus; mFocusObject = focus;
update(mFrameDuration);
} }
MyGUI::IntSize ToolTips::getToolTipViaPtr (int count, bool image) MyGUI::IntSize ToolTips::getToolTipViaPtr (int count, bool image)

View File

@ -50,6 +50,7 @@ namespace MWGui
ToolTips(); ToolTips();
void onFrame(float frameDuration); void onFrame(float frameDuration);
void update(float frameDuration);
void setEnabled(bool enabled); void setEnabled(bool enabled);
@ -126,6 +127,8 @@ namespace MWGui
bool mFullHelp; bool mFullHelp;
int mShowOwned; int mShowOwned;
float mFrameDuration;
}; };
} }
#endif #endif

View File

@ -1756,8 +1756,6 @@ namespace MWWorld
// inform the GUI about focused object // inform the GUI about focused object
MWWorld::Ptr object = getFacedObject (); MWWorld::Ptr object = getFacedObject ();
MWBase::Environment::get().getWindowManager()->setFocusObject(object);
// retrieve object dimensions so we know where to place the floating label // retrieve object dimensions so we know where to place the floating label
if (!object.isEmpty ()) if (!object.isEmpty ())
{ {
@ -1766,6 +1764,8 @@ namespace MWWorld
MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords( MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords(
screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w()); screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w());
} }
MWBase::Environment::get().getWindowManager()->setFocusObject(object);
} }
MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer) MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer)