History

Wheel events being sent, but not being used by Qt?

Ada committed 1 year ago

Commit dcd03341 parent 587bec615 files · +127 −12Browse files

Showing the changes to libraries/script-engine/src/PointerEvent.cpp (1 of 15 files). Show all

Unified · Split

libraries/script-engine/src/PointerEvent.cpp+8−3
@@ -70,8 +70,8 @@ void PointerEvent::setButton(Button button) { · 69 unmodified lines
7070 /*@jsdoc
7171 * A 2D or 3D mouse or similar pointer event.
7272 * @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>.
7575 * @property {number} id - Integer number used to identify the pointer: <code>0</code> = hardware mouse, <code>1</code> = left
7676 * controller, <code>2</code> = right controller.
7777 * @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
140140 case Release:
141141 obj.setProperty("type", "Release");
142142 break;
143+ case Scroll:
144+ obj.setProperty("type", "Scroll");
145+ break;
143146 default:
144147 case Move:
145148 obj.setProperty("type", "Move");
@@ -224,6 +227,8 @@ bool PointerEvent::fromScriptValue(const ScriptValue& object, PointerEvent& even · 78 unmodified lines
224227 event._type = DoublePress;
225228 } else if (typeStr == "Release") {
226229 event._type = Release;
230+ } else if (typeStr == "Scroll") {
231+ event._type = Scroll;
227232 } else {
228233 event._type = Move;
229234 }
@@ -268,7 +273,7 @@ bool PointerEvent::fromScriptValue(const ScriptValue& object, PointerEvent& even · 38 unmodified lines
268273 return true;
269274 }
270275
271−static const char* typeToStringMap[PointerEvent::NumEventTypes] = { "Press", "DoublePress", "Release", "Move" };
276+static const char* typeToStringMap[PointerEvent::NumEventTypes] = { "Press", "DoublePress", "Release", "Move", "Scroll" };
272277 static const char* buttonsToStringMap[8] = {
273278 "NoButtons",
274279 "PrimaryButton",