Adding the ability to rightclick on a dot on the minimap and cam to the dot (only works if they are within draw distance). Fixes FIRE-1721.

Liny 2011-10-12 15:50:14 -07:00
parent 1b1ac08cf0
commit be1360c90a
4 changed files with 41 additions and 0 deletions

View File

@ -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<LLMenuGL>("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)

View File

@ -59,6 +59,7 @@ private:
void updateMinorDirections();
void handleMark(const LLSD& userdata);
void handleClearMarks();
void handleCam();
void stretchMiniMap(S32 width,S32 height);

View File

@ -73,6 +73,10 @@
#include "llsidetray.h"
#include "lggcontactsets.h"
#include "llnotificationsutil.h"
#include "llnotificationmanager.h"
#include "llavataractions.h"
static LLDefaultChildRegistry::Register<LLNetMap> 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));
// </Ansariel>
registrar.add("Minimap.Cam", boost::bind(&LLNetMap::handleCam, this));
mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("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();
}
//</Ansariel>
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();
}

View File

@ -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;