So after reading that the “pressed” property of InputEvent is “Not relevant for events of type InputEventMouseMotion or InputEventScreenDrag.”, I tried to use the “pressure” property of InputEventMouseMotion.
This works fine for MOUSE_BUTTON_LEFT, however the pressure is always zero for other mouse buttons (right, middle, xbuttons).
While I would assume that if a motion event has pressure, it would be considered pressed, the documentation is at least clear that this is not the case.
However, is it expected that only MOUSE_BUTTON_LEFT has pressure? I tried two mice with the same result.
While I can check if any of the mouse buttons are pressed individually, it still seems like an inconsistency in the engine.
“pressure” as part of InputEventMouseMotion is for drawing tablet pens; I’m guessing it happens to give a value of 1.0 for a mouse? What are you trying to achieve?
It’s more that it only happens for one of the buttons of a mouse. If it was the same behaviour for all of them, it would be clear cut. I’m just wondering about the inconsistency of the behaviour; is this intentional, or a bug. As pressure is about pens, I would expect the value for mouse buttons to always be either :
always 0 : in the case that all mouse buttons are seen as not being pens, meaning all buttons have a button pressure of zero
0 or 1: in the case that mouse buttons are seen as togglable, meaning that the pressure exerted is either 0 for up or 1 for down
I would not expect the behaviour to be different for different buttons.
The problem I was facing was checking if a mouse button is down / pressed during a InputEventMouseMotion event.
InputEvent.pressed would seem like the obvious choice, but as the doc states it doesn’t work for this
InputEventMouseMotion.pressure isn’t consistent for different MouseButton, although I have not found this behaviour anywhere in the doc
The only way to, seemingly, do this is to check if any moise button is pressed is with Input.is_mouse_button_pressed(). It’s not exactly elegant, but it works.