0 votes

I currently have a viewport that is just a window into the game map. I use the left mouse click and drag to move it around, and this is done with the input() function.
However, once I do this, none of the other buttons in the gui work unless I make it _unhandled
input() or disable the viewport input.
None of the viewport and buttons overlap and I've tried a mishmash of setting things to pass, stop, ignore, etc.
How can I fix this?

func _input(event: InputEvent) -> void:
if mapwindow.visible:
    if event is InputEventMouseMotion:
        if event.button_mask == BUTTON_MASK_LEFT:
            position -= event.relative * zoom
    if event is InputEventMouseButton:
        if event.is_pressed():
            if event.button_index == BUTTON_WHEEL_UP:
                zoom_in()
            if event.button_index == BUTTON_WHEEL_DOWN:
                zoom_out()
    if Input.is_action_pressed("ui_up"):
        zoom_in()
    if Input.is_action_pressed("ui_down"):
        zoom_out()
Godot version 3.3.4
in Engine by (18 points)

1 Answer

0 votes

If you know when you should be listening for player inputs, you can selectively turn off input to the viewport with gui_disable_input.

by (8,528 points)
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.