Mouse scroll wheel input triggers erratically

I use mouse wheel input in my game to zoom in and out. This has stopped working recently, maybe because of Defold being updated.

For example, when scrolling only up, mouse_wheel_down also fires:

DEBUG:SCRIPT: down
DEBUG:SCRIPT: up
DEBUG:SCRIPT: down
DEBUG:SCRIPT: up
DEBUG:SCRIPT: down
DEBUG:SCRIPT: up
DEBUG:SCRIPT: down
DEBUG:SCRIPT: up
DEBUG:SCRIPT: down
DEBUG:SCRIPT: up
DEBUG:SCRIPT: down
DEBUG:SCRIPT: up
DEBUG:SCRIPT: down

With this code:

function on_input(self, action_id, action)

	if action.value == 1 then
		if action_id == hash("mouse_wheel_up") then
			print("up")
		end
		if action_id == hash("mouse_wheel_down") then
			print("down")
		end
	end

end

Minimal project:
scroll_wheel.zip (2.1 KB)

Defold 1.9.0 on Mac, when running the game from the editor with CMD+B.

I think this is related: Mouse wheel up and down event are broken in 1.9.0 · Issue #9129 · defold/defold · GitHub

1 Like

@Mathias_Westerdahl is working on it, and it’s going to be fixed in 1.9.1 Beta soon

3 Likes