# Two ways scroll box?

**URL:** <https://forums.unrealengine.com/t/two-ways-scroll-box/89955>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [April 14, 2017, 7:19pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955 "2017-04-14T19:19:09Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_de\_Souza](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan\_de\_Souza](https://forums.unrealengine.com/u/Ivan_de_Souza)\
**Post date:** [April 14, 2017, 7:19pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/1 "2017-04-14T19:19:09Z")

</div>

I’m trying to create a talent tree like Path of Exile. However, i’m needing a two ways scroll to navitage through the talent BP.  
The only way i imagined it was a two way scroll(vertical and horizontal), but the scroll box only accepts one of those.  
Is there a way to create a 2 way scroll box or do it in another way?

In case you don’t know how the PoE talent skill tree looks like, its like this :

> **[Passive Skill Tree - Path of Exile](https://www.pathofexile.com/passive-skill-tree)**
>
> Path of Exile is a free online-only action RPG under development by Grinding Gear Games in New Zealand.

---

<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:** [April 15, 2017, 1:36pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/2 "2017-04-15T13:36:56Z")

</div>

Ideas would be:  
1st:  
Pack a second Scrollbox into an existing one. The first one vertical, the second one horizontal.

2nd:  
Create a Panel and two Sliders.  
One slider uses the vertical space and one the horizontal.  
position stuff inside the Panel on sliderH value \* content width and sliderV value \* content height.

---

<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:** [April 15, 2017, 3:03pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/3 "2017-04-15T15:03:35Z")

</div>

Here’s another idea (that worked for me):

**For mouse dragging:**

- nest two canvases and shift one in the other
- the top one is the size of the interactable area, the inner one is much larger than the screen - you’d be shifting this one about, it will house all the icons and whatnot
- \*OnMouseDown \*captures the attention of the top canvas
- _OnMouseMove_ shifts the inner canvas by CursorDelta

**For scrolling bars:**

- from my experience, h/v scrollboxes will most likely give you a headache after a while - kind of depends of what you want to achieve, though
- use two slider widgets (placed on the top canvas) for this and map-range them to translate into the size of the inner canvas, overriding their \*OnValueChanged \*and setting the inner canvas’ slot’s position
- you’d want to synchronise the mouse drag and the the sliders so the sliders follow it

Let me know if you have any issues setting it up, I can try to dig it up from one of the old projects. I had the whole thing working without any snags.

**For zooming in and out:**

- wrap the inner canvas with a ScaleBox and adjust the UserSpecified stretch - this should work in theory, untested.

---

<div class="post-metadata">

**Author:** ![Ivan\_de\_Souza](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan\_de\_Souza](https://forums.unrealengine.com/u/Ivan_de_Souza)\
**Post date:** [April 16, 2017, 3:45am UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/4 "2017-04-16T03:45:21Z")

</div>

> [@Everynone;695520](#):
>
> Here’s another idea (that worked for me):
> 
> **For mouse dragging:**
> 
> - nest two canvases and shift one in the other
> - the top one is the size of the interactable area, the inner one is much larger than the screen - you’d be shifting this one about, it will house all the icons and whatnot
> - \*OnMouseDown \*captures the attention of the top canvas
> - _OnMouseMove_ shifts the inner canvas by CursorDelta
> 
> **For scrolling bars:**
> 
> - from my experience, h/v scrollboxes will most likely give you a headache after a while - kind of depends of what you want to achieve, though
> - use two slider widgets (placed on the top canvas) for this and map-range them to translate into the size of the inner canvas, overriding their \*OnValueChanged \*and setting the inner canvas’ slot’s position
> - you’d want to synchronise the mouse drag and the the sliders so the sliders follow it
> 
> Let me know if you have any issues setting it up, I can try to dig it up from one of the old projects. I had the whole thing working without any snags.
> 
> **For zooming in and out:**
> 
> - wrap the inner canvas with a ScaleBox and adjust the UserSpecified stretch - this should work in theory, untested.

I did what you said and it’s working 90% percent fine, however, how could i add a “limit” to the scrolling of the canvas, to not let a “blank” area appear on the viewport?

---

<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:** [April 16, 2017, 8:32am UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/5 "2017-04-16T08:32:19Z")

</div>

You’d need to clamp the value before setting the canvas position: (movable canvas size - viewport size)/2:

 ![clampedscrub.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/8/383bba5c2d65de4a5beaf98cdc08b11447840e3a.jpeg)

---

<div class="post-metadata">

**Author:** ![Galvanicus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galvanicus](https://forums.unrealengine.com/u/Galvanicus)\
**Post date:** [December 27, 2019, 1:09am UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/6 "2019-12-27T01:09:58Z")

</div>

> [@Everynone](#):
>
> You’d need to clamp the value before setting the canvas position: (movable canvas size - viewport size)/2:
> 
> ![clampedscrub.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/8/383bba5c2d65de4a5beaf98cdc08b11447840e3a.jpeg)

I have attempted this for the mouse dragging but couldn’t make it work _properly_. I am not even sure how to debug this further.  
I created 2 debugs to track if “is mouse button down” and the “get position”.  
My first issue is that the mouse button is only registered as down if i double click, not single click. I need to double click, hold and wait a second before it registers as true instead of “on left click and hold”.  
~~The second issue is that on second click, it checks for the position but nothing else happens and I cannot drag it around.~~ Had to wait for input to register, this part works!

I have attached both the blueprint and the UI hierarchy.

Edit: I corrected the -1 to 0.5; the issue is no longer the dragging about but the mouse clicking registration.

---

<div class="post-metadata">

**Author:** ![Galvanicus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galvanicus](https://forums.unrealengine.com/u/Galvanicus)\
**Post date:** [December 27, 2019, 1:24am UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/7 "2019-12-27T01:24:27Z")

</div>

Well I tried something else for the heck of it and it seems to have worked!  
I created 2 overrides for On Mouse Button Down and On Mouse Button Up and set up my own boolean. This seems to register on single clicking.

---

<div class="post-metadata">

**Author:** ![the\_tubby1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@the\_tubby1](https://forums.unrealengine.com/u/the_tubby1)\
**Post date:** [April 21, 2020, 4:36am UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/8 "2020-04-21T04:36:46Z")

</div>

Is there a way to make this account for the zoom in? Is this supposed to do that already? The limits should extend according to the zoom amount surely?

---

<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:** [April 21, 2020, 8:04am UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/9 "2020-04-21T08:04:23Z")

</div>

> [@the\_tubby1](#):
>
> Is this supposed to do that already?

Not at this point, no. I did say:

> [@](#):
>
> wrap the inner canvas with a ScaleBox and adjust the UserSpecified stretch - this should work in theory, untested.

But it’s been 3 years since that so yeah, this ^^^ I hope 🙂 Sounds like it could work. Still untested 😑

---

<div class="post-metadata">

**Author:** ![the\_tubby1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@the\_tubby1](https://forums.unrealengine.com/u/the_tubby1)\
**Post date:** [April 21, 2020, 4:02pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/10 "2020-04-21T16:02:59Z")

</div>

> [@Everynone](#):
>
> Not at this point, no. I did say:
> 
> But it’s been 3 years since that so yeah, this ^^^ I hope 🙂 Sounds like it could work. Still untested 😑

I used this method and it worked fine so 🙂 good stuff. But accounting for the zoom with the clamp is the issue. When I zoom I adjust the user specified stretch but then as the size changes the clamped moving limits stay the same so you cant move very far around the zoomed map. If that makes sense.

---

<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:** [April 21, 2020, 4:40pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/11 "2020-04-21T16:40:44Z")

</div>

> [@](#):
>
> If that makes sense.

I think it makes sense. Perhaps it’s a matter of translating the stretch value into clamp size - a clamped MapRange node should help here. I cannot tell from the top of my head what values would work but that’s how I’d approach it.

---

<div class="post-metadata">

**Author:** ![TarlRaney](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tarlraney/32/1016964_2.png) [@TarlRaney](https://forums.unrealengine.com/u/TarlRaney)\
**Post date:** [May 25, 2021, 8:47pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/12 "2021-05-25T20:47:23Z")

</div>

I was able to make this (or a slightly edited version) work. Thanks! Now, what’s the appropriate way to handle scale for lots of objects in that lower canvas? I have a grid of hex tiles used as slots for placing hex tiles. I’ve tried to match scale for the canvas and the tiles, but they always get bigger or smaller when I zoom in and out and on drag. For now, I chose a scale I like and removed the zoom feature, but think I may want that back later. Any tips or links how to handle that?

---

<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:** [May 25, 2021, 9:01pm UTC](https://forums.unrealengine.com/t/two-ways-scroll-box/89955/13 "2021-05-25T21:01:49Z")

</div>

> [@TarlRaney](#):
>
> I’ve tried to match scale for the canvas and the tiles, but they always get bigger or smaller when I zoom in and out and on drag.

Not sure I understand but have a look at how this canvas is scaled, the post goes into details regarding zooming in / out and handling scale both ways.

> **[How to scale/zoom a widget with blueprints?](https://forums.unrealengine.com/questions/815202/how-to-scalezoom-a-widget-with-blueprints.html)**
>
> I basically want to scale a widget that’s inside of another widget. I have many many buttons on a complex layout and I want users to be able to zoom in to select the specific button as well as zoom out to see the big picture. Basically, think of...
