From fcbd928679619f2d1cb8550a30234dcdfc50ef81 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 25 Feb 2022 15:31:49 -0800 Subject: SL-16918: Minimap navigation improvements: Drag without holding shift, remove auto center, click button to re-center --- indra/newview/app_settings/settings.xml | 11 -- indra/newview/llnetmap.cpp | 163 +++++++++++---------- indra/newview/llnetmap.h | 13 +- .../newview/skins/default/xui/en/menu_mini_map.xml | 15 +- 4 files changed, 98 insertions(+), 104 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3ecfa4ef9a..d6836dd8ba 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6049,17 +6049,6 @@ Value 1 - MiniMapAutoCenter - - Comment - Center the focal point of the minimap. - Persist - 1 - Type - Boolean - Value - 1 - Marker Comment diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 29623ccd53..f7bcee2bbc 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -87,7 +87,6 @@ LLNetMap::LLNetMap (const Params & p) mPixelsPerMeter( MAP_SCALE_MID / REGION_WIDTH_METERS ), mObjectMapTPM(0.f), mObjectMapPixels(0.f), - mTargetPan(0.f, 0.f), mCurPan(0.f, 0.f), mStartPan(0.f, 0.f), mMouseDown(0, 0), @@ -112,13 +111,17 @@ LLNetMap::~LLNetMap() BOOL LLNetMap::postBuild() { - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - - registrar.add("Minimap.Zoom", boost::bind(&LLNetMap::handleZoom, this, _2)); - registrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2)); + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commitRegistrar; - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - return TRUE; + commitRegistrar.add("Minimap.Zoom", boost::bind(&LLNetMap::handleZoom, this, _2)); + commitRegistrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2)); + commitRegistrar.add("Minimap.Center.Activate", boost::bind(&LLNetMap::activateCenterMap, this, _2)); + + mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_mini_map.xml", gMenuHolder, + LLViewerMenuHolderGL::child_registry_t::instance()); + mPopupMenu->setItemEnabled("Re-Center Map", false); + + return true; } void LLNetMap::setScale( F32 scale ) @@ -166,10 +169,16 @@ void LLNetMap::draw() createObjectImage(); } - static LLUICachedControl auto_center("MiniMapAutoCenter", true); - if (auto_center) + mCentering = mCentering && !mPanning; + if (mCentering) { - mCurPan = lerp(mCurPan, mTargetPan, LLSmoothInterpolation::getInterpolant(0.1f)); + mCurPan = lerp(mCurPan, LLVector2(0.0f, 0.0f) , LLSmoothInterpolation::getInterpolant(0.1f)); + if (abs(mCurPan.mV[0]) < 0.5f && abs(mCurPan.mV[1]) < 0.5f){ + mCurPan.mV[0] = 0.0f; + mCurPan.mV[1] = 0.0f; + mCentering = false; + mPopupMenu->setItemEnabled("Re-Center Map", false); + } } // Prepare a scissor region @@ -589,23 +598,25 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { - // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in - F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); + // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in + F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); + // *TODO: Decide if we want this feature +#if 0 F32 old_scale = mScale; +#endif - setScale(new_scale); + setScale(new_scale); - static LLUICachedControl auto_center("MiniMapAutoCenter", true); - if (!auto_center) - { - // Adjust pan to center the zoom on the mouse pointer - LLVector2 zoom_offset; - zoom_offset.mV[VX] = x - getRect().getWidth() / 2; - zoom_offset.mV[VY] = y - getRect().getHeight() / 2; - mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; - } + // *TODO: Decide if we want this feature +#if 0 + // Adjust pan to center the zoom on the mouse pointer + LLVector2 zoom_offset; + zoom_offset.mV[VX] = x - getRect().getWidth() / 2; + zoom_offset.mV[VY] = y - getRect().getHeight() / 2; + mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; +#endif - return TRUE; + return true; } BOOL LLNetMap::handleToolTip(S32 x, S32 y, MASK mask) @@ -898,50 +909,48 @@ void LLNetMap::createObjectImage() mUpdateNow = true; } -BOOL LLNetMap::handleMouseDown( S32 x, S32 y, MASK mask ) +BOOL LLNetMap::handleMouseDown(S32 x, S32 y, MASK mask) { - if (!(mask & MASK_SHIFT)) return FALSE; - - // Start panning - gFocusMgr.setMouseCapture(this); + // Start panning + gFocusMgr.setMouseCapture(this); - mStartPan = mCurPan; - mMouseDown.mX = x; - mMouseDown.mY = y; - return TRUE; + mStartPan = mCurPan; + mMouseDown.mX = x; + mMouseDown.mY = y; + return true; } -BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) +BOOL LLNetMap::handleMouseUp(S32 x, S32 y, MASK mask) { - if(abs(mMouseDown.mX-x)<3 && abs(mMouseDown.mY-y)<3) - handleClick(x,y,mask); + if (abs(mMouseDown.mX - x) < 3 && abs(mMouseDown.mY - y) < 3) + { + handleClick(x, y, mask); + } - if (hasMouseCapture()) - { - if (mPanning) - { - // restore mouse cursor - S32 local_x, local_y; - local_x = mMouseDown.mX + llfloor(mCurPan.mV[VX] - mStartPan.mV[VX]); - local_y = mMouseDown.mY + llfloor(mCurPan.mV[VY] - mStartPan.mV[VY]); - LLRect clip_rect = getRect(); - clip_rect.stretch(-8); - clip_rect.clipPointToRect(mMouseDown.mX, mMouseDown.mY, local_x, local_y); - LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); - - // finish the pan - mPanning = false; - - mMouseDown.set(0, 0); - - // auto centre - mTargetPan.setZero(); - } - gViewerWindow->showCursor(); - gFocusMgr.setMouseCapture(NULL); - return TRUE; - } - return FALSE; + if (hasMouseCapture()) + { + if (mPanning) + { + // restore mouse cursor + S32 local_x, local_y; + local_x = mMouseDown.mX + llfloor(mCurPan.mV[VX] - mStartPan.mV[VX]); + local_y = mMouseDown.mY + llfloor(mCurPan.mV[VY] - mStartPan.mV[VY]); + LLRect clip_rect = getRect(); + clip_rect.stretch(-8); + clip_rect.clipPointToRect(mMouseDown.mX, mMouseDown.mY, local_x, local_y); + LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); + + // finish the pan + mPanning = false; + + mMouseDown.set(0, 0); + } + gViewerWindow->showCursor(); + gFocusMgr.setMouseCapture(NULL); + return true; + } + + return false; } BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -1015,9 +1024,10 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) { if (!mPanning) { - // just started panning, so hide cursor + // Just started panning. Hide cursor and enable the "Re-Center Map" button. mPanning = true; gViewerWindow->hideCursor(); + mPopupMenu->setItemEnabled("Re-Center Map", true); } LLVector2 delta(static_cast(gViewerWindow->getCurrentMouseDX()), @@ -1025,27 +1035,22 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) // Set pan to value at start of drag + offset mCurPan += delta; - mTargetPan = mCurPan; gViewerWindow->moveCursorToCenter(); } - - // Doesn't really matter, cursor should be hidden - gViewerWindow->setCursor( UI_CURSOR_TOOLPAN ); - } - else - { - if (mask & MASK_SHIFT) - { - // If shift is held, change the cursor to hint that the map can be dragged - gViewerWindow->setCursor( UI_CURSOR_TOOLPAN ); - } - else - { - gViewerWindow->setCursor( UI_CURSOR_CROSS ); - } } + if (mask & MASK_SHIFT) + { + // If shift is held, change the cursor to hint that the map can be + // dragged. However, holding shift is not required to drag the map. + gViewerWindow->setCursor( UI_CURSOR_TOOLPAN ); + } + else + { + gViewerWindow->setCursor( UI_CURSOR_CROSS ); + } + return TRUE; } @@ -1083,3 +1088,5 @@ void LLNetMap::handleStopTracking (const LLSD& userdata) LLTracker::stopTracking (LLTracker::isTracking(NULL)); } } + +void LLNetMap::activateCenterMap(const LLSD &userdata) { mCentering = true; } diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index b82b3d4105..0f2eee171d 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -121,11 +121,11 @@ private: F32 mObjectMapPixels; // Width of object map in pixels F32 mDotRadius; // Size of avatar markers - bool mPanning; // map is being dragged - LLVector2 mTargetPan; - LLVector2 mCurPan; - LLVector2 mStartPan; // pan offset at start of drag - LLCoordGL mMouseDown; // pointer position at start of drag + bool mPanning; // map is being dragged + bool mCentering; // map is being re-centered around the agent + LLVector2 mCurPan; + LLVector2 mStartPan; // pan offset at start of drag + LLCoordGL mMouseDown; // pointer position at start of drag LLVector3d mObjectImageCenterGlobal; LLPointer mObjectRawImagep; @@ -148,7 +148,8 @@ public: private: void handleZoom(const LLSD& userdata); - void handleStopTracking (const LLSD& userdata); + void handleStopTracking(const LLSD& userdata); + void activateCenterMap(const LLSD& userdata); LLMenuGL* mPopupMenu; uuid_vec_t gmSelected; diff --git a/indra/newview/skins/default/xui/en/menu_mini_map.xml b/indra/newview/skins/default/xui/en/menu_mini_map.xml index c3899b35cd..ddc952dfe7 100644 --- a/indra/newview/skins/default/xui/en/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en/menu_mini_map.xml @@ -46,16 +46,13 @@ function="ToggleControl" parameter="MiniMapRotate" /> - - - - + + + -- cgit v1.2.3 From 39e553fc11ef1a96707abb0a26c3b1be06954436 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 3 Mar 2022 11:06:16 -0800 Subject: SL-16918: Re-add "Auto-center map" button to minimap context menu, enable minimap auto-center by default again --- indra/newview/app_settings/settings.xml | 11 ++++++ indra/newview/llnetmap.cpp | 45 ++++++++++++---------- .../newview/skins/default/xui/en/menu_mini_map.xml | 10 +++++ 3 files changed, 46 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d6836dd8ba..3ecfa4ef9a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6049,6 +6049,17 @@ Value 1 + MiniMapAutoCenter + + Comment + Center the focal point of the minimap. + Persist + 1 + Type + Boolean + Value + 1 + Marker Comment diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index f7bcee2bbc..387964f4e8 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -169,17 +169,25 @@ void LLNetMap::draw() createObjectImage(); } + static LLUICachedControl auto_center("MiniMapAutoCenter", true); + bool auto_centering = auto_center && !mPanning; mCentering = mCentering && !mPanning; - if (mCentering) + bool centered = mCurPan.mV[VX] == 0.0f && mCurPan.mV[VY] == 0.0f; + + if (auto_centering || mCentering) { mCurPan = lerp(mCurPan, LLVector2(0.0f, 0.0f) , LLSmoothInterpolation::getInterpolant(0.1f)); - if (abs(mCurPan.mV[0]) < 0.5f && abs(mCurPan.mV[1]) < 0.5f){ - mCurPan.mV[0] = 0.0f; - mCurPan.mV[1] = 0.0f; - mCentering = false; - mPopupMenu->setItemEnabled("Re-Center Map", false); - } } + centered = abs(mCurPan.mV[VX]) < 0.5f && abs(mCurPan.mV[VY]) < 0.5f; + if (centered) + { + mCurPan.mV[0] = 0.0f; + mCurPan.mV[1] = 0.0f; + mCentering = false; + } + + bool can_recenter_map = !(centered || mCentering || auto_centering); + mPopupMenu->setItemEnabled("Re-Center Map", can_recenter_map); // Prepare a scissor region F32 rotation = 0; @@ -600,21 +608,19 @@ BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); - // *TODO: Decide if we want this feature -#if 0 F32 old_scale = mScale; -#endif setScale(new_scale); - // *TODO: Decide if we want this feature -#if 0 - // Adjust pan to center the zoom on the mouse pointer - LLVector2 zoom_offset; - zoom_offset.mV[VX] = x - getRect().getWidth() / 2; - zoom_offset.mV[VY] = y - getRect().getHeight() / 2; - mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; -#endif + static LLUICachedControl auto_center("MiniMapAutoCenter", true); + if (!auto_center) + { + // Adjust pan to center the zoom on the mouse pointer + LLVector2 zoom_offset; + zoom_offset.mV[VX] = x - getRect().getWidth() / 2; + zoom_offset.mV[VY] = y - getRect().getHeight() / 2; + mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; + } return true; } @@ -1024,10 +1030,9 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) { if (!mPanning) { - // Just started panning. Hide cursor and enable the "Re-Center Map" button. + // Just started panning. Hide cursor. mPanning = true; gViewerWindow->hideCursor(); - mPopupMenu->setItemEnabled("Re-Center Map", true); } LLVector2 delta(static_cast(gViewerWindow->getCurrentMouseDX()), diff --git a/indra/newview/skins/default/xui/en/menu_mini_map.xml b/indra/newview/skins/default/xui/en/menu_mini_map.xml index ddc952dfe7..402e1b34d0 100644 --- a/indra/newview/skins/default/xui/en/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en/menu_mini_map.xml @@ -47,6 +47,16 @@ parameter="MiniMapRotate" /> + + + + + -- cgit v1.2.3 From d6febef0ec4619da615bd777a3f71f97d13d3e14 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Wed, 9 Mar 2022 10:11:40 -0800 Subject: Fix DRTVWR-550 TeamCity build. codesigning retry block had some leftover python2 syntax --- indra/newview/viewer_manifest.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index ae3ed56b3d..1809b707ef 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1313,9 +1313,8 @@ class DarwinManifest(ViewerManifest): ] for attempt in range(3): if attempt: # second or subsequent iteration - print >> sys.stderr, \ - ("codesign failed, waiting %d seconds before retrying" % - sign_retry_wait) + print("codesign failed, waiting {:d} seconds before retrying".format(sign_retry_wait), + file=sys.stderr) time.sleep(sign_retry_wait) sign_retry_wait*=2 -- cgit v1.2.3 From c8eb9f54c4aa3b72184eb8a6bfc1ec6fd22320b7 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Wed, 9 Mar 2022 16:47:35 -0800 Subject: More DRTVWR-550 Teamcity build fix. another piece of python2 syntax leftover in an error handling block --- indra/newview/viewer_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 1809b707ef..c9aa82f7d4 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1344,7 +1344,7 @@ class DarwinManifest(ViewerManifest): # 'err' goes out of scope sign_failed = err else: - print >> sys.stderr, "Maximum codesign attempts exceeded; giving up" + print("Maximum codesign attempts exceeded; giving up", file=sys.stderr) raise sign_failed self.run_command(['spctl', '-a', '-texec', '-vvvv', app_in_dmg]) self.run_command([self.src_path_of("installers/darwin/apple-notarize.sh"), app_in_dmg]) -- cgit v1.2.3 From 6013e68ea2d2ca65bac912a295a8521c22a72325 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 5 Apr 2022 11:53:38 -0700 Subject: SL-16918: Fix unneeded assignment to centered in LLNetMap::draw() --- indra/newview/llnetmap.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 387964f4e8..66cf6272fd 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -172,13 +172,12 @@ void LLNetMap::draw() static LLUICachedControl auto_center("MiniMapAutoCenter", true); bool auto_centering = auto_center && !mPanning; mCentering = mCentering && !mPanning; - bool centered = mCurPan.mV[VX] == 0.0f && mCurPan.mV[VY] == 0.0f; if (auto_centering || mCentering) { mCurPan = lerp(mCurPan, LLVector2(0.0f, 0.0f) , LLSmoothInterpolation::getInterpolant(0.1f)); } - centered = abs(mCurPan.mV[VX]) < 0.5f && abs(mCurPan.mV[VY]) < 0.5f; + bool centered = abs(mCurPan.mV[VX]) < 0.5f && abs(mCurPan.mV[VY]) < 0.5f; if (centered) { mCurPan.mV[0] = 0.0f; -- cgit v1.2.3