# How to scale/zoom a widget with blueprints?

**URL:** <https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983>\
**Category:** UI\
**Tags:** unreal-engine, Widget, UE4, question, Blueprint\
**Created:** [August 5, 2018, 5:25am UTC](https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983 "2018-08-05T05:25:44Z")\
**Posts on this page:** 1\
**Showing post:** 14

<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:** [September 15, 2020, 6:32am UTC](https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983/14 "2020-09-15T06:32:24Z")

</div>

Perhaps I should’ve included a general overview of how it’s supposed to work so it’s easier to iron out / refactor the bits that are far from perfect.

- the zooming is based on the number of steps controlled by the mouse wheel
- `Current Zoom Step` / `Min Zoom` / `Max Zoom` control the zooming process
- Min of -3 and Max of +3 would produce 5 steps: [-2,-1,0,1,2]
- Min of -2 and Max of +8 would allow you to _zoom out once_ but _zoom in_ a lot!
- the `Zoom Factor` is the magnitude of a step where 0.4 = 60% or 0.9 =10% of the current widget scale (kind of)
- it’s ‘kind of’ because of how scaling works, in order to be consistent both ways and account for the current scale, we need to use the inverse of 1 here; otherwise we will not return to where we started
- if you zoom in by 20%, you’re at 1.20 scale but if you zoom out of that 1.20 by 20%… that’s actually 24% of the scale instead since we’re using a greater base
- also, the `Zoom Factor`should not exceed 1 or it would reverse the process. Low values, below 0.5% should be, ideally, avoided as it might look too jarring (unless we work in interpolation). But should still work OK and might be even necessary for huge maps - like a star map!

As for the whole process: we scale the image up and down and shift it in such a way, that the pixel under the cursor remains in the same position after the Scale & Translate have taken place. As demonstrated by the navy-blue spaghetti. 😑

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983)._
