Zoom in/out with the wheel axis

I have Zoom in/out with the wheel axis.
The problem is that when I scroll within a scroll, both the camera and the scroll move.
Is there a way to only zoom in on the camera when the focus is outside the scroll?
Is there any other way to do it?

Hey @Drakgoku!

Are you using the “SetInputModeGameAndUI” Node?
(alternatively “SetInputModeGame” and “SetInputModeUI”)

The way it’s supposed to work is it will scroll the scroll box in UI.

It is possible that you may need to set your scroll box to “Consume mouse wheel” in the details on the widget. :slight_smile:

Currently it is partially consumed by scrolling.
I explain it: when I scroll with the mouse, within a scroll (listview, tileview, scroll…), what it does is consume the scroll and when it reaches the limit it runs out and consumes the viewport and zooms in/ out just what I don’t want. Resulting in both the camera and the scroll move.

Yes, I use SetInputModeGameAndUI.
I use a tile view and I can’t get the scroll of the tile view to consume it. (I don’t know how to access that type of scroll to be able to consume it)

I have also tried:

  • Scrollbox (Consume mouse wheel)
    • TileView

It doesn’t work either, leaving the same effect.

another option is to just disable the mousewheel input when the widget is hovered

It’s not possible.
1 - To hover there is no option for it.
There is this:

If I use “OnItemIsHoveredChanged” there is a problem. The problem arises from the fact that it will only scroll correctly when inside the element. If that element has X and Y spacing, then it will “pass through” and do the same effect by zooming the camera in or out when the widget (tile view) reaches the top or bottom.

2 - I don’t want to disable “disable mouse wheel input” as I have to scroll the widget





No, I am not going to use the event tick.

Well, why don’t I use the event tick:
The event tick is too important a waste of resources. It doesn’t make sense to me. To do this, I am looking for a Listener or, in other words, an event. It is only executed once, optimizing resources.

i was referring to the input action, have a check after that (iswidget hovered)

this wont disable the mousewheel for the scroll box

usually in your player controller, get a ref to scroll widget or even its parent widget if you have a main midget and pull off that ishovered()

1 Like

̶I̶ ̶g̶i̶v̶e̶ ̶u̶p̶.̶ ̶I̶ ̶p̶u̶t̶ ̶t̶h̶e̶ ̶b̶o̶o̶l̶e̶a̶n̶ ̶t̶h̶a̶t̶ ̶A̶u̶r̶a̶n̶1̶3̶ ̶t̶o̶l̶d̶ ̶m̶e̶ ̶a̶b̶o̶u̶t̶ ̶i̶n̶ ̶t̶h̶e̶ ̶c̶o̶n̶t̶r̶o̶l̶l̶e̶r̶.̶
̶A̶n̶d̶ ̶f̶r̶o̶m̶ ̶n̶+̶1̶ ̶w̶i̶d̶g̶e̶t̶ ̶s̶e̶t̶ ̶t̶h̶e̶ ̶v̶a̶r̶i̶a̶b̶l̶e̶.̶.̶.̶ ̶p̶f̶f̶f̶

̶(̶O̶k̶.̶.̶)̶ ̶5̶0̶%̶ ̶
̶!̶[̶]̶(̶u̶p̶l̶o̶a̶d̶:̶/̶/̶w̶j̶u̶Q̶e̶u̶9̶Z̶1̶e̶a̶w̶s̶E̶A̶n̶I̶r̶0̶5̶A̶J̶h̶d̶2̶T̶I̶.̶p̶n̶g̶)̶

̶(̶O̶k̶)̶ ̶5̶0̶%̶ ̶̶D̶e̶t̶e̶c̶t̶ ̶i̶f̶ ̶i̶t̶ ̶i̶s̶ ̶h̶o̶v̶e̶r̶ ̶w̶i̶t̶h̶i̶n̶ ̶t̶h̶e̶ ̶w̶i̶d̶g̶e̶t̶ ̶i̶t̶s̶e̶l̶f̶

̶
̶F̶o̶r̶ ̶m̶e̶,̶ ̶I̶ ̶d̶o̶n̶’̶t̶ ̶l̶i̶k̶e̶ ̶i̶t̶.̶ ̶I̶ ̶w̶i̶l̶l̶ ̶c̶h̶a̶n̶g̶e̶ ̶i̶t̶ ̶i̶n̶ ̶t̶h̶e̶ ̶n̶o̶t̶ ̶t̶o̶o̶ ̶d̶i̶s̶t̶a̶n̶t̶ ̶f̶u̶t̶u̶r̶e̶ ̶d̶o̶i̶n̶g̶ ̶i̶t̶ ̶c̶o̶r̶r̶e̶c̶t̶l̶y̶.̶ ̶I̶ ̶c̶o̶n̶t̶i̶n̶u̶e̶ ̶w̶i̶t̶h̶ ̶s̶o̶m̶e̶t̶h̶i̶n̶g̶ ̶e̶l̶s̶e̶,̶ ̶I̶ ̶h̶a̶v̶e̶ ̶w̶a̶s̶t̶e̶d̶ ̶a̶ ̶l̶o̶t̶ ̶o̶f̶ ̶t̶i̶m̶e̶ ̶w̶i̶t̶h̶ ̶t̶h̶i̶s̶.̶

Now I have realized that I need to implement Auran13’s solution “for each widget” and it is normal if I want to control the n+1 widgets… I just dismissed this boilerplate idea “instantly” without hesitation.

Simple correct solution:
1 - In your main widget put a layout and see if any child is hover.
2 - Tell the wheel to only work when there is no hover child.

So if things are done correctly.
I’m a little fed up with the boilerplate advice of 90% of users and sometimes since I can’t do it any other way I have to follow that “pirate” structure.

you dont need to do it for each widget, say you have a ‘hud widget’ which can be an empty canvas panel, add the other widgets to that as children and then check if the ‘hud widget’ ishovered(), it works for me