aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llnetmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llnetmap.cpp')
-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 c407f04..b8bf0cb 100644
--- a/linden/indra/newview/llnetmap.cpp
+++ b/linden/indra/newview/llnetmap.cpp
@@ -70,13 +70,15 @@
70#include "llglheaders.h" 70#include "llglheaders.h"
71 71
72const F32 MAP_SCALE_MIN = 32; 72const F32 MAP_SCALE_MIN = 32;
73const F32 MAP_SCALE_MID = 172; 73const F32 MAP_SCALE_MID = 1024;
74const F32 MAP_SCALE_MAX = 512; 74const F32 MAP_SCALE_MAX = 4096;
75const F32 MAP_SCALE_INCREMENT = 16; 75const F32 MAP_SCALE_INCREMENT = 16;
76const F32 MAP_MIN_PICK_DIST = 4; 76const F32 MAP_SCALE_ZOOM_FACTOR = 1.04f; // Zoom in factor per click of the scroll wheel (4%)
77const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; 77const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
78const F32 MIN_DOT_RADIUS = 3.5f;
79const F32 DOT_SCALE = 0.75f;
80const F32 MIN_PICK_SCALE = 2.f;
78const S32 SLOP = 2; 81const S32 SLOP = 2;
79
80const S32 TRACKING_RADIUS = 3; 82const S32 TRACKING_RADIUS = 3;
81 83
82LLNetMap::LLNetMap(const std::string& name) : 84LLNetMap::LLNetMap(const std::string& name) :
@@ -92,6 +94,7 @@ LLNetMap::LLNetMap(const std::string& name) :
92{ 94{
93 mScale = gSavedSettings.getF32("MiniMapScale"); 95 mScale = gSavedSettings.getF32("MiniMapScale");
94 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); 96 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
97 mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
95 98
96 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); 99 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
97 100
@@ -151,6 +154,7 @@ void LLNetMap::setScale( F32 scale )
151 } 154 }
152 155
153 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); 156 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
157 mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
154 158
155 mUpdateNow = TRUE; 159 mUpdateNow = TRUE;
156} 160}
@@ -333,6 +337,7 @@ void LLNetMap::draw()
333 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y); 337 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
334 mClosestAgentToCursor.setNull(); 338 mClosestAgentToCursor.setNull();
335 F32 closest_dist = F32_MAX; 339 F32 closest_dist = F32_MAX;
340 F32 min_pick_dist = mDotRadius * MIN_PICK_SCALE;
336 341
337 // Draw avatars 342 // Draw avatars
338 LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); 343 LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
@@ -377,14 +382,14 @@ void LLNetMap::draw()
377 } 382 }
378// [/RLVa:KB] 383// [/RLVa:KB]
379 384
380
381 LLWorldMapView::drawAvatar( 385 LLWorldMapView::drawAvatar(
382 pos_map.mV[VX], pos_map.mV[VY], 386 pos_map.mV[VX], pos_map.mV[VY],
383 glyph_color, 387 glyph_color,
384 pos_map.mV[VZ]); 388 pos_map.mV[VZ],
389 mDotRadius);
385 390
386 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); 391 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y));
387 if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist) 392 if(dist_to_cursor < min_pick_dist && dist_to_cursor < closest_dist)
388 { 393 {
389 closest_dist = dist_to_cursor; 394 closest_dist = dist_to_cursor;
390 mClosestAgentToCursor = avatar_ids[i]; 395 mClosestAgentToCursor = avatar_ids[i];
@@ -413,10 +418,13 @@ void LLNetMap::draw()
413 // Draw dot for self avatar position 418 // Draw dot for self avatar position
414 pos_global = gAgent.getPositionGlobal(); 419 pos_global = gAgent.getPositionGlobal();
415 pos_map = globalPosToView(pos_global, rotate_map); 420 pos_map = globalPosToView(pos_global, rotate_map);
416 LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage; 421 LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
422 S32 dot_width = llround(mDotRadius * 2.f);
417 you->draw( 423 you->draw(
418 llround(pos_map.mV[VX]) - you->getWidth()/2, 424 llround(pos_map.mV[VX] - mDotRadius),
419 llround(pos_map.mV[VY]) - you->getHeight()/2); 425 llround(pos_map.mV[VY] - mDotRadius),
426 dot_width,
427 dot_width);
420 428
421 // Draw frustum 429 // Draw frustum
422 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters(); 430 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
@@ -557,8 +565,12 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated )
557 565
558BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) 566BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
559{ 567{
560 // note that clicks are reversed from what you'd think 568 // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in
561 setScale(llclamp(mScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX)); 569 F32 scale = mScale;
570
571 scale *= pow(MAP_SCALE_ZOOM_FACTOR, -clicks);
572 setScale(llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX));
573
562 return TRUE; 574 return TRUE;
563} 575}
564 576