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/llworldmapview.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'indra/newview/llworldmapview.h') diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index a2a6dc53fb..9a549a443a 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -67,8 +67,16 @@ public: bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track); void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id); - // Scale and pan are shared across all instances! (i.e. Terrain and Objects maps are always registered) - static void setScale( F32 scale ); + // Zoom, scale, and pan are shared across all instances! (i.e. Terrain and Objects maps are always registered) + // Scale and zoom are the same thing but with different units. + // Scale is for things defined in in-world coordinates. + // Zoom is used for UI and will interpolate the map scale over multiple frames. + // Pan is in pixels relative to the center of the map. + static void zoom(F32 zoom); + static void zoomWithPivot(F32 zoom, S32 x, S32 y); + static F32 getZoom(); + static void setScale(F32 scale, bool snap = true); + static F32 getScale(); static void translatePan( S32 delta_x, S32 delta_y ); static void setPan( S32 x, S32 y, BOOL snap = TRUE ); // Return true if the current scale level is above the threshold for accessing region info @@ -153,8 +161,6 @@ public: static LLUIImagePtr sForSaleImage; static LLUIImagePtr sForSaleAdultImage; - static F32 sMapScale; // scale = size of a region in pixels - BOOL mItemPicked; static F32 sPanX; // in pixels @@ -194,6 +200,17 @@ public: private: void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right); + + static F32 scaleFromZoom(F32 zoom); + static F32 zoomFromScale(F32 scale); + + static F32 sMapScale; + static F32 sTargetMapScale; + static LLVector2 sZoomPivot; + static LLFrameTimer sZoomTimer; + + static F32 sWidthForZoom; + static F32 sHeightForZoom; }; #endif -- 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/llworldmapview.h | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'indra/newview/llworldmapview.h') diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index 9a549a443a..edbdded120 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -67,20 +67,21 @@ public: bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track); void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id); - // Zoom, scale, and pan are shared across all instances! (i.e. Terrain and Objects maps are always registered) - // Scale and zoom are the same thing but with different units. - // Scale is for things defined in in-world coordinates. + // Scale, aka zoom, is shared across all instances! (i.e. Terrain and Objects maps are always registered) // Zoom is used for UI and will interpolate the map scale over multiple frames. + void zoom(F32 zoom); + void zoomWithPivot(F32 zoom, S32 x, S32 y); + F32 getZoom(); + // Scale is a linear scaling factor of in-world coordinates + F32 getScale(); + // setScaleSetting/getScaleSetting are for the default map setting on login + static void setScaleSetting(F32 scaleSetting); + static F32 getScaleSetting(); // Pan is in pixels relative to the center of the map. - static void zoom(F32 zoom); - static void zoomWithPivot(F32 zoom, S32 x, S32 y); - static F32 getZoom(); - static void setScale(F32 scale, bool snap = true); - static F32 getScale(); - static void translatePan( S32 delta_x, S32 delta_y ); - static void setPan( S32 x, S32 y, BOOL snap = TRUE ); + void translatePan( S32 delta_x, S32 delta_y ); + void setPan( S32 x, S32 y, BOOL snap = TRUE ); // Return true if the current scale level is above the threshold for accessing region info - static bool showRegionInfo(); + bool showRegionInfo(); LLVector3 globalPosToView(const LLVector3d& global_pos); LLVector3d viewPosToGlobal(S32 x,S32 y); @@ -163,10 +164,10 @@ public: BOOL mItemPicked; - static F32 sPanX; // in pixels - static F32 sPanY; // in pixels - static F32 sTargetPanX; // in pixels - static F32 sTargetPanY; // in pixels + F32 mPanX; // in pixels + F32 mPanY; // in pixels + F32 mTargetPanX; // in pixels + F32 mTargetPanY; // in pixels static S32 sTrackingArrowX; static S32 sTrackingArrowY; static bool sVisibleTilesLoaded; @@ -201,16 +202,16 @@ public: private: void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right); + void setScale(F32 scale, bool snap = true); + static F32 scaleFromZoom(F32 zoom); static F32 zoomFromScale(F32 scale); - static F32 sMapScale; - static F32 sTargetMapScale; + F32 mMapScale; + F32 mTargetMapScale; + static F32 sMapScaleSetting; static LLVector2 sZoomPivot; static LLFrameTimer sZoomTimer; - - static F32 sWidthForZoom; - static F32 sHeightForZoom; }; #endif -- cgit v1.2.3