diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 776cb28afd..3a35c332c2 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -112,6 +112,8 @@ BOOL LLFloaterMap::postBuild() registrar.add("Minimap.Mark", boost::bind(&LLFloaterMap::handleMark, this, _2)); registrar.add("Minimap.ClearMarks", boost::bind(&LLFloaterMap::handleClearMarks, this)); + registrar.add("Minimap.Cam", boost::bind(&LLFloaterMap::handleCam, this)); + mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); if (mPopupMenu && !LLTracker::isTracking(0)) { @@ -348,6 +350,11 @@ void LLFloaterMap::handleClearMarks() mMap->clearAvatarMarks(); } +void LLFloaterMap::handleCam() +{ + mMap->camAvatar(); +} + void LLFloaterMap::handleStopTracking (const LLSD& userdata) { if (mPopupMenu) diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 8349fe685f..a71f895096 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -59,6 +59,7 @@ private: void updateMinorDirections(); void handleMark(const LLSD& userdata); void handleClearMarks(); + void handleCam(); void stretchMiniMap(S32 width,S32 height); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 89dcf2ac1a..17a7df355e 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -73,6 +73,10 @@ #include "llsidetray.h" #include "lggcontactsets.h" +#include "llnotificationsutil.h" +#include "llnotificationmanager.h" +#include "llavataractions.h" + static LLDefaultChildRegistry::Register r1("net_map"); const F32 LLNetMap::MAP_SCALE_MIN = 32; @@ -136,6 +140,7 @@ BOOL LLNetMap::postBuild() registrar.add("Minimap.Mark", boost::bind(&LLNetMap::handleMark, this, _2)); registrar.add("Minimap.ClearMarks", boost::bind(&LLNetMap::handleClearMarks, this)); // + registrar.add("Minimap.Cam", boost::bind(&LLNetMap::handleCam, this)); mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); return TRUE; } @@ -539,6 +544,7 @@ void LLNetMap::draw() if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared) { mClosestAgentToCursor = gAgent.getID(); + mClosestAgentPosition = pos_global; } // Draw chat range ring(s) @@ -1208,6 +1214,7 @@ void LLNetMap::setAvatarMark(const LLSD& userdata) void LLNetMap::saveClosestAgentAtLastRightClick() { mClosestAgentAtLastRightClick = mClosestAgentToCursor; + mClosestAgentAtLastRightClickPos = mClosestAgentPosition; } void LLNetMap::clearAvatarMarks() @@ -1215,3 +1222,26 @@ void LLNetMap::clearAvatarMarks() LLNetMap::sAvatarMarksMap.clear(); } // + +void LLNetMap::camAvatar() +{ + F32 range = dist_vec(mClosestAgentAtLastRightClickPos, gAgent.getPositionGlobal()); + if (range > gSavedSettings.getF32("RenderFarClip")) + { + LLChat chat; + chat.mText = "The camera cannot focus on user because they are outside your draw distance."; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLSD args; + args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + } + else + { + LLAvatarActions::zoomIn(mClosestAgentAtLastRightClick); + } +} + +void LLNetMap::handleCam() +{ + camAvatar(); +} diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 1d98c51022..58473eef85 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -126,6 +126,7 @@ private: LLUUID mClosestAgentAtLastRightClick; LLVector3d mClosestAgentPosition; + LLVector3d mClosestAgentAtLastRightClickPos; std::string mToolTipMsg; @@ -136,12 +137,14 @@ public: void setAvatarMark(const LLSD& userdata); void saveClosestAgentAtLastRightClick(); void clearAvatarMarks(); + void camAvatar(); private: void handleZoom(const LLSD& userdata); void handleStopTracking (const LLSD& userdata); void handleMark(const LLSD& userdata); void handleClearMarks(); + void handleCam(); LLMenuGL* mPopupMenu; uuid_vec_t gmSelected;