@@ -325,6 +325,7 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
325
325
mWaitingForTracker(false ),
326
326
mIsClosing(false ),
327
327
mSetToUserPosition(true ),
328
+ mProcessingSearchUpdate(false ),
328
329
mTrackedLocation(0.0 ,0.0 ,0.0 ),
329
330
mTrackedStatus(LLTracker::TRACKING_NOTHING),
330
331
mParcelInfoObserver(nullptr ),
@@ -338,7 +339,7 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
338
339
mCommitCallbackRegistrar .add (" WMap.Location" , boost::bind (&LLFloaterWorldMap::onLocationCommit, this ));
339
340
mCommitCallbackRegistrar .add (" WMap.AvatarCombo" , boost::bind (&LLFloaterWorldMap::onAvatarComboCommit, this ));
340
341
mCommitCallbackRegistrar .add (" WMap.Landmark" , boost::bind (&LLFloaterWorldMap::onLandmarkComboCommit, this ));
341
- mCommitCallbackRegistrar .add (" WMap.SearchResult" , boost::bind (& LLFloaterWorldMap::onCommitSearchResult, this ) );
342
+ mCommitCallbackRegistrar .add (" WMap.SearchResult" , [ this ](LLUICtrl* ctrl, const LLSD& data) { LLFloaterWorldMap::onCommitSearchResult ( false ); } );
342
343
mCommitCallbackRegistrar .add (" WMap.GoHome" , boost::bind (&LLFloaterWorldMap::onGoHome, this ));
343
344
mCommitCallbackRegistrar .add (" WMap.Teleport" , boost::bind (&LLFloaterWorldMap::onClickTeleportBtn, this ));
344
345
mCommitCallbackRegistrar .add (" WMap.ShowTarget" , boost::bind (&LLFloaterWorldMap::onShowTargetBtn, this ));
@@ -783,6 +784,7 @@ void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item)
783
784
784
785
void LLFloaterWorldMap::trackLocation (const LLVector3d& pos_global)
785
786
{
787
+ mProcessingSearchUpdate = false ;
786
788
LLSimInfo* sim_info = LLWorldMap::getInstance ()->simInfoFromPosGlobal (pos_global);
787
789
if (!sim_info)
788
790
{
@@ -922,7 +924,10 @@ void LLFloaterWorldMap::updateLocation()
922
924
}
923
925
}
924
926
925
- mLocationEditor ->setValue (sim_name);
927
+ if (!mProcessingSearchUpdate )
928
+ {
929
+ mLocationEditor ->setValue (sim_name);
930
+ }
926
931
927
932
// refresh coordinate display to reflect where user clicked.
928
933
LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal ();
@@ -1196,6 +1201,7 @@ void LLFloaterWorldMap::onGoHome()
1196
1201
{
1197
1202
gAgent .teleportHome ();
1198
1203
closeFloater ();
1204
+ mProcessingSearchUpdate = false ;
1199
1205
}
1200
1206
1201
1207
@@ -1365,6 +1371,7 @@ void LLFloaterWorldMap::onLocationCommit()
1365
1371
{
1366
1372
return ;
1367
1373
}
1374
+ mProcessingSearchUpdate = true ;
1368
1375
1369
1376
LLStringUtil::toLower (str);
1370
1377
mCompletingRegionName = str;
@@ -1386,6 +1393,7 @@ void LLFloaterWorldMap::onCoordinatesCommit()
1386
1393
{
1387
1394
return ;
1388
1395
}
1396
+ mProcessingSearchUpdate = false ;
1389
1397
1390
1398
S32 x_coord = (S32)mTeleportCoordSpinX ->getValue ().asReal ();
1391
1399
S32 y_coord = (S32)mTeleportCoordSpinY ->getValue ().asReal ();
@@ -1399,6 +1407,7 @@ void LLFloaterWorldMap::onCoordinatesCommit()
1399
1407
void LLFloaterWorldMap::onClearBtn ()
1400
1408
{
1401
1409
mTrackedStatus = LLTracker::TRACKING_NOTHING;
1410
+ mProcessingSearchUpdate = false ;
1402
1411
LLTracker::stopTracking (true );
1403
1412
LLWorldMap::getInstance ()->cancelTracking ();
1404
1413
mSLURL = LLSLURL (); // Clear the SLURL since it's invalid
@@ -1415,6 +1424,7 @@ void LLFloaterWorldMap::onShowAgentBtn()
1415
1424
mMapView ->setPanWithInterpTime (0 , 0 , false , 0 .1f ); // false == animate
1416
1425
// Set flag so user's location will be displayed if not tracking anything else
1417
1426
mSetToUserPosition = true ;
1427
+ mProcessingSearchUpdate = false ;
1418
1428
}
1419
1429
1420
1430
void LLFloaterWorldMap::onClickTeleportBtn ()
@@ -1570,6 +1580,12 @@ void LLFloaterWorldMap::teleport()
1570
1580
gAgent .teleportViaLocation ( pos_global );
1571
1581
}
1572
1582
}
1583
+
1584
+ if (mProcessingSearchUpdate )
1585
+ {
1586
+ mProcessingSearchUpdate = false ;
1587
+ mTrackedSimName .clear ();
1588
+ }
1573
1589
}
1574
1590
1575
1591
void LLFloaterWorldMap::flyToLandmark ()
@@ -1695,18 +1711,20 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
1695
1711
{
1696
1712
mSearchResults ->selectByValue (match);
1697
1713
mSearchResults ->setFocus (true );
1698
- onCommitSearchResult ();
1714
+ onCommitSearchResult (false /* fully commit the only option */ );
1699
1715
}
1700
1716
// else let user decide
1701
1717
else
1702
1718
{
1703
- mSearchResults ->operateOnAll (LLCtrlListInterface::OP_DESELECT );
1719
+ mSearchResults ->selectFirstItem ( );
1704
1720
mSearchResults ->setFocus (true );
1721
+ onCommitSearchResult (true /* don't update text field*/ );
1705
1722
}
1706
1723
}
1707
1724
else
1708
1725
{
1709
1726
// if we found nothing, say "none"
1727
+ mProcessingSearchUpdate = false ;
1710
1728
mSearchResults ->setCommentText (LLTrans::getString (" worldmap_results_none_found" ));
1711
1729
mSearchResults ->operateOnAll (LLCtrlListInterface::OP_DESELECT);
1712
1730
}
@@ -1720,7 +1738,7 @@ void LLFloaterWorldMap::onTeleportFinished()
1720
1738
}
1721
1739
}
1722
1740
1723
- void LLFloaterWorldMap::onCommitSearchResult ()
1741
+ void LLFloaterWorldMap::onCommitSearchResult (bool from_search )
1724
1742
{
1725
1743
std::string sim_name = mSearchResults ->getSelectedValue ().asString ();
1726
1744
if (sim_name.empty ())
@@ -1751,8 +1769,14 @@ void LLFloaterWorldMap::onCommitSearchResult()
1751
1769
pos_global.mdV [VY] += (F64)pos_local.mV [VY];
1752
1770
pos_global.mdV [VZ] = (F64)pos_local.mV [VZ];
1753
1771
1754
- mLocationEditor ->setValue (sim_name);
1772
+ // Commiting search string automatically selects first item in the search list,
1773
+ // in such case onCommitSearchResult shouldn't modify search string
1774
+ if (!from_search)
1775
+ {
1776
+ mLocationEditor ->setValue (sim_name);
1777
+ }
1755
1778
trackLocation (pos_global);
1779
+ mProcessingSearchUpdate = from_search;
1756
1780
mTrackCtrlsPanel ->setDefaultBtn (mTeleportButton );
1757
1781
break ;
1758
1782
}
0 commit comments