# Worldmap Window: Zoom to Mouse: update Pivot offset

**URL:** <https://forums.unrealengine.com/t/worldmap-window-zoom-to-mouse-update-pivot-offset/1707254>\
**Category:** UI\
**Tags:** UE-5, minimap, unreal-engine, question, Blueprint, UMG\
**Created:** [February 23, 2024, 6:40am UTC](https://forums.unrealengine.com/t/worldmap-window-zoom-to-mouse-update-pivot-offset/1707254 "2024-02-23T06:40:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BDC\_Patrick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bdc_patrick/32/1104221_2.png) [@BDC\_Patrick](https://forums.unrealengine.com/u/BDC_Patrick)\
**Post date:** [February 23, 2024, 6:40am UTC](https://forums.unrealengine.com/t/worldmap-window-zoom-to-mouse-update-pivot-offset/1707254/1 "2024-02-23T06:40:39Z")

</div>

Hi there .  
I’m currently making Progress in my Game UI.  
During the past 5 Days i’m dealing with my Worldmap Window.

This should have the following Features:  
• Can be scrolled with Sliders  
• Can have markers  
• zoom onto a specific position  
• Zoom with mousewheel to mouse position

The problem i now get is targeting the last two features… cause to zoom onto a position on the map (like a marker or the mouse hovered spot), i need to update the RenderPivot of the Worldmap Image, so changing the RenderScale has a target.

To avoid the Map to offset when a new Pivot is set (including updating the pivot OnMouseMove), i need to calculate a Counter-Offset.

This works flawelessly for a Map scale of 1.0! But break at any other scale…

A video of the Problem:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/5/5/555572e4fe21278d85d408b1b1ef84d1226e94d4.jpeg "Whats Wrong Here") ](https://www.youtube.com/watch?v=0aaBCO9_HyE)

The Pivot set and translation is done in 3 Events:

 ![image-2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/b/4ab948149bd8916d61fa8ee736dd63004bf0e7ee.png)  
 ![image-3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/c/5bc7f1f9a12529e971b352a02940c3d5f18c69d3.png)  
 ![image-4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/1/931787422d0ee8c4eb47cbe3c0456c6605912202.png)

Some Variable explanations:  
CurrentMapSize is the current absolute Size of the Images Scaled Cached Geometry.  
CanvasSize is the absolute size of thr Canvas cached Geometry.  
PivOff is the CounterOffset  
Translate is the FinalTranslation set to the Image.  
MaxScroll is the calculated maximum amount of scrolling allowed, scaled… so the Map always stays in the Canvas.  
CurrentScroll is the negative Translation, defined by the Scroll-Sliders.  
MapCursor is the Relative location of the Mouse, inside the Canvas.

Does one know a solution, to make the pivot offset counter work for unspecified Scales of the Image?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2024, 2:37pm UTC](https://forums.unrealengine.com/t/worldmap-window-zoom-to-mouse-update-pivot-offset/1707254/2 "2024-02-23T14:37:31Z")

</div>

> [@BDC\_Patrick](#):
>
> • zoom onto a specific position  
> • Zoom with mousewheel to mouse position

You could have a look at how it was accomplished here:

> [@How to scale/zoom a widget with blueprints?](https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983/12):
>
> Better, more up-to-date download link: And a project link because who wants to punch in all of this manually…

And if you scroll down, there is [an attached project](https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983/25) you could take apart - it received a couple updates over time. Perhaps it will inspire you.

---

<div class="post-metadata">

**Author:** ![BDC\_Patrick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bdc_patrick/32/1104221_2.png) [@BDC\_Patrick](https://forums.unrealengine.com/u/BDC_Patrick)\
**Post date:** [February 24, 2024, 10:06am UTC](https://forums.unrealengine.com/t/worldmap-window-zoom-to-mouse-update-pivot-offset/1707254/3 "2024-02-24T10:06:17Z")

</div>

This really seems to help.  
Thank you very much ❤

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 25, 2024, 10:06am UTC](https://forums.unrealengine.com/t/worldmap-window-zoom-to-mouse-update-pivot-offset/1707254/4 "2024-03-25T10:06:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
