Showing the changes to libraries/script-engine/src/PointerEvent.cpp (1 of 15 files). Show all
Unified · Split
| @@ -70,8 +70,8 @@ void PointerEvent::setButton(Button button) { · 69 unmodified lines | |||
| 70 | /*@jsdoc | 70 | /*@jsdoc |
| 71 | * A 2D or 3D mouse or similar pointer event. | 71 | * A 2D or 3D mouse or similar pointer event. |
| 72 | * @typedef {object} PointerEvent | 72 | * @typedef {object} PointerEvent |
| 73 | * @property {string} type - The type of event: <code>"Press"</code>, <code>"DoublePress"</code>, <code>"Release"</code>, or | 73 | * @property {string} type - The type of event: <code>"Press"</code>, <code>"DoublePress"</code>, <code>"Release"</code>, |
| 74 | * <code>"Move"</code>. | 74 | * <code>"Move"</code>, or <code>"Scroll"</code>. |
| 75 | * @property {number} id - Integer number used to identify the pointer: <code>0</code> = hardware mouse, <code>1</code> = left | 75 | * @property {number} id - Integer number used to identify the pointer: <code>0</code> = hardware mouse, <code>1</code> = left |
| 76 | * controller, <code>2</code> = right controller. | 76 | * controller, <code>2</code> = right controller. |
| 77 | * @property {Vec2} pos2D - The 2D position of the event on the intersected object XY plane, where applicable. | 77 | * @property {Vec2} pos2D - The 2D position of the event on the intersected object XY plane, where applicable. |
| @@ -140,6 +140,9 @@ ScriptValue PointerEvent::toScriptValue(ScriptEngine* engine, const PointerEvent · 62 unmodified lines | |||
| 140 | case Release: | 140 | case Release: |
| 141 | obj.setProperty("type", "Release"); | 141 | obj.setProperty("type", "Release"); |
| 142 | break; | 142 | break; |
| 143 | case Scroll: | ||
| 144 | obj.setProperty("type", "Scroll"); | ||
| 145 | break; | ||
| 143 | default: | 146 | default: |
| 144 | case Move: | 147 | case Move: |
| 145 | obj.setProperty("type", "Move"); | 148 | obj.setProperty("type", "Move"); |
| @@ -224,6 +227,8 @@ bool PointerEvent::fromScriptValue(const ScriptValue& object, PointerEvent& even · 78 unmodified lines | |||
| 224 | event._type = DoublePress; | 227 | event._type = DoublePress; |
| 225 | } else if (typeStr == "Release") { | 228 | } else if (typeStr == "Release") { |
| 226 | event._type = Release; | 229 | event._type = Release; |
| 230 | } else if (typeStr == "Scroll") { | ||
| 231 | event._type = Scroll; | ||
| 227 | } else { | 232 | } else { |
| 228 | event._type = Move; | 233 | event._type = Move; |
| 229 | } | 234 | } |
| @@ -268,7 +273,7 @@ bool PointerEvent::fromScriptValue(const ScriptValue& object, PointerEvent& even · 38 unmodified lines | |||
| 268 | return true; | 273 | return true; |
| 269 | } | 274 | } |
| 270 | 275 | ||
| 271 | static const char* typeToStringMap[PointerEvent::NumEventTypes] = { "Press", "DoublePress", "Release", "Move" }; | 276 | static const char* typeToStringMap[PointerEvent::NumEventTypes] = { "Press", "DoublePress", "Release", "Move", "Scroll" }; |
| 272 | static const char* buttonsToStringMap[8] = { | 277 | static const char* buttonsToStringMap[8] = { |
| 273 | "NoButtons", | 278 | "NoButtons", |
| 274 | "PrimaryButton", | 279 | "PrimaryButton", |