summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-09-10 12:03:11 +0100
committerAimee Linden <aimee@lindenlab.com>2010-09-10 12:03:11 +0100
commit1df693e6911a97774c63618d95d4a156645e9cf3 (patch)
treebf5f58a77b71e4e764eb270f744f0ccfc394c06c /indra/newview
parentef3b0ffea01ea5361ffffe09cfb99b940f071bf0 (diff)
parent71fd7c89aa3a35131ce8133b0b9997038fbbfe32 (diff)
VWR-17653 (SNOW-734) (RE)MERGE Show inspectors for avatars on the MiniMap
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llnetmap.cpp97
-rw-r--r--indra/newview/llnetmap.h3
2 files changed, 67 insertions, 33 deletions
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index b0b2a3f6f9..f084002385 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -568,48 +568,37 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask )
{
return FALSE;
}
-
- // mToolTipMsg = "[AGENT][REGION](Double-click to open Map)"
-
- bool have_agent = false;
- LLStringUtil::format_map_t args;
- LLAvatarName av_name;
- if(mClosestAgentToCursor.notNull()
- && LLAvatarNameCache::get(mClosestAgentToCursor, &av_name))
- {
- args["[AGENT]"] = av_name.getCompleteName() + "\n";
- have_agent = true;
- }
- else
- {
- args["[AGENT]"] = "";
- }
-
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) );
- if( region && !have_agent)
- {
- args["[REGION]"] = region->getName() + "\n";
- }
- else
+
+ // If the cursor is near an avatar on the minimap, a mini-inspector will be
+ // shown for the avatar, instead of the normal map tooltip.
+ if (handleToolTipAgent(mClosestAgentToCursor))
{
- args["[REGION]"] = "";
+ return TRUE;
}
- std::string msg = mToolTipMsg;
- LLStringUtil::format(msg, args);
-
LLRect sticky_rect;
- // set sticky_rect
- if (region)
+ std::string region_name;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) );
+ if(region)
{
+ // set sticky_rect
S32 SLOP = 4;
- localPointToScreen(
- x - SLOP, y - SLOP,
- &(sticky_rect.mLeft), &(sticky_rect.mBottom) );
+ localPointToScreen(x - SLOP, y - SLOP, &(sticky_rect.mLeft), &(sticky_rect.mBottom));
sticky_rect.mRight = sticky_rect.mLeft + 2 * SLOP;
sticky_rect.mTop = sticky_rect.mBottom + 2 * SLOP;
+
+ region_name = region->getName();
+ if (!region_name.empty())
+ {
+ region_name += "\n";
+ }
}
+ LLStringUtil::format_map_t args;
+ args["[REGION]"] = region_name;
+ std::string msg = mToolTipMsg;
+ LLStringUtil::format(msg, args);
+
LLToolTipMgr::instance().show(LLToolTip::Params()
.message(msg)
.sticky_rect(sticky_rect));
@@ -617,6 +606,50 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask )
return TRUE;
}
+BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id)
+{
+ LLAvatarName av_name;
+ if (avatar_id.isNull() || !LLAvatarNameCache::get(avatar_id, &av_name))
+ {
+ return FALSE;
+ }
+
+ // only show tooltip if same inspector not already open
+ LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
+ if (!existing_inspector
+ || !existing_inspector->getVisible()
+ || existing_inspector->getKey()["avatar_id"].asUUID() != avatar_id)
+ {
+ LLInspector::Params p;
+ p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+ p.message(av_name.getCompleteName());
+ p.image.name("Inspector_I");
+ p.click_callback(boost::bind(showAvatarInspector, avatar_id));
+ p.visible_time_near(6.f);
+ p.visible_time_far(3.f);
+ p.delay_time(0.35f);
+ p.wrap(false);
+
+ LLToolTipMgr::instance().show(p);
+ }
+ return TRUE;
+}
+
+// static
+void LLNetMap::showAvatarInspector(const LLUUID& avatar_id)
+{
+ LLSD params;
+ params["avatar_id"] = avatar_id;
+
+ if (LLToolTipMgr::instance().toolTipVisible())
+ {
+ LLRect rect = LLToolTipMgr::instance().getToolTipRect();
+ params["pos"]["x"] = rect.mLeft;
+ params["pos"]["y"] = rect.mTop;
+ }
+
+ LLFloaterReg::showInstance("inspect_avatar", params);
+}
void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters )
{
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index e25ada4c95..650bce0da4 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -86,13 +86,14 @@ private:
void drawTracking( const LLVector3d& pos_global,
const LLColor4& color,
BOOL draw_arrow = TRUE);
+ BOOL handleToolTipAgent(const LLUUID& avatar_id);
static void showAvatarInspector(const LLUUID& avatar_id);
void createObjectImage();
-private:
static bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop);
+private:
bool mUpdateNow;
LLUIColor mBackgroundColor;