diff --git a/libraries/shared/src/PointerEvent.cpp b/libraries/shared/src/PointerEvent.cpp index e35832391d..f4da41bcbc 100644 --- a/libraries/shared/src/PointerEvent.cpp +++ b/libraries/shared/src/PointerEvent.cpp @@ -41,6 +41,64 @@ PointerEvent::PointerEvent(EventType type, uint32_t id, ; } +/**jsdoc + * A PointerEvent defines a 2D or 3D mouse or similar pointer event. + * @typedef {object} PointerEvent + * @property {string} type - The type of event: "Press", "DoublePress", "Release", or + * "Move". + * @property {number} id - Integer number used to identify the pointer: 0 = hardware mouse, 1 = left + * controller, 2 = right controller. + * @property {Vec2} pos2D - The 2D position of the event on the intersected overlay or entity XY plane. + * @property {Vec3) pos3D - The 3D position of the event on the intersected overlay or entity. + * @property {Vec3} normal - The surface normal at the intersection point. + * @property {Vec3} direction - The direction of the intersection ray. + * @property {string} button - The name of the button pressed: None, Primary, Secondary, + * or Tertiary. + * @property {boolean} isPrimaryButton - true if the button pressed was the primary button, otherwise + * undefined; + * @property {boolean} isLeftButton - true if the button pressed was the primary button, otherwise + * undefined; + * @property {boolean} isSecondaryButton - true if the button pressed was the secondary button, otherwise + * undefined; + * @property {boolean} isRightButton - true if the button pressed was the secondary button, otherwise + * undefined; + * @property {boolean} isTertiaryButton - true if the button pressed was the tertiary button, otherwise + * undefined; + * @property {boolean} isMiddleButton - true if the button pressed was the tertiary button, otherwise + * undefined; + * @property {boolean} isPrimaryHeld - true if the primary button is currently being pressed, otherwise + * false + * @property {boolean} isSecondaryHeld - true if the secondary button is currently being pressed, otherwise + * false + * @property {boolean} isTertiaryHeld - true if the tertiary button is currently being pressed, otherwise + * false + * @property {KeyboardModifiers} keyboardModifiers - Integer value being and with bits set according to which keyboard modifier + * keys are were pressed when the event was generated. + */ +/**jsdoc + *

A KeyboardModifiers value is used to specify which modifier keys on the keyboard are pressed. The value is the sum + * (bitwise OR) of the relevant combination of values from the following table:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
KeyHexadecimal valueDecimal valueDescription
Shift0x0200000033554432A Shift key on the keyboard is pressed.
Control0x0400000067108864A Control key on the keyboard is pressed.
Alt0x08000000134217728An Alt key on the keyboard is pressed.
Meta0x10000000268435456A Meta or Windows key on the keyboard is pressed.
Keypad0x20000000536870912A keypad button is pressed.
Group0x400000001073741824X11 operating system only: An AltGr / Mode_switch key on the keyboard is pressed.
+ * @typedef {number} KeyboardModifiers + */ QScriptValue PointerEvent::toScriptValue(QScriptEngine* engine, const PointerEvent& event) { QScriptValue obj = engine->newObject();