From d3a616122f46dc1100bf9ef751b8530a94aa3799 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 3 Mar 2022 09:58:25 -0800 Subject: SL-15232: Test to scroll mouse wheel to map position on main map/minimap --- indra/newview/llfloaterworldmap.cpp | 58 +++++++++++++++---------------------- 1 file changed, 23 insertions(+), 35 deletions(-) (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 27197f0b06..6e29a01dd1 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -79,7 +79,6 @@ //--------------------------------------------------------------------------- // Constants //--------------------------------------------------------------------------- -static const F32 MAP_ZOOM_TIME = 0.2f; // Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed // width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across @@ -300,13 +299,11 @@ BOOL LLFloaterWorldMap::postBuild() landmark_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListLandmarkCombo = dynamic_cast(landmark_combo); - mCurZoomVal = log(LLWorldMapView::sMapScale/256.f)/log(2.f); - getChild("zoom slider")->setValue(mCurZoomVal); + F32 slider_zoom = LLWorldMapView::getZoom(); + getChild("zoom slider")->setValue(slider_zoom); setDefaultBtn(NULL); - mZoomTimer.stop(); - onChangeMaturity(); return TRUE; @@ -406,18 +403,21 @@ BOOL LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask) BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { - if (!isMinimized() && isFrontmost()) - { - if(mPanel->pointInView(x, y)) - { - F32 slider_value = (F32)getChild("zoom slider")->getValue().asReal(); - slider_value += ((F32)clicks * -0.3333f); - getChild("zoom slider")->setValue(LLSD(slider_value)); - return TRUE; - } - } - - return LLFloater::handleScrollWheel(x, y, clicks); + if (!isMinimized() && isFrontmost()) + { + if (mPanel->pointInView(x, y)) + { + F32 old_slider_zoom = (F32)getChild("zoom slider")->getValue().asReal(); + F32 slider_zoom = old_slider_zoom + ((F32)clicks * -0.3333f); + getChild("zoom slider")->setValue(LLSD(slider_zoom)); + S32 map_x = x - mPanel->getRect().mLeft; + S32 map_y = y - mPanel->getRect().mBottom; + LLWorldMapView::zoomWithPivot(slider_zoom, map_x, map_y); + return true; + } + } + + return LLFloater::handleScrollWheel(x, y, clicks); } @@ -496,21 +496,8 @@ void LLFloaterWorldMap::draw() setMouseOpaque(TRUE); getDragHandle()->setMouseOpaque(TRUE); - - //RN: snaps to zoom value because interpolation caused jitter in the text rendering - if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)getChild("zoom slider")->getValue().asReal()) - { - mZoomTimer.start(); - } - F32 interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; - if (interp > 1.f) - { - interp = 1.f; - mZoomTimer.stop(); - } - mCurZoomVal = lerp(mCurZoomVal, (F32)getChild("zoom slider")->getValue().asReal(), interp); - F32 map_scale = 256.f*pow(2.f, mCurZoomVal); - LLWorldMapView::setScale( map_scale ); + + LLWorldMapView::zoom((F32)getChild("zoom slider")->getValue().asReal()); // Enable/disable checkboxes depending on the zoom level // If above threshold level (i.e. low res) -> Disable all checkboxes @@ -1338,9 +1325,10 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) pos_global.clearVec(); } - LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)), - -llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)), - !animate); + F64 map_scale = (F64)LLWorldMapView::getScale(); + LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)), + -llfloor((F32)(pos_global.mdV[VY] * map_scale / REGION_WIDTH_METERS)), + !animate); mWaitingForTracker = FALSE; } -- cgit v1.2.3 From 288fbe23175d504359169ae6d8dda86529f8d046 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 9 Mar 2022 14:58:31 -0800 Subject: SL-15232: Fix top/right edges of main map not being scrollable --- indra/newview/llfloaterworldmap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 6e29a01dd1..2947804b69 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -405,13 +405,13 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (!isMinimized() && isFrontmost()) { - if (mPanel->pointInView(x, y)) + S32 map_x = x - mPanel->getRect().mLeft; + S32 map_y = y - mPanel->getRect().mBottom; + if (mPanel->pointInView(map_x, map_y)) { F32 old_slider_zoom = (F32)getChild("zoom slider")->getValue().asReal(); F32 slider_zoom = old_slider_zoom + ((F32)clicks * -0.3333f); getChild("zoom slider")->setValue(LLSD(slider_zoom)); - S32 map_x = x - mPanel->getRect().mLeft; - S32 map_y = y - mPanel->getRect().mBottom; LLWorldMapView::zoomWithPivot(slider_zoom, map_x, map_y); return true; } -- cgit v1.2.3 From c6cba3a67d4a346d1d5cf0cc6e6a8fe8c640e13f Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 10 Mar 2022 16:38:07 -0800 Subject: SL-15232: Clean up LLWorldMapView a bit. Avoid a static variable hack and convert a few related variables/methods to non-static as well --- indra/newview/llfloaterworldmap.cpp | 41 ++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 2947804b69..cf314c3e60 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -278,7 +278,7 @@ void* LLFloaterWorldMap::createWorldMapView(void* data) BOOL LLFloaterWorldMap::postBuild() { - mPanel = getChild("objects_mapview"); + mMapView = dynamic_cast(getChild("objects_mapview")); LLComboBox *avatar_combo = getChild("friend combo"); avatar_combo->selectFirstItem(); @@ -299,7 +299,7 @@ BOOL LLFloaterWorldMap::postBuild() landmark_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListLandmarkCombo = dynamic_cast(landmark_combo); - F32 slider_zoom = LLWorldMapView::getZoom(); + F32 slider_zoom = mMapView->getZoom(); getChild("zoom slider")->setValue(slider_zoom); setDefaultBtn(NULL); @@ -313,7 +313,7 @@ BOOL LLFloaterWorldMap::postBuild() LLFloaterWorldMap::~LLFloaterWorldMap() { // All cleaned up by LLView destructor - mPanel = NULL; + mMapView = NULL; // Inventory deletes all observers on shutdown mInventory = NULL; @@ -345,17 +345,15 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) mIsClosing = FALSE; - LLWorldMapView* map_panel; - map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel; - map_panel->clearLastClick(); + mMapView->clearLastClick(); { // reset pan on show, so it centers on you again if (!center_on_target) { - LLWorldMapView::setPan(0, 0, TRUE); + mMapView->setPan(0, 0, true); } - map_panel->updateVisibleBlocks(); + mMapView->updateVisibleBlocks(); // Reload items as they may have changed LLWorldMap::getInstance()->reloadItems(); @@ -405,14 +403,14 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (!isMinimized() && isFrontmost()) { - S32 map_x = x - mPanel->getRect().mLeft; - S32 map_y = y - mPanel->getRect().mBottom; - if (mPanel->pointInView(map_x, map_y)) + S32 map_x = x - mMapView->getRect().mLeft; + S32 map_y = y - mMapView->getRect().mBottom; + if (mMapView->pointInView(map_x, map_y)) { F32 old_slider_zoom = (F32)getChild("zoom slider")->getValue().asReal(); F32 slider_zoom = old_slider_zoom + ((F32)clicks * -0.3333f); getChild("zoom slider")->setValue(LLSD(slider_zoom)); - LLWorldMapView::zoomWithPivot(slider_zoom, map_x, map_y); + mMapView->zoomWithPivot(slider_zoom, map_x, map_y); return true; } } @@ -497,12 +495,12 @@ void LLFloaterWorldMap::draw() setMouseOpaque(TRUE); getDragHandle()->setMouseOpaque(TRUE); - LLWorldMapView::zoom((F32)getChild("zoom slider")->getValue().asReal()); + mMapView->zoom((F32)getChild("zoom slider")->getValue().asReal()); // Enable/disable checkboxes depending on the zoom level // If above threshold level (i.e. low res) -> Disable all checkboxes // If under threshold level (i.e. high res) -> Enable all checkboxes - bool enable = LLWorldMapView::showRegionInfo(); + bool enable = mMapView->showRegionInfo(); getChildView("people_chk")->setEnabled(enable); getChildView("infohub_chk")->setEnabled(enable); getChildView("telehub_chk")->setEnabled(enable); @@ -1001,9 +999,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds() S32 world_height_regions = MAX_VISIBLE_REGIONS; // Find how much space we have to display the world - LLWorldMapView* map_panel; - map_panel = (LLWorldMapView*)mPanel; - LLRect view_rect = map_panel->getRect(); + LLRect view_rect = mMapView->getRect(); // View size in pixels S32 view_width = view_rect.getWidth(); @@ -1271,9 +1267,9 @@ void LLFloaterWorldMap::onShowTargetBtn() void LLFloaterWorldMap::onShowAgentBtn() { - LLWorldMapView::setPan( 0, 0, FALSE); // FALSE == animate + mMapView->setPan(0, 0, false); // false == animate // Set flag so user's location will be displayed if not tracking anything else - mSetToUserPosition = TRUE; + mSetToUserPosition = true; } void LLFloaterWorldMap::onClickTeleportBtn() @@ -1325,8 +1321,8 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) pos_global.clearVec(); } - F64 map_scale = (F64)LLWorldMapView::getScale(); - LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)), + F64 map_scale = (F64)mMapView->getScale(); + mMapView->setPan(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)), -llfloor((F32)(pos_global.mdV[VY] * map_scale / REGION_WIDTH_METERS)), !animate); mWaitingForTracker = FALSE; @@ -1627,6 +1623,5 @@ void LLFloaterWorldMap::onChangeMaturity() void LLFloaterWorldMap::onFocusLost() { gViewerWindow->showCursor(); - LLWorldMapView* map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel; - map_panel->mPanning = FALSE; + mMapView->mPanning = false; } -- cgit v1.2.3 From 9bca1aa8fb69c2163866dd7e5ce3b60fb62676b3 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 10 Mar 2022 16:52:29 -0800 Subject: SL-15232: Clang format --- indra/newview/llfloaterworldmap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 indra/newview/llfloaterworldmap.cpp (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp old mode 100644 new mode 100755 index cf314c3e60..e54e042006 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -407,14 +407,14 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) S32 map_y = y - mMapView->getRect().mBottom; if (mMapView->pointInView(map_x, map_y)) { - F32 old_slider_zoom = (F32)getChild("zoom slider")->getValue().asReal(); - F32 slider_zoom = old_slider_zoom + ((F32)clicks * -0.3333f); + F32 old_slider_zoom = (F32) getChild("zoom slider")->getValue().asReal(); + F32 slider_zoom = old_slider_zoom + ((F32) clicks * -0.3333f); getChild("zoom slider")->setValue(LLSD(slider_zoom)); mMapView->zoomWithPivot(slider_zoom, map_x, map_y); return true; } } - + return LLFloater::handleScrollWheel(x, y, clicks); } @@ -1267,8 +1267,8 @@ void LLFloaterWorldMap::onShowTargetBtn() void LLFloaterWorldMap::onShowAgentBtn() { - mMapView->setPan(0, 0, false); // false == animate - // Set flag so user's location will be displayed if not tracking anything else + mMapView->setPan(0, 0, false); // false == animate + // Set flag so user's location will be displayed if not tracking anything else mSetToUserPosition = true; } @@ -1622,6 +1622,6 @@ void LLFloaterWorldMap::onChangeMaturity() void LLFloaterWorldMap::onFocusLost() { - gViewerWindow->showCursor(); + gViewerWindow->showCursor(); mMapView->mPanning = false; } -- cgit v1.2.3 From b5406352e9632b6466fdc9bde349ec55b368596b Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 19 Apr 2022 00:01:52 +0300 Subject: DRTVWR-548 post-merge build fix --- indra/newview/llfloaterworldmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index fb44449c55..e7b1efb41d 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1565,7 +1565,7 @@ void LLFloaterWorldMap::onTeleportFinished() { if(isInVisibleChain()) { - LLWorldMapView::setPan(0, 0, TRUE); + mMapView->setPan(0, 0, TRUE); } } -- cgit v1.2.3 From 38cc06e43a92a10d73ab149944b3cff19b8da8ad Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 18 Jul 2022 16:53:43 +0300 Subject: SL-17785 FIXED World Map scrolls too slowly when searching for a region. --- indra/newview/llfloaterworldmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index e7b1efb41d..6bb0ed73e4 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1333,9 +1333,9 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) } F64 map_scale = (F64)mMapView->getScale(); - mMapView->setPan(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)), + mMapView->setPanWithInterpTime(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)), -llfloor((F32)(pos_global.mdV[VY] * map_scale / REGION_WIDTH_METERS)), - !animate); + !animate, 0.1f); mWaitingForTracker = FALSE; } -- cgit v1.2.3 From e3ef38876b9951af3ea8052fb02db46212c76965 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 4 Aug 2022 17:45:06 +0300 Subject: SL-17785 FIXED World Map scrolls too slowly after pressing "Me" button --- indra/newview/llfloaterworldmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterworldmap.cpp') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index f363733261..16b8c7a4bc 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1281,7 +1281,7 @@ void LLFloaterWorldMap::onShowTargetBtn() void LLFloaterWorldMap::onShowAgentBtn() { - mMapView->setPan(0, 0, false); // false == animate + mMapView->setPanWithInterpTime(0, 0, false, 0.1f); // false == animate // Set flag so user's location will be displayed if not tracking anything else mSetToUserPosition = true; } -- cgit v1.2.3