diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2022-03-10 16:52:29 -0800 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2022-04-05 11:55:34 -0700 |
commit | 9bca1aa8fb69c2163866dd7e5ce3b60fb62676b3 (patch) | |
tree | 8aa9f36d0490dc6c05d54606c80bedbff48b0fbc /indra/newview | |
parent | c6cba3a67d4a346d1d5cf0cc6e6a8fe8c640e13f (diff) |
SL-15232: Clang format
Diffstat (limited to 'indra/newview')
-rwxr-xr-x[-rw-r--r--] | indra/newview/llfloaterworldmap.cpp | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llworldmapview.cpp | 127 |
2 files changed, 59 insertions, 80 deletions
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index cf314c3e60..e54e042006 100644..100755 --- 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<LLUICtrl>("zoom slider")->getValue().asReal(); - F32 slider_zoom = old_slider_zoom + ((F32)clicks * -0.3333f); + F32 old_slider_zoom = (F32) getChild<LLUICtrl>("zoom slider")->getValue().asReal(); + F32 slider_zoom = old_slider_zoom + ((F32) clicks * -0.3333f); getChild<LLUICtrl>("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; } diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index cad655ea48..57292f98a0 100644..100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -170,26 +170,26 @@ void LLWorldMapView::cleanupClass() sForSaleAdultImage = NULL; } -LLWorldMapView::LLWorldMapView() -: LLPanel(), - mBackgroundColor( LLColor4( OCEAN_RED, OCEAN_GREEN, OCEAN_BLUE, 1.f ) ), - mItemPicked(FALSE), +LLWorldMapView::LLWorldMapView() : + LLPanel(), + mBackgroundColor(LLColor4(OCEAN_RED, OCEAN_GREEN, OCEAN_BLUE, 1.f)), + mItemPicked(FALSE), mPanX(0.f), mPanY(0.f), mTargetPanX(0.f), mTargetPanY(0.f), - mPanning( FALSE ), - mMouseDownPanX( 0 ), - mMouseDownPanY( 0 ), - mMouseDownX( 0 ), - mMouseDownY( 0 ), + mPanning(FALSE), + mMouseDownPanX(0), + mMouseDownPanY(0), + mMouseDownX(0), + mMouseDownY(0), mSelectIDStart(0), mMapScale(0.f), mTargetMapScale(0.f) { - //LL_INFOS("WorldMap") << "Creating the Map -> LLWorldMapView::LLWorldMapView()" << LL_ENDL; + // LL_INFOS("WorldMap") << "Creating the Map -> LLWorldMapView::LLWorldMapView()" << LL_ENDL; - clearLastClick(); + clearLastClick(); } BOOL LLWorldMapView::postBuild() @@ -253,104 +253,89 @@ void LLWorldMapView::zoom(F32 zoom) void LLWorldMapView::zoomWithPivot(F32 zoom, S32 x, S32 y) { mTargetMapScale = scaleFromZoom(zoom); - sZoomPivot = LLVector2(x, y); + sZoomPivot = LLVector2(x, y); if (!sZoomTimer.getStarted() && mMapScale != mTargetMapScale) { sZoomTimer.start(); } } -F32 LLWorldMapView::getZoom() -{ - return LLWorldMapView::zoomFromScale(mMapScale); -} +F32 LLWorldMapView::getZoom() { return LLWorldMapView::zoomFromScale(mMapScale); } -F32 LLWorldMapView::getScale() -{ - return mMapScale; -} +F32 LLWorldMapView::getScale() { return mMapScale; } // static -void LLWorldMapView::setScaleSetting(F32 scaleSetting) -{ - sMapScaleSetting = scaleSetting; -} +void LLWorldMapView::setScaleSetting(F32 scaleSetting) { sMapScaleSetting = scaleSetting; } // static -F32 LLWorldMapView::getScaleSetting() -{ - return sMapScaleSetting; -} +F32 LLWorldMapView::getScaleSetting() { return sMapScaleSetting; } void LLWorldMapView::setScale(F32 scale, bool snap) { - if (scale != mMapScale) - { - F32 old_scale = mMapScale; + if (scale != mMapScale) + { + F32 old_scale = mMapScale; - mMapScale = scale; + mMapScale = scale; // Set the scale used when saving the setting sMapScaleSetting = scale; - if (mMapScale <= 0.f) - { - mMapScale = 0.1f; - } + if (mMapScale <= 0.f) + { + mMapScale = 0.1f; + } + + F32 ratio = (scale / old_scale); + mPanX *= ratio; + mPanY *= ratio; + mTargetPanX = mPanX; + mTargetPanY = mPanY; + sVisibleTilesLoaded = false; - F32 ratio = (scale / old_scale); - mPanX *= ratio; - mPanY *= ratio; - mTargetPanX = mPanX; - mTargetPanY = mPanY; - sVisibleTilesLoaded = false; - // If we are zooming relative to somewhere else rather than the center of the map, compensate for the difference in panning here if (!sZoomPivot.isExactlyZero()) { LLVector2 relative_pivot; - relative_pivot.mV[VX] = sZoomPivot.mV[VX] - (getRect().getWidth() / 2.0); - relative_pivot.mV[VY] = sZoomPivot.mV[VY] - (getRect().getHeight() / 2.0); + relative_pivot.mV[VX] = sZoomPivot.mV[VX] - (getRect().getWidth() / 2.0); + relative_pivot.mV[VY] = sZoomPivot.mV[VY] - (getRect().getHeight() / 2.0); LLVector2 zoom_pan_offset = relative_pivot - (relative_pivot * scale / old_scale); mPanX += zoom_pan_offset.mV[VX]; mPanY += zoom_pan_offset.mV[VY]; mTargetPanX += zoom_pan_offset.mV[VX]; mTargetPanY += zoom_pan_offset.mV[VY]; } - } + } if (snap) { mTargetMapScale = scale; -} + } } // static -void LLWorldMapView::translatePan( S32 delta_x, S32 delta_y ) +void LLWorldMapView::translatePan(S32 delta_x, S32 delta_y) { - mPanX += delta_x; - mPanY += delta_y; - mTargetPanX = mPanX; - mTargetPanY = mPanY; - sVisibleTilesLoaded = false; + mPanX += delta_x; + mPanY += delta_y; + mTargetPanX = mPanX; + mTargetPanY = mPanY; + sVisibleTilesLoaded = false; } // static -void LLWorldMapView::setPan( S32 x, S32 y, BOOL snap ) +void LLWorldMapView::setPan(S32 x, S32 y, BOOL snap) { - mTargetPanX = (F32)x; - mTargetPanY = (F32)y; - if (snap) - { - mPanX = mTargetPanX; - mPanY = mTargetPanY; - } - sVisibleTilesLoaded = false; + mTargetPanX = (F32) x; + mTargetPanY = (F32) y; + if (snap) + { + mPanX = mTargetPanX; + mPanY = mTargetPanY; + } + sVisibleTilesLoaded = false; } -bool LLWorldMapView::showRegionInfo() -{ - return (LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD ? true : false); -} +bool LLWorldMapView::showRegionInfo() { return (LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD ? true : false); } /////////////////////////////////////////////////////////////////////////////////// // HELPERS @@ -1884,13 +1869,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) } // static -F32 LLWorldMapView::scaleFromZoom(F32 zoom) -{ - return exp2(zoom) * 256.0f; -} +F32 LLWorldMapView::scaleFromZoom(F32 zoom) { return exp2(zoom) * 256.0f; } // static -F32 LLWorldMapView::zoomFromScale(F32 scale) -{ - return log2(scale / 256.f); -} +F32 LLWorldMapView::zoomFromScale(F32 scale) { return log2(scale / 256.f); } |