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 | 70 | /*@jsdoc |
| 71 | 71 | * A 2D or 3D mouse or similar pointer event. |
| 72 | 72 | * @typedef {object} PointerEvent |
| 73 | − * @property {string} type - The type of event: <code>"Press"</code>, <code>"DoublePress"</code>, <code>"Release"</code>, or | |
| 74 | − * <code>"Move"</code>. | |
| 73 | + * @property {string} type - The type of event: <code>"Press"</code>, <code>"DoublePress"</code>, <code>"Release"</code>, | |
| 74 | + * <code>"Move"</code>, or <code>"Scroll"</code>. | |
| 75 | 75 | * @property {number} id - Integer number used to identify the pointer: <code>0</code> = hardware mouse, <code>1</code> = left |
| 76 | 76 | * controller, <code>2</code> = right controller. |
| 77 | 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 | 140 | case Release: |
| 141 | 141 | obj.setProperty("type", "Release"); |
| 142 | 142 | break; |
| 143 | + case Scroll: | |
| 144 | + obj.setProperty("type", "Scroll"); | |
| 145 | + break; | |
| 143 | 146 | default: |
| 144 | 147 | case Move: |
| 145 | 148 | obj.setProperty("type", "Move"); |
| @@ -224,6 +227,8 @@ bool PointerEvent::fromScriptValue(const ScriptValue& object, PointerEvent& even · 78 unmodified lines | ||
| 224 | 227 | event._type = DoublePress; |
| 225 | 228 | } else if (typeStr == "Release") { |
| 226 | 229 | event._type = Release; |
| 230 | + } else if (typeStr == "Scroll") { | |
| 231 | + event._type = Scroll; | |
| 227 | 232 | } else { |
| 228 | 233 | event._type = Move; |
| 229 | 234 | } |
| @@ -268,7 +273,7 @@ bool PointerEvent::fromScriptValue(const ScriptValue& object, PointerEvent& even · 38 unmodified lines | ||
| 268 | 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 | 277 | static const char* buttonsToStringMap[8] = { |
| 273 | 278 | "NoButtons", |
| 274 | 279 | "PrimaryButton", |