The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I'm trying to implement a screen magnifier option as an accessibility implementation. However, the scroll wheel functionality of the vertical/horizontal scroll bar interferes with this (it should not trigger so the zoom function can use the scroll wheel for ease of access). Is there a way to turn this functionality off or override the function?

I'm using a ScrollboxContainer to store the elements. Do I need to make a custom GUI class for this?

Godot version 3.4
in Engine by (15 points)

1 Answer

+1 vote
Best answer

Given node tree

Control
    ScrollContainer
        VBoxContainer
            Thing1
            Thing2
            ...

click ScrollContainer. In inspector dock, go to Mouse > Filter and set Ignore. For me, it worked. But when you wheel inside the VScroller, it still scrolls the screen.

To prevent this, add script below to the ScrollContainer

var _v_scroll: VScrollBar

func _ready() -> void:
    _v_scroll = get_node("_v_scroll")

func _input(event: InputEvent) -> void:
    if event is InputEventMouseButton and (event.button_index == BUTTON_WHEEL_DOWN || event.button_index == BUTTON_WHEEL_UP):
        _v_scroll.set_mouse_filter(Control.MOUSE_FILTER_IGNORE)
    else:
        _v_scroll.set_mouse_filter(Control.MOUSE_FILTER_PASS)

when you scroll, it disables the mouse input. When you not, it enables the mouse input.

by (236 points)
selected by

This actually doesn't fully work, you need to also change the mouse filter with the container. (The scrolling also happens on the container as well as the scroll bar). But once I did that, it worked! Thanks.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.