Topic was automatically imported from the old Question2Answer platform.
Asked By
punishedfelix
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?
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.
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.