aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llnetmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llnetmap.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp
index 71eb35b..5a54068 100644
--- a/linden/indra/newview/llnetmap.cpp
+++ b/linden/indra/newview/llnetmap.cpp
@@ -68,13 +68,14 @@
68#include "llglheaders.h" 68#include "llglheaders.h"
69 69
70const F32 MAP_SCALE_MIN = 32; 70const F32 MAP_SCALE_MIN = 32;
71const F32 MAP_SCALE_MID = 172; 71const F32 MAP_SCALE_MID = 1024;
72const F32 MAP_SCALE_MAX = 512; 72const F32 MAP_SCALE_MAX = 4096;
73const F32 MAP_SCALE_INCREMENT = 16; 73const F32 MAP_SCALE_INCREMENT = 16;
74const F32 MAP_MIN_PICK_DIST = 4; 74const F32 MAP_SCALE_ZOOM_FACTOR = 1.04f; // Zoom in factor per click of the scroll wheel (4%)
75const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; 75const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
76 76const F32 MIN_DOT_RADIUS = 3.5f;
77const S32 TRACKING_RADIUS = 3; 77const F32 DOT_SCALE = 0.75f;
78const F32 MIN_PICK_SCALE = 2.f;
78 79
79LLNetMap::LLNetMap(const std::string& name) : 80LLNetMap::LLNetMap(const std::string& name) :
80 LLPanel(name), 81 LLPanel(name),
@@ -89,6 +90,7 @@ LLNetMap::LLNetMap(const std::string& name) :
89{ 90{
90 mScale = gSavedSettings.getF32("MiniMapScale"); 91 mScale = gSavedSettings.getF32("MiniMapScale");
91 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); 92 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
93 mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
92 94
93 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); 95 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
94 96
@@ -138,6 +140,7 @@ void LLNetMap::setScale( F32 scale )
138 } 140 }
139 141
140 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); 142 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
143 mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
141 144
142 mUpdateNow = TRUE; 145 mUpdateNow = TRUE;
143} 146}
@@ -319,6 +322,7 @@ void LLNetMap::draw()
319 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y); 322 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
320 mClosestAgentToCursor.setNull(); 323 mClosestAgentToCursor.setNull();
321 F32 closest_dist = F32_MAX; 324 F32 closest_dist = F32_MAX;
325 F32 min_pick_dist = mDotRadius * MIN_PICK_SCALE;
322 326
323 // Draw avatars 327 // Draw avatars
324 LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); 328 LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
@@ -335,10 +339,11 @@ void LLNetMap::draw()
335 LLWorldMapView::drawAvatar( 339 LLWorldMapView::drawAvatar(
336 pos_map.mV[VX], pos_map.mV[VY], 340 pos_map.mV[VX], pos_map.mV[VY],
337 is_agent_friend(avatar_ids[i]) ? friend_color : avatar_color, 341 is_agent_friend(avatar_ids[i]) ? friend_color : avatar_color,
338 pos_map.mV[VZ]); 342 pos_map.mV[VZ],
343 mDotRadius);
339 344
340 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); 345 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y));
341 if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist) 346 if(dist_to_cursor < min_pick_dist && dist_to_cursor < closest_dist)
342 { 347 {
343 closest_dist = dist_to_cursor; 348 closest_dist = dist_to_cursor;
344 mClosestAgentToCursor = avatar_ids[i]; 349 mClosestAgentToCursor = avatar_ids[i];
@@ -367,10 +372,13 @@ void LLNetMap::draw()
367 // Draw dot for self avatar position 372 // Draw dot for self avatar position
368 pos_global = gAgent.getPositionGlobal(); 373 pos_global = gAgent.getPositionGlobal();
369 pos_map = globalPosToView(pos_global, rotate_map); 374 pos_map = globalPosToView(pos_global, rotate_map);
370 LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage; 375 LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
376 S32 dot_width = llround(mDotRadius * 2.f);
371 you->draw( 377 you->draw(
372 llround(pos_map.mV[VX]) - you->getWidth()/2, 378 llround(pos_map.mV[VX] - mDotRadius),
373 llround(pos_map.mV[VY]) - you->getHeight()/2); 379 llround(pos_map.mV[VY] - mDotRadius),
380 dot_width,
381 dot_width);
374 382
375 // Draw frustum 383 // Draw frustum
376 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters(); 384 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
@@ -509,8 +517,12 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated )
509 517
510BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) 518BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
511{ 519{
512 // note that clicks are reversed from what you'd think 520 // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in
513 setScale(llclamp(mScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX)); 521 F32 scale = mScale;
522
523 scale *= pow(MAP_SCALE_ZOOM_FACTOR, -clicks);
524 setScale(llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX));
525
514 return TRUE; 526 return TRUE;
515} 527}
516 528